How can I make the hostname show in the title of an X11 window?
In Linux environments, ssh -Y foohost; ...; bar-gui
will open an xwindow for the program with the title "bar-gui (on foohost)". That is, the hostname is automatically appended to the X11 window title when it is running on a remote system. I am running programs on multiple remote systems and I need to tell them apart.
Example: Note the hostname in the title of the window on the right.
I would like to have the same behavior from a mac client.
(I am not looking to change the terminal title.)
Workaround: xdotool
can be used to manually change the title of an x window.
ssh -Y foohost
...
bar-gui &
pid="$!"
# Wait for bar-gui to actually load
win=$(xdotool search --pid "$pid")
xdotool set_window --name "bar-gui (on foohost)" "$win"
This workaround is not ideal so I'm not making it an answer. It needs xdotool installed to work. This would not work great as a bash script or function. There are possibly better ways to use xdotool, but this was the first thing I got working.
Note: Doing ... --name "bar-gui (on foohost)" ...
from a linux desktop would cause the title to appear as "bar-gui (on foohost) (on foohost)" because it still appends the hostname automatically.
I am still looking for the mac desktop to automatically include the hostname of remote x11 applications in the window title.