Giter Site home page Giter Site logo

xcwd's People

Contributors

basti1302 avatar fmichea avatar jackodirks avatar kvaps avatar milibopp avatar omoerbeek avatar operation-tempete avatar schischi avatar syl20bnr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

xcwd's Issues

Release

Hey there 👋

are the any plans to make a release?

Unused return value warning

I had an issue with an ignored return value, when compiling xcwd using gcc version 4.6.3-1ubuntu5 (See output below). The problem can be resolved trivially by removing -Werror from the compiler flags in the Makefile and should probably be fixed, since it currently does not compile out of the box with my gcc version (I'd be surprised if that would be an Ubuntu-only issue). However, I wondered how to resolve this with this strict compiler option, since I assumed this was set intentionally.

This stackoverflow article sheds some light on the matter but it seems to imply that the cleanest way is not to use it.

For reference, here is the output of my make invokation:

rm -vf *.o
removed `xcwd.o'
gcc -c xcwd.c -Wall -Werror -Wextra -std=gnu99 -O2 -DLINUX
xcwd.c: In function ‘getProcesses’:
xcwd.c:176:14: error: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Werror=unused-result]
cc1: all warnings being treated as errors
make: *** [xcwd.o] Error 1

Errors on 32bit Arch Netbook

I get the following errors when trying to 'make' on my 32bit netbook running arch. For what it's worth, compilation happened without any error on my 64bit desktop. The processor architecture is the only difference I can think of between the two machines that might cause this, they both run arch and are both fully up to date.

$ make
rm -vf .o
gcc -c xcwd.c -Wall -Werror -Wextra -pedantic -std=gnu99 -O2
xcwd.c: In function ‘windowStrings’:
xcwd.c:114:17: error: passing argument 10 of ‘XGetWindowProperty’ from incompatible pointer type [-Werror]
&type, &format, size, &after, &data) == Success) {
^
In file included from xcwd.c:14:0:
/usr/include/X11/Xlib.h:2684:12: note: expected ‘long unsigned int *’ but argument is of type ‘size_t *’
extern int XGetWindowProperty(
^
xcwd.c: In function ‘getProcesses’:
xcwd.c:150:5: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘size_t’ [-Werror=format=]
LOG("Found %ld processes\n", globbuf.gl_pathc);
^
cc1: all warnings being treated as errors
make: *
* [xcwd.o] Error 1

Issue with terminals running as separate processes.

Hello,

I found my problem already addressed in README. But still I would request for an explanation of the issue.

I am using konsole as my terminal emulator. I have unset this option to "Run all Konsole windows in a single process". And it is verified as I get multiple PID with pgrep konsole when multiple windows are open.

image

My issue is that when I do a readlink /proc/$PID/cwd, it always gives path to $HOME directory. So why doesn't it get updated there?
To get PID:

xdotool getwindowpid "$(xdotool getactivewindow)"

Another question which you might be able to answer is in a single instance of urxvt, pgrep urxvt gives 2 PIDs (another question, why?), and the actual cwd is stored in /proc/"$(($FIRSTPID+2))"/cwd!

image

This is not an "issue" but some queries which are related to this project. I didn't find appropriate support for these queries till date and stumbled upon this project so thought this might be a good place to ask!

Copy environment variables as well

Hi, thanks for awesome project!

Feature request:

It would be nice to have an option for inherit all environment variables from the target window as well.

Use case:

You can set some variables like KUBECONFIG, GOOGLE_APPLICATION_CREDENTIALS, AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY per session and use xcwd to copy them to new window.

Thanks

Hey

This scratches a big itch in i3, thanks so much for writing it!

🍻

MakeFile issue

Trying to compile form here (ubuntu 12.10), I got this error:

$ gcc -Wall -Werror -std=gnu89 -lX11 xcwd.c -o xcwd
/tmp/cc4jSMfF.o: In function `focusedWindow':
xcwd.c:(.text+0x61): undefined reference to `XOpenDisplay'
xcwd.c:(.text+0x98): undefined reference to `XGetInputFocus'
/tmp/cc4jSMfF.o: In function `windowPid':
xcwd.c:(.text+0xc3): undefined reference to `XInternAtom'
xcwd.c:(.text+0xe0): undefined reference to `XInternAtom'
xcwd.c:(.text+0x151): undefined reference to `XGetWindowProperty'
xcwd.c:(.text+0x175): undefined reference to `XFree'
/tmp/cc4jSMfF.o: In function `windowStrings':
xcwd.c:(.text+0x1aa): undefined reference to `XInternAtom'
xcwd.c:(.text+0x21b): undefined reference to `XGetWindowProperty'
xcwd.c:(.text+0x245): undefined reference to `XInternAtom'
xcwd.c:(.text+0x2aa): undefined reference to `XFree'
collect2: error: ld returned 1 exit status

I can compile however by issuing:

gcc xcwd.c -Wall -Werror -std=gnu89 -lX11 -o xcwd

Unfortunately, it does not work for gnome-terminal :-(

Also in urxvt, I found that there is a weird extra character in the output (happens to me at least).

Working directory can not be retrieved from single-process terminal emulator

I ran into this issue switching from urxvt to lilyterm. Lilyterm by default launches all its terminals as one process (and I guess so do a couple of other emulators). xcwd outputs the working directory of the "first" window typically, which is in general not what you want.

It makes sense that xcwd does not work in this context, however, I think it would probably be worth mentioning (in the readme) that you should configure your emulator to launch separate processes for each shell.

I suppose fixing this issue would require a lot of emulator-specific work and thus is not really an option, is it?

Not working with zshell

If I'm using zshell with gnome-terminal, it only returns my home directory. I placed the following in my ~/.i3/config:

bindsym $mod+g exec gnome-terminal --working-directory=`xcwd`

However it will only work if I'm running bash in gnome-terminal.
If it helps, my dotfiles are located here:
http://github.com/aarobc/dotfiles

Debian packaging

Hi!

xcwd is a great tool. I would like to package it for debian. However there are some things that I would need you to change before I can package it into debian:

["please" implied for all of the following]

  • create git tags and releases
  • sign your releases using gpg (described here: LibVNC/libvncserver#65)
  • add a changelog
  • clearly state the license under which you release this software (preferably GPL-3)
  • add a manpage (I can help you with that)
  • accept patches to the makfile I will provide.

Even if you make all these changes, I cannot promise you that it will end up in debian soon, but I will do my best to get an upload.

Please let me know what you think of this... and again, great project 👍

DOes not work with fish

Hello,
I use fish. I start fish by putting this code at the bottom of .bashrc (I also tried to set fish as the default shell to check if it works with xcwd)

if [[ $(ps --no-header --pid=$PPID --format=cmd) != "fish" ]]
then
	exec fish
fi

I use I3 and I tried every command possible in the .config after the bindsym $mod+o exec : sh -c 'termite -d "$(xcwd)"' I tried exec "termite -d $(xcwd)"
It works with bash.
I can open a new terminal in the same folder if when I'm into a terminal using fish I execute "bash --norc" to start bash and then I do the $mod+o (or whatever bind I created) then it works even when the new terminal opened uses fish as a shell. I noticed it also works if vim is opened inside fish.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.