summaryrefslogtreecommitdiffstats
path: root/src/nspawn
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2024-02-12 17:47:09 +0100
committerGitHub <noreply@github.com>2024-02-12 17:47:09 +0100
commit27af7c2b4ca79ba908d3eea09111f3182ae05e63 (patch)
tree743e46b4d283e2a690374ffa173d5e64f2113fa2 /src/nspawn
parentMerge pull request #31233 from poettering/pcrlock-varlink (diff)
parentptyfwd: automatically turn off tinting/window title logic on dumb terminals (diff)
downloadsystemd-27af7c2b4ca79ba908d3eea09111f3182ae05e63.tar.xz
systemd-27af7c2b4ca79ba908d3eea09111f3182ae05e63.zip
Merge pull request #31162 from poettering/tint-tweaks
ptyfwd: some tweaks to terminal handling
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index e7dd2a370c..664637685b 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -4429,6 +4429,22 @@ static int setup_notify_parent(sd_event *event, int fd, pid_t *inner_child_pid,
return 0;
}
+static void set_window_title(PTYForward *f) {
+ _cleanup_free_ char *hn = NULL, *dot = NULL;
+
+ assert(f);
+
+ (void) gethostname_strict(&hn);
+
+ if (emoji_enabled())
+ dot = strjoin(special_glyph(SPECIAL_GLYPH_BLUE_CIRCLE), " ");
+
+ if (hn)
+ (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);
+}
+
static int merge_settings(Settings *settings, const char *path) {
int rl;
@@ -5361,6 +5377,7 @@ static int run_container(
} else if (!isempty(arg_background))
(void) pty_forward_set_background_color(forward, arg_background);
+ set_window_title(forward);
break;
default: