diff options
author | Franck Cuny <franck@fcuny.net> | 2023-03-31 16:55:42 -0700 |
---|---|---|
committer | Franck Cuny <franck@fcuny.net> | 2023-03-31 16:55:42 -0700 |
commit | ab0ef5c987b7f179725032d920ac75b66aa194e1 (patch) | |
tree | dacf7b6c1d4a06728e3e7a4cbbc8bea68f2bf131 /home | |
parent | modules/sendsms: gate the unit with a file (diff) | |
download | world-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 'home')
-rw-r--r-- | home/shell/zsh/default.nix | 8 | ||||
-rw-r--r-- | home/shell/zsh/ssh-agent.zsh | 3 | ||||
-rw-r--r-- | home/shell/zsh/sway.zsh | 3 | ||||
-rw-r--r-- | home/wm/sway/default.nix | 20 |
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 |