about summary refs log tree commit diff
path: root/home/fish/default.nix
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-04-13 10:48:01 -0700
committerFranck Cuny <franck@fcuny.net>2022-04-13 10:48:01 -0700
commit5090c4231bc73235c34806261631e6b863b88b26 (patch)
treeecf1c38bd75fa47901f7830c4b002c9e57bfbab9 /home/fish/default.nix
parentfish: execute sway on login on tty1 (diff)
downloadworld-5090c4231bc73235c34806261631e6b863b88b26.tar.gz
fish: only start sway when sway is installed
Diffstat (limited to '')
-rw-r--r--home/fish/default.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/home/fish/default.nix b/home/fish/default.nix
index bbaddce..5556ed2 100644
--- a/home/fish/default.nix
+++ b/home/fish/default.nix
@@ -1,5 +1,7 @@
 { config, lib, pkgs, ... }:
-let cfg = config.my.home.fish;
+let
+  cfg = config.my.home.fish;
+  swayEnabled = config.my.home.wm.windowManager == "sway";
 in {
   options.my.home.fish = with lib; {
     enable = mkEnableOption "fish configuration";
@@ -9,16 +11,16 @@ in {
     interactiveShellInit = ''
       set fish_greeting
 
-      # Execute sway on login on tty1
-      if [ -z $DISPLAY ] && [ "$(tty)" == "/dev/tty1" ]; then
-        exec sway
-      fi
-
       # Tmux on terminal start
       if status is-interactive
       and not set -q TMUX
           exec tmux
       end
     '';
+    loginShellInit = lib.mkIf swayEnabled ''
+      if test -z "$DISPLAY"; and test (tty) = "/dev/tty1"
+        exec sway
+      end
+    '';
   };
 }