about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--home/zsh/default.nix13
-rw-r--r--home/zsh/sway.zsh3
2 files changed, 10 insertions, 6 deletions
diff --git a/home/zsh/default.nix b/home/zsh/default.nix
index fad7b2e..086c17e 100644
--- a/home/zsh/default.nix
+++ b/home/zsh/default.nix
@@ -38,13 +38,14 @@ in {
 
       defaultKeymap = "emacs";
 
-      initExtraFirst = ''
-        if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
-          exec sway
-        fi
-      '';
-
+      # the order matters for sway.zsh: I want to load it first
+      # to start the session if I log on a machine where it's
+      # available.
+      # it can't be loaded with `initExtraFirst` because the session
+      # variables from home-manager are not set yet otherwise (and I
+      # need them for things like firefox or emacs).
       initExtra = lib.concatMapStrings builtins.readFile [
+        ./sway.zsh
         ./completion-style.zsh
         ./gerrit.zsh
         ./options.zsh
diff --git a/home/zsh/sway.zsh b/home/zsh/sway.zsh
new file mode 100644
index 0000000..69d5103
--- /dev/null
+++ b/home/zsh/sway.zsh
@@ -0,0 +1,3 @@
+if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
+    exec sway
+fi