From 8bf3891e8e322f16f55665a99af26ec9a843657d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sat, 20 Jan 2024 00:00:20 +0100 Subject: [PATCH] nspawn: tint the terminal bg blue if we are in a container Let's give people a hint that they are not operating on the host. --- src/nspawn/nspawn.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index 5820be8d136..50bb0565cab 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -5355,7 +5355,15 @@ static int run_container( arg_console_width, arg_console_height); - if (!isempty(arg_background)) + if (!arg_background) { + _cleanup_free_ char *bg = NULL; + + r = terminal_tint_color(220 /* blue */, &bg); + if (r < 0) + log_debug_errno(r, "Failed to determine terminal background color, not tinting."); + else + (void) pty_forward_set_background_color(forward, bg); + } else if (!isempty(arg_background)) (void) pty_forward_set_background_color(forward, arg_background); break; -- 2.47.3