Created
September 23, 2024 22:07
-
-
Save Lillecarl/a0c0f937746e319c3999073a3d0c3aa8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 8408190844005f078d59ff39158e4107e1be2d98 Mon Sep 17 00:00:00 2001 | |
From: Carl Hjerpe <[email protected]> | |
Date: Tue, 24 Sep 2024 00:05:34 +0200 | |
Subject: [PATCH 1/2] fish/login/niri: Rework niri initialisation | |
Create niri-session systemd unit that binds to graphical-session.target | |
that Mr. Poettering has some special fetish for. Start | |
graphical-session.target with niri, stop it with fish once niri exists. | |
Instead of execing into sh we unset SHLVL with env before launching | |
niri that in turn will launch all fish instances (through kitty). | |
--- | |
.../.config/fish/final/90-start_niri.fish | 4 +++- | |
users/lillecarl/gui/niri.nix | 15 ++++++++++++++- | |
2 files changed, 17 insertions(+), 2 deletions(-) | |
diff --git a/users/lillecarl/dotfiles/.config/fish/final/90-start_niri.fish b/users/lillecarl/dotfiles/.config/fish/final/90-start_niri.fish | |
index ae883af..51cfd9c 100644 | |
--- a/users/lillecarl/dotfiles/.config/fish/final/90-start_niri.fish | |
+++ b/users/lillecarl/dotfiles/.config/fish/final/90-start_niri.fish | |
@@ -4,5 +4,7 @@ if status --is-login && test "$XDG_VTNR" = 1 | |
set -e __HM_SESS_VARS_SOURCED | |
set -e __NIXOS_SET_ENVIRONMENT_DONE | |
- exec sh -c "SHLVL=0 niri --session > $NIRI_LOGFILE" | |
+ env --unset=SHLVL niri --session >$NIRI_LOGFILE | |
+ systemctl --user stop niri-session.target | |
+ exec echo "niri session exited, goodbye" | |
end | |
diff --git a/users/lillecarl/gui/niri.nix b/users/lillecarl/gui/niri.nix | |
index 36e2edf..662318e 100644 | |
--- a/users/lillecarl/gui/niri.nix | |
+++ b/users/lillecarl/gui/niri.nix | |
@@ -15,7 +15,7 @@ | |
settings = { | |
spawn-at-startup = [ | |
- { command = [ "systemctl" "--user" "restart" "graphical-session.target" ]; } | |
+ { command = [ "systemctl" "--user" "restart" "niri-session.target" ]; } | |
]; | |
input = { | |
warp-mouse-to-focus = true; | |
@@ -248,4 +248,17 @@ | |
}; | |
}; | |
}; | |
+ | |
+ systemd.user.targets = { | |
+ niri-session = { | |
+ Unit = { | |
+ Description = "Target reached when Wayland compositor is running"; | |
+ | |
+ BindsTo = [ "graphical-session.target" ]; | |
+ Before = [ "graphical-session.target" "xdg-desktop-autostart.target" ]; | |
+ Wants = [ "graphical-session-pre.target" "xdg-desktop-autostart.target" ]; | |
+ After = [ "graphical-session-pre.target" ]; | |
+ }; | |
+ }; | |
+ }; | |
} | |
-- | |
2.46.0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment