summaryrefslogtreecommitdiffstats
path: root/src/shared/ptyfwd.c
diff options
context:
space:
mode:
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 998ce96..842aef9 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);