ctucx.git: nixfiles

ctucx' nixfiles

commit 779b38a85ff9f2b43616a1927483196bad2ceb30
parent cee5a917689670d8bcf8cffa4891c103cd7dcefe
Author: Leah (ctucx) <leah@ctu.cx>
Date: Tue, 12 Oct 2021 20:08:50 +0200

programs/sway: modular autostart and default terminal
4 files changed, 16 insertions(+), 8 deletions(-)
diff --git a/configurations/programs/alacritty.nix b/configurations/programs/alacritty.nix
@@ -50,5 +50,12 @@
         };
       };
     };
+
+    wayland.windowManager.sway = {
+      config.terminal = "${pkgs.alacritty}/bin/alacritty";
+      extraConfig     = ''
+        exec swaymsg 'workspace 3: Term; exec ${pkgs.alacritty}/bin/alacritty; exec ${pkgs.alacritty}/bin/alacritty; workspace 1: Web;'
+      '';
+    };
   };
 }
diff --git a/configurations/programs/firefox.nix b/configurations/programs/firefox.nix
@@ -19,5 +19,9 @@
         browsers = [ "firefox" ];
       };
     };
+
+    wayland.windowManager.sway.extraConfig = ''
+      exec firefox;
+    '';
   };
 }
diff --git a/configurations/programs/sway.nix b/configurations/programs/sway.nix
@@ -34,7 +34,6 @@
     wayland.windowManager.sway = let
       cfg         = config.home-manager.users.leah.wayland.windowManager.sway;
       modifier    = cfg.config.modifier;
-      terminal    = "${pkgs.alacritty}/bin/alacritty";
 
     in {
       enable              = true;

@@ -57,12 +56,6 @@
         # Import the most important environment variables into the D-Bus and systemd
         # user environments (e.g. required for screen sharing and Pinentry prompts):
         exec dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
-
-        exec firefox
-
-        exec swaymsg 'workspace 3: Term; exec ${terminal}; exec ${terminal};'
-        exec swaymsg 'workspace 6: Files; exec thunar;'
-        exec swaymsg 'workspace 1: Web;'
       '';
 
       config = {

@@ -111,7 +104,7 @@
         keybindings = {
           "${modifier}+Delete"        = "exec true";
 
-          "${modifier}+Return"        = "exec ${terminal}";
+          "${modifier}+Return"        = "exec ${cfg.config.terminal}";
           "${modifier}+Space"         = "exec ${pkgs.wofi}/bin/wofi --style ${./wofi/style.css} --conf ${./wofi/config} --show drun";
           "${modifier}+l"             = "exec ${pkgs.systemd}/bin/loginctl lock-session";
 
diff --git a/configurations/programs/thunar.nix b/configurations/programs/thunar.nix
@@ -13,5 +13,9 @@
     home.packages = with pkgs; [
       xfce.thunar
     ];
+
+    wayland.windowManager.sway.extraConfig = ''
+      exec swaymsg 'workspace 6: Files; exec thunar; workspace 1: Web;'
+    '';
   };
 }