[GLYPH_COMPUTER_DISK] = "o",
[GLYPH_WORLD] = "W",
[GLYPH_RED_CIRCLE] = "o",
+ [GLYPH_ORANGE_CIRCLE] = "o",
[GLYPH_YELLOW_CIRCLE] = "o",
[GLYPH_BLUE_CIRCLE] = "o",
[GLYPH_GREEN_CIRCLE] = "o",
[GLYPH_SUPERHERO] = "S",
+ [GLYPH_PUMPKIN] = "P",
[GLYPH_IDCARD] = "@",
[GLYPH_HOME] = "^",
[GLYPH_ROCKET] = "^",
[GLYPH_COMPUTER_DISK] = UTF8("💽"),
[GLYPH_WORLD] = UTF8("🌍"),
[GLYPH_RED_CIRCLE] = UTF8("🔴"),
+ [GLYPH_ORANGE_CIRCLE] = UTF8("🟠"),
[GLYPH_YELLOW_CIRCLE] = UTF8("🟡"),
[GLYPH_BLUE_CIRCLE] = UTF8("🔵"),
[GLYPH_GREEN_CIRCLE] = UTF8("🟢"),
[GLYPH_SUPERHERO] = UTF8("🦸"),
+ [GLYPH_PUMPKIN] = UTF8("🎃"),
[GLYPH_IDCARD] = UTF8("🪪"),
[GLYPH_HOME] = UTF8("🏠"),
[GLYPH_ROCKET] = UTF8("🚀"),
if (arg_runtime_scope != RUNTIME_SCOPE_SYSTEM)
return false;
- return become_root() || arg_empower;
+ return become_root();
}
static int add_timer_property(const char *name, const char *val) {
return 1;
}
+static double shell_prompt_hue(void) {
+ if (privileged_execution())
+ return 0; /* red */
+
+ if (arg_empower)
+ return 30; /* orange */
+
+ return 60; /* yellow */
+}
+
+static Glyph shell_prompt_glyph(void) {
+ if (privileged_execution())
+ return GLYPH_SUPERHERO;
+
+ if (arg_empower)
+ return GLYPH_PUMPKIN;
+
+ return GLYPH_IDCARD;
+}
+
+static Glyph pty_window_glyph(void) {
+ if (privileged_execution())
+ return GLYPH_RED_CIRCLE;
+
+ if (arg_empower)
+ return GLYPH_ORANGE_CIRCLE;
+
+ return GLYPH_YELLOW_CIRCLE;
+}
+
static int parse_argv_sudo_mode(int argc, char *argv[]) {
enum {
return log_oom();
if (!arg_background && arg_stdio == ARG_STDIO_PTY) {
- double hue;
-
- if (privileged_execution())
- hue = 0; /* red */
- else
- hue = 60 /* yellow */;
-
- r = terminal_tint_color(hue, &arg_background);
+ r = terminal_tint_color(shell_prompt_hue(), &arg_background);
if (r < 0)
log_debug_errno(r, "Unable to get terminal background color, not tinting background: %m");
}
if (!arg_shell_prompt_prefix)
return log_oom();
} else if (emoji_enabled()) {
- arg_shell_prompt_prefix = strjoin(glyph(privileged_execution() ? GLYPH_SUPERHERO : GLYPH_IDCARD), " ");
+ arg_shell_prompt_prefix = strjoin(glyph(shell_prompt_glyph()), " ");
if (!arg_shell_prompt_prefix)
return log_oom();
}
* this for root though, under the assumption that if a regular user temporarily transitions into
* another regular user it's a better default that the full user environment is uniformly
* available. */
- if (arg_lightweight < 0 && privileged_execution())
+ if (arg_lightweight < 0 && (privileged_execution() || arg_empower))
arg_lightweight = true;
if (arg_lightweight >= 0) {
if (!isempty(arg_background))
(void) pty_forward_set_background_color(c->forward, arg_background);
- (void) pty_forward_set_window_title(c->forward,
- privileged_execution() ? GLYPH_RED_CIRCLE : GLYPH_YELLOW_CIRCLE,
- arg_host, arg_cmdline);
+ (void) pty_forward_set_window_title(c->forward, pty_window_glyph(), arg_host, arg_cmdline);
return 0;
}