terminal-emulator with dynamic title from byobu/tmux session name

0

At startup I use a little script that creates a number of byobu-sessions i.e. 'LOCAL','SSH','SSH2','INTERNAL','GUAKE','DEV'

I use a windows tiling manager (awesome wm) and most of the time I keep a terminal-emulator with a specific byobu-session on their designated desktop/tag.

At the moment I'm using xfce4-terminal-emulator, which has an option to use a dynamic title. However, none of the solutions I've found seem to work in combination with byobu/tmux.
If I'm trying to find a terminal window in my window list, they all appear as user@hostname(ip address)-byobu

So, I would like to use a workflow where I can either set the window title from the terminal-emulator or it gets set when opening (or switching to) a byobu-session

oneindelijk

Posted 2019-10-03T08:46:07.730

Reputation: 207

Answers

1

The terminal does not need any special "dynamic title" support – it literally just shows whatever text Byobu (or another application) is telling it to show. In this case, byobu always provides the same static text on startup. ($BYOBU_NO_TITLE would disable it entirely.)

More usefully, you can make tmux provide its own title (overriding the static one from Byobu) through a custom ~/.config/byobu/.tmux.conf:

set -g set-titles on
set -g set-titles-string "#(whoami)@#H - byobu (#S)"
set -g set-titles on
set -g set-titles-string "#T (#h.#S.#I)"

The full syntax can be found in the tmux(1) manual page under "FORMATS" – in these examples, #S is the session name, #W and #I are the current window name & index, and so on.

Various programs running inside tmux/byobu will often provide their own terminal titles, so it's useful to include #T as well.

user1686

Posted 2019-10-03T08:46:07.730

Reputation: 283 655

I noticed that all terminal-emulator sessions are sharing the title, a custom title per window could not be set. I ran this in one terminal and noticed in the windowlist that all my emulator had renamed their title to the tmux session name, exactly what I needed !! – oneindelijk – 2019-10-09T14:03:35.150