]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: tint the terminal bg blue if we are in a container 31026/head
authorLennart Poettering <lennart@poettering.net>
Fri, 19 Jan 2024 23:00:20 +0000 (00:00 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 23 Jan 2024 15:45:37 +0000 (16:45 +0100)
Let's give people a hint that they are not operating on the host.

src/nspawn/nspawn.c

index 5820be8d136eb1425af0b3a6cdd4d2d5d7323acf..50bb0565cab0cc40a54514968f7943e489a261f5 100644 (file)
@@ -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;