schischi/xcwd

MakeFile issue

Closed this issue · 5 comments

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).

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

I have some trouble getting the properties of gtk window (firefox, gnome-terminal, …)
I don't really know why, but I will check the xprop code since there is no problem with it.

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

Strange, I do not have any problem with the output

With a little tweak in gnome-terminal, I get to send the current directory to the title of the window, but xcwd does not look for it in any of the available properties... see my xprop:

_NET_STARTUP_ID(UTF8_STRING) = "i3/x-terminal-emulator/5695-2-mac17_TIME5828468"
WM_WINDOW_ROLE(STRING) = "gnome-terminal-window-4328-1987192084-1366899150"
_NET_WM_SYNC_REQUEST_COUNTER(CARDINAL) = 60828801
_NET_WM_WINDOW_TYPE(ATOM) = _NET_WM_WINDOW_TYPE_NORMAL
_NET_WM_USER_TIME(CARDINAL) = 5883116
_NET_WM_USER_TIME_WINDOW(WINDOW): window id # 0x3a02c80
WM_CLIENT_LEADER(WINDOW): window id # 0x3a00001
_NET_WM_PID(CARDINAL) = 4328
WM_LOCALE_NAME(STRING) = "en_AU.UTF-8"
WM_CLIENT_MACHINE(STRING) = "mac17"
WM_NORMAL_HINTS(WM_SIZE_HINTS):
        program specified minimum size: 38 by 20
        program specified resize increment: 9 by 18
        program specified base size: 2 by 2
        window gravity: NorthWest
WM_PROTOCOLS(ATOM): protocols  WM_DELETE_WINDOW, WM_TAKE_FOCUS, _NET_WM_PING, _NET_WM_SYNC_REQUEST
WM_CLASS(STRING) = "gnome-terminal", "Gnome-terminal"
WM_ICON_NAME(STRING) = "/tmp/xcwd"
_NET_WM_ICON_NAME(UTF8_STRING) = "/tmp/xcwd"
WM_NAME(STRING) = "/tmp/xcwd"
_NET_WM_NAME(UTF8_STRING) = "/tmp/xcwd"

Can you add _NET_WM_NAME?


For the record, to make this in gnome-terminal, you need to:

  1. Right click > Profiles > Profile Preferences (choose your current) > Title and Command
    and change the "when terminal commands set their own titles: " to "replace initial title"

  2. set PROMPT_COMMAND in .bashrc as:

PROMPT_COMMAND='echo -ne "\033]0;${PWD}\007"'

Even if I add _NET_WM_NAME, the problem remain the same, xcwd can not read any properties of a gtk window. XGetWindowProperty always return NULL. Moreover since gnome-terminal set _NET_WM_PID(CARDINAL), it's not necessary to read _NET_WM_NAME.

Got it! Thanks.

The last commit should fix it.
But since I do not manage to run gnome-terminal I can't test it.