Search code examples
c++xlibwindow-managers

Is there an event mask I can set in Xlib to receive an event whenever a window title is changes


I'm writing a window manager in C++ (mostly c stuff but i need unordered_map) with Xlib and my current approach to updating window titles is to get window titles whenever it receives any unrelated event. The problem with this is that if I open XTerm, for example, the titlebar says "xterm" until I do something that sends an event (like clicking the titlebar) and then the window title changes to "username@hostname:WD". It's supposed to update to that format after showing "xterm" for only a split second. It's also supposed to change every time you use the cd command.

Is there an event mask I can use to do this? I looked in a list of Xlib event masks and couldn't find an event mask that does this.


Solution

  • The client should set _NET_WM_NAME application window property. If you want to get events when application updates this property you can set PropertyChangeMask on the application window. Mask value is 0x400000.