ptyfwd: optionally prefix window title with colored dot

in uid0/systemd-run/nspawn we already set a window title with a colorful
unicode dot indicating the changed privileges/execution context. This typically
gets overriden by the shell inside the environment however.

Let's tweak this a bit: when we see the window title OSC ANSI sequence
passing through, let's patch in the unicode dot as a prefix to the
title.

This is super pretty, since it makes sure root sessions via 0ad are
really easily recognizable as such, because the window title carries an
🔴 red dot as prefix then.
This commit is contained in:
Lennart Poettering
2024-02-23 21:15:25 +00:00
committed by Luca Boccassi
parent 461c85838e
commit d4ece77f5e
4 changed files with 74 additions and 3 deletions
+3
View File
@@ -4443,6 +4443,9 @@ static void set_window_title(PTYForward *f) {
(void) pty_forward_set_titlef(f, "%sContainer %s on %s", strempty(dot), arg_machine, hn);
else
(void) pty_forward_set_titlef(f, "%sContainer %s", strempty(dot), arg_machine);
if (dot)
(void) pty_forward_set_title_prefix(f, dot);
}
static int merge_settings(Settings *settings, const char *path) {