about summary refs log tree commit diff
path: root/home
diff options
context:
space:
mode:
Diffstat (limited to 'home')
-rw-r--r--home/shell/zsh/default.nix8
-rw-r--r--home/shell/zsh/ssh-agent.zsh3
-rw-r--r--home/shell/zsh/sway.zsh3
-rw-r--r--home/wm/sway/default.nix20
4 files changed, 20 insertions, 14 deletions
diff --git a/home/shell/zsh/default.nix b/home/shell/zsh/default.nix
index 6bf11ab..3734fc3 100644
--- a/home/shell/zsh/default.nix
+++ b/home/shell/zsh/default.nix
@@ -36,15 +36,7 @@ in
 
       defaultKeymap = "emacs";
 
-      # 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 [
-        ./ssh-agent.zsh
-        ./sway.zsh
         ./completion-style.zsh
         ./options.zsh
         ./prompt.zsh
diff --git a/home/shell/zsh/ssh-agent.zsh b/home/shell/zsh/ssh-agent.zsh
deleted file mode 100644
index 1e5d81c..0000000
--- a/home/shell/zsh/ssh-agent.zsh
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then
-  eval $(ssh-agent -s -a ${XDG_RUNTIME_DIR}/ssh-agent.sock) > /dev/null
-fi
diff --git a/home/shell/zsh/sway.zsh b/home/shell/zsh/sway.zsh
deleted file mode 100644
index 69d5103..0000000
--- a/home/shell/zsh/sway.zsh
+++ /dev/null
@@ -1,3 +0,0 @@
-if [ -z $DISPLAY ] && [ "$(tty)" = "/dev/tty1" ]; then
-    exec sway
-fi
diff --git a/home/wm/sway/default.nix b/home/wm/sway/default.nix
index 0ea5d8a..7ee6791 100644
--- a/home/wm/sway/default.nix
+++ b/home/wm/sway/default.nix
@@ -25,6 +25,26 @@ in
       XDG_SESSION_TYPE = "wayland";
     };
 
+    programs = {
+      zsh.loginExtra = ''
+        if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then
+          eval $(ssh-agent -s) > /dev/null
+        fi
+        if [ "$(tty)" = "/dev/tty1" ]; then
+          exec sway &> /dev/null
+        fi
+      '';
+
+      zsh.profileExtra = ''
+        if [ $(ps ax | grep "[s]sh-agent" | wc -l) -eq 0 ] ; then
+          eval $(ssh-agent -s) > /dev/null
+        fi
+        if [ "$(tty)" = "/dev/tty1" ]; then
+          exec sway &> /dev/null
+        fi
+      '';
+    };
+
     wayland.windowManager.sway = {
       enable = true;
       # in order to import some variables (e.g. PATH) so that all the