Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4061,7 +4061,7 @@ def run_box(args: Args, config: Config) -> None:
cmdline = [*args.cmdline]

if sys.stdin.isatty() and sys.stdout.isatty():
cmdline = systemd_pty_forward(config, "48;2;12;51;51", "mkosi-sandbox") + cmdline
cmdline = systemd_pty_forward(config, background="48;2;12;51;51", title="mkosi-sandbox") + cmdline

with contextlib.ExitStack() as stack:
if config.tools() != Path("/"):
Expand Down
15 changes: 10 additions & 5 deletions mkosi/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6038,7 +6038,12 @@ def systemd_tool_version(*tool: PathString, sandbox: SandboxProtocol = nosandbox
return version


def systemd_pty_forward(config: Config, background: str, title: str) -> list[str]:
def systemd_pty_forward(
config: Config,
*,
background: Optional[str] = None,
title: Optional[str] = None,
) -> list[str]:
tint_bg = parse_boolean(config.environment.get("SYSTEMD_TINT_BACKGROUND", "1")) and parse_boolean(
os.environ.get("SYSTEMD_TINT_BACKGROUND", "1")
)
Expand All @@ -6052,8 +6057,8 @@ def systemd_pty_forward(config: Config, background: str, title: str) -> list[str
return []

cmd = ["systemd-pty-forward"]
if tint_bg:
cmd += [f"--background={background}"]
if adjust_title:
cmd += ["--title=", title]
if tint_bg and background:
cmd += ["--background", background]
if adjust_title and title:
cmd += ["--title", title]
return cmd
4 changes: 3 additions & 1 deletion mkosi/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,9 @@ def run_qemu(args: Args, config: Config) -> None:

if config.console in (ConsoleMode.interactive, ConsoleMode.read_only):
cmdline += systemd_pty_forward(
config, "48;2;12;51;19", f"Virtual Machine {config.machine_or_name()}"
config,
background="48;2;12;51;19",
title=f"Virtual Machine {config.machine_or_name()}",
)

if config.console == ConsoleMode.read_only:
Expand Down
Loading