This goes together with the existing SYSTEMD_TINT_BACKGROUND.
Closes https://github.com/systemd/systemd/issues/33301
no effect if the background color is explicitly selected via the relevant
`--background=` switch of the tool.
+* `$SYSTEMD_ADJUST_TERMINAL_TITLE` – Takes a boolean. When false the terminal
+ window title will not be updated for interactive invocation of the mentioned
+ tools.
+
`systemd-hostnamed`, `systemd-importd`, `systemd-localed`, `systemd-machined`,
`systemd-portabled`, `systemd-timedated`:
if (!isempty(arg_background))
(void) pty_forward_set_background_color(c.forward, arg_background);
- set_window_title(c.forward);
+ if (shall_set_terminal_title())
+ set_window_title(c.forward);
}
path = unit_dbus_path_from_name(service);
#include "sd-event.h"
#include "alloc-util.h"
+#include "env-util.h"
#include "errno-util.h"
#include "extract-word.h"
#include "fd-util.h"
return insert_string(f, offset, s);
}
+bool shall_set_terminal_title(void) {
+ static int cache = -1;
+
+ if (cache >= 0)
+ return cache;
+
+ cache = getenv_bool("SYSTEMD_ADJUST_TERMINAL_TITLE");
+ if (cache == -ENXIO)
+ return (cache = true);
+ if (cache < 0)
+ log_debug_errno(cache, "Failed to parse $SYSTEMD_ADJUST_TERMINAL_TITLE, leaving terminal title setting enabled: %m");
+
+ return cache != 0;
+}
+
static int insert_window_title_fix(PTYForward *f, size_t offset) {
assert(f);
int pty_forward_set_title_prefix(PTYForward *f, const char *prefix);
+bool shall_set_terminal_title(void);
+
DEFINE_TRIVIAL_CLEANUP_FUNC(PTYForward*, pty_forward_free);