summaryrefslogtreecommitdiffstats
path: root/src/shared/ptyfwd.c
diff options
context:
space:
mode:
authorMantas Mikulėnas <grawity@gmail.com>2024-06-17 11:41:56 +0200
committerMantas Mikulėnas <grawity@gmail.com>2024-06-25 09:39:15 +0200
commit27a2513013d3b3c6140de47e04b3042c5b4487e5 (patch)
tree3a536692273215774739c37f8f289ac4f9967e20 /src/shared/ptyfwd.c
parentMerge pull request #33407 from poettering/varlink-idl-comment-fix (diff)
downloadsystemd-27a2513013d3b3c6140de47e04b3042c5b4487e5.tar.xz
systemd-27a2513013d3b3c6140de47e04b3042c5b4487e5.zip
run: add environment variable to prevent the setting of terminal title
This goes together with the existing SYSTEMD_TINT_BACKGROUND. Closes https://github.com/systemd/systemd/issues/33301
Diffstat (limited to 'src/shared/ptyfwd.c')
-rw-r--r--src/shared/ptyfwd.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/shared/ptyfwd.c b/src/shared/ptyfwd.c
index 998ce96b54..842aef9270 100644
--- a/src/shared/ptyfwd.c
+++ b/src/shared/ptyfwd.c
@@ -17,6 +17,7 @@
#include "sd-event.h"
#include "alloc-util.h"
+#include "env-util.h"
#include "errno-util.h"
#include "extract-word.h"
#include "fd-util.h"
@@ -367,6 +368,21 @@ static int insert_background_fix(PTYForward *f, size_t offset) {
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);