about summary refs log tree commit diff
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-06-09 11:39:41 -0700
committerFranck Cuny <franck@fcuny.net>2022-06-09 11:40:51 -0700
commit59ac7de79ca21c495d7388f80412f8bfd6e892e3 (patch)
treeb13425b2401f114f865bb80afe957851fa1fafb7
parentref(git): remove git.fcuny.net from configuration (diff)
downloadworld-59ac7de79ca21c495d7388f80412f8bfd6e892e3.tar.gz
ref(zsh): ensure home-manager variables are set before starting sway
Change-Id: I820a636bcdeb6abf7ff8a25ec409c08916e94c42
Reviewed-on: https://cl.fcuny.net/c/world/+/303
Reviewed-by: Franck Cuny <franck@fcuny.net>
-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