From bfe9645bc2893e99c9483c503409bbd8680a060d Mon Sep 17 00:00:00 2001 From: Gerg-L Date: Sat, 31 May 2025 12:56:33 -0400 Subject: [PATCH] feat: zellij use systemd-run --- nixosModules/zellij/default.nix | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/nixosModules/zellij/default.nix b/nixosModules/zellij/default.nix index 8c10624..8983709 100644 --- a/nixosModules/zellij/default.nix +++ b/nixosModules/zellij/default.nix @@ -24,12 +24,20 @@ }; in '' + + run_zellij () { + if ! systemctl is-active --quiet --user "zellij$2.scope"; then + systemd-run --scope --unit="zellij$2" --user zellij attach -b "$1" + fi + zellij attach "$1" + } + if [[ -z "$ZELLIJ" ]]; then if [[ -n "$SSH_TTY" ]]; then - zellij attach -c "SSH@$USER" + run_zellij "$SSH@$USER" "" else MONITOR="$(${monitorScript} || true)" - zellij attach -c "''${MONITOR:+"$MONITOR@"}$USER" + run_zellij "''${MONITOR:+"$MONITOR@"}$USER" "-''${MONITOR:+"$MONITOR"}" fi fi '';