From ab0ef5c987b7f179725032d920ac75b66aa194e1 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Fri, 31 Mar 2023 16:55:42 -0700 Subject: 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. --- home/wm/sway/default.nix | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'home/wm') 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 -- cgit 1.4.1