1

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.

ChromaCat248
  • 13
  • 1
  • 4
  • 1
    (Disclaimer: It's a long time ago that I was daily programming with X11 and OSF/Motif.) I was under the impression that something like a title bar is subject of the Window Manager (instead of X11). Hence, I wouldn't expect an X11 event. Maybe, this is considered in the [ICCCM](https://en.wikipedia.org/wiki/Inter-Client_Communication_Conventions_Manual). Maybe, try your luck in the [Inter-Client Communication Conventions Manual](https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html) but looking for `title`, I got only 2 hits in that doc. and they didn't look that promising... – Scheff's Cat Jun 11 '21 at 07:03

1 Answers1

1

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.

Andrey Sidorov
  • 24,905
  • 4
  • 62
  • 75