Просмотр исходного кода

Host specific display stuff for sway

Johan Rong 2 месяцев назад
Родитель
Сommit
92051f00a1

+ 27 - 17
home/features/desktop/sway/default.nix

@@ -1,4 +1,4 @@
-{ pkgs, lib, ... }:
+{ config, pkgs, lib, ... }:
 
 {
   imports = [
@@ -15,22 +15,32 @@
     ./theming/breeze-dark.nix
   ];
 
-  xdg.userDirs = {
-    enable = true;
-    createDirectories = true;
-    
-    documents = "$HOME/Documents";
-    download = "$HOME/Downloads";
-    desktop = "$HOME/Desktop";
-    music = "$HOME/Music";
-    pictures = "$HOME/Pictures";
-    videos = "$HOME/Videos";
-    projects = "$HOME/Projects";
+  config = {
+    xdg.userDirs = {
+      enable = true;
+      createDirectories = true;
+      
+      documents = "$HOME/Documents";
+      download = "$HOME/Downloads";
+      desktop = "$HOME/Desktop";
+      music = "$HOME/Music";
+      pictures = "$HOME/Pictures";
+      videos = "$HOME/Videos";
+      projects = "$HOME/Projects";
+    };
+
+    home.packages = with pkgs; [
+      grim
+      slurp
+      swappy
+    ];
   };
 
-  home.packages = with pkgs; [
-    grim
-    slurp
-    swappy
-  ];
+  options.custom.swayExtras = {
+    displays = lib.mkOption {
+      type = lib.types.lines;
+      default = "";
+      description = "Host-specific display configuration for Sway";
+    };
+  };
 }

+ 4 - 17
home/features/desktop/sway/sway.nix

@@ -1,4 +1,4 @@
-{ pkgs, lib, ... }:
+{ config, pkgs, lib, ... }:
 
 let
   left = "j";
@@ -8,7 +8,7 @@ let
   mod = "Mod1";
   super = "Super";
 in
-{
+{ 
   wayland.windowManager.sway = {
     enable = true;
     checkConfig = true;
@@ -229,20 +229,6 @@ in
       };
     };
     extraConfig = ''
-      output DP-2 pos 0 0 mode 1920x1080@143.981Hz
-      output HDMI-A-1 mode 1920x1080@143.981Hz
-
-      output * adaptive_sync off
-
-      workspace 1 output DP-2
-      workspace 2 output DP-2
-      workspace 3 output DP-2
-
-      workspace 11 output HDMI-A-1
-      workspace 12 output HDMI-A-1
-      workspace 13 output HDMI-A-1
-      workspace 14 output HDMI-A-1
-
       exec wl-paste --watch cliphist store
 
       seat seat0 xcursor_theme Notwaita-Black 20
@@ -265,6 +251,7 @@ in
           timeout 1200 'systemctl suspend' \
           before-sleep 'swaylock -f'
       }
-    '';
+    ''
+    + config.custom.swayExtras.displays;
   };
 }

+ 9 - 1
hosts/dellaptop/home.nix

@@ -1,4 +1,4 @@
-{ config, pkgs, ... }:
+{ config, pkgs, lib, ... }:
 let
   users = import ../../config/users.nix;
 in
@@ -17,4 +17,12 @@ in
     stateVersion = "26.05";
   };
 
+  custom.swayExtras = {
+    displays = ''
+      output eDP-1 pos 0 0 mode 1920x1080@59.999Hz
+      output * pos 1920 0 adaptive_sync off
+
+      workspace 1 output eDP-1
+    '';
+  };
 }

+ 17 - 0
hosts/nixstation/home.nix

@@ -17,4 +17,21 @@ in
     stateVersion = "26.05";
   };
 
+  custom.swayExtras = {
+    displays = ''
+      output DP-2 pos 0 0 mode 1920x1080@143.981Hz
+      output HDMI-A-1 mode 1920x1080@143.981Hz
+
+      output * adaptive_sync off
+
+      workspace 1 output DP-2
+      workspace 2 output DP-2
+      workspace 3 output DP-2
+
+      workspace 11 output HDMI-A-1
+      workspace 12 output HDMI-A-1
+      workspace 13 output HDMI-A-1
+      workspace 14 output HDMI-A-1
+    '';
+  };
 }