about summary refs log tree commit diff
path: root/home/wm
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2023-03-31 16:55:42 -0700
committerFranck Cuny <franck@fcuny.net>2023-03-31 16:55:42 -0700
commitab0ef5c987b7f179725032d920ac75b66aa194e1 (patch)
treedacf7b6c1d4a06728e3e7a4cbbc8bea68f2bf131 /home/wm
parentmodules/sendsms: gate the unit with a file (diff)
downloadworld-ab0ef5c987b7f179725032d920ac75b66aa194e1.tar.gz
home/sway: start sway and ssh-agent properly
I only need to run sway and the ssh-agent on a workstation (desktop or
laptop). Start these two processes when the window manager starts.
Diffstat (limited to '')
-rw-r--r--home/wm/sway/default.nix20
1 files changed, 20 insertions, 0 deletions
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