From 6e3b5d3321bb0e93e7c2f900584ff35aaa06b1e1 Mon Sep 17 00:00:00 2001
From: nydragon <contact@ccnlc.eu>
Date: Sat, 22 Feb 2025 16:47:10 +0100
Subject: [PATCH] feat: adapt hyprland for laptop

---
 home/hyprland/default.nix | 121 ++++++++++++++++++++------------------
 hosts/brontes/default.nix |   5 +-
 hosts/marr/default.nix    |   1 -
 3 files changed, 68 insertions(+), 59 deletions(-)

diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix
index 4d64c1a..6c227ad 100644
--- a/home/hyprland/default.nix
+++ b/home/hyprland/default.nix
@@ -35,7 +35,7 @@ mkIf osConfig.programs.hyprland.enable {
 
       general = {
         gaps_in = 3;
-        gaps_out = 10;
+        gaps_out = 3;
 
         border_size = 2;
 
@@ -56,6 +56,7 @@ mkIf osConfig.programs.hyprland.enable {
         numlock_by_default = true;
         kb_options = "compose:caps";
         kb_layout = osConfig.console.keyMap;
+        natural_scroll = true;
       };
 
       decoration = {
@@ -131,6 +132,9 @@ mkIf osConfig.programs.hyprland.enable {
         preserve_split = true;
       };
 
+      gestures = {
+        workspace_swipe = true;
+      };
       # https://wiki.hyprland.org/Configuring/Variables/#misc
       misc = {
         force_default_wallpaper = 0;
@@ -141,64 +145,67 @@ mkIf osConfig.programs.hyprland.enable {
 
       bindm = [ "$mod,mouse:272,movewindow" ];
 
-      bind =
-        [
-          "$mod, D, exec, ${pkgs.fuzzel}/bin/fuzzel"
-          "$mod, E, exec, ${lib.my.getExe osConfig.modules.system.roles.desktop.filemanager}"
-          "$mod, Return, exec, ${lib.my.getExe osConfig.modules.system.roles.desktop.terminal}"
-          "$mod SHIFT, Q, killactive,"
-          "$mod, V, togglefloating"
-          "$mod SHIFT, P, exec, ${config.programs.rofi.package}/bin/rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu"
-          "$mod, P, exec, ${pkgs.cliphist}/bin/cliphist wipe & ${pkgs.hyprlock}/bin/hyprlock"
-          "$mod SHIFT, C, exec, hyprctl reload"
-          "$mod SHIFT, space, togglefloating"
-          "$mod, left, movefocus, l"
-          "$mod, right, movefocus, r"
-          "$mod, up, movefocus, u"
-          "$mod, down, movefocus, d"
+      bind = [
+        "$mod, D, exec, ${pkgs.fuzzel}/bin/fuzzel"
+        "$mod, E, exec, ${lib.my.getExe osConfig.modules.system.roles.desktop.filemanager}"
+        "$mod, Return, exec, ${lib.my.getExe osConfig.modules.system.roles.desktop.terminal}"
+        "$mod SHIFT, Q, killactive,"
+        "$mod, V, togglefloating"
+        "$mod SHIFT, P, exec, ${config.programs.rofi.package}/bin/rofi -show p -modi p:${pkgs.rofi-power-menu}/bin/rofi-power-menu"
+        "$mod, P, exec, ${pkgs.cliphist}/bin/cliphist wipe & ${pkgs.hyprlock}/bin/hyprlock"
+        "$mod SHIFT, C, exec, hyprctl reload"
+        "$mod SHIFT, space, togglefloating"
+        "$mod, left, movefocus, l"
+        "$mod, right, movefocus, r"
+        "$mod, up, movefocus, u"
+        "$mod, down, movefocus, d"
 
-          # Example special workspace (scratchpad)
-          "$mod, S, togglespecialworkspace, magic"
-          "$mod SHIFT, S, movetoworkspace, special:magic"
-          "$mod, X, fullscreen, 1"
-          "$mod, F, fullscreen, 0"
-          "$mod, N, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t"
-          "$mod, U, exec, ${pkgs.hyprshot}/bin/hyprshot -z -o $XDG_PICTURES_DIR/screenshots -m region"
-          "$mod SHIFT, U, exec, ${pkgs.hyprshot}/bin/hyprshot -z --raw -m region | ${pkgs.satty}/bin/satty -f - --fullscreen"
+        # Example special workspace (scratchpad)
+        "$mod, S, togglespecialworkspace, magic"
+        "$mod SHIFT, S, movetoworkspace, special:magic"
+        "$mod, X, fullscreen, 1"
+        "$mod, F, fullscreen, 0"
+        "$mod, N, exec, ${pkgs.swaynotificationcenter}/bin/swaync-client -t"
+        "$mod, U, exec, ${pkgs.hyprshot}/bin/hyprshot -z -o $XDG_PICTURES_DIR/screenshots -m region"
+        "$mod SHIFT, U, exec, ${pkgs.hyprshot}/bin/hyprshot -z --raw -m region | ${pkgs.satty}/bin/satty -f - --fullscreen"
 
-          #: Brightness and Media {{{
-          ",XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl s +10%"
-          ",XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl s 10%-"
-          ",XF86AudioRaiseVolume, exec, ${pkgs.pamixer}/bin/pamixer -i 5"
-          ",XF86AudioLowerVolume, exec, ${pkgs.pamixer}/bin/pamixer -d 5"
-          ",XF86AudioMicMute, exec, ${pkgs.pamixer}/bin/pamixer --default-source -m"
-          ",XF86AudioMute, exec, ${pkgs.pamixer}/bin/pamixer -t"
-          ",XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
-          ",XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
-          ",XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
-          ",XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous"
-          #: }}}
-        ]
-        ++ (
-          # workspaces
-          # binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
-          builtins.concatLists (
-            builtins.genList (
-              x:
-              let
-                ws =
-                  let
-                    c = (x + 1) / 10;
-                  in
-                  builtins.toString (x + 1 - (c * 10));
-              in
-              [
-                "$mod, ${ws}, workspace, ${toString (x + 1)}"
-                "$mod SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
-              ]
-            ) 10
-          )
-        );
+        #: Brightness and Media {{{
+        ",XF86MonBrightnessUp, exec, ${pkgs.brightnessctl}/bin/brightnessctl s +10%"
+        ",XF86MonBrightnessDown, exec, ${pkgs.brightnessctl}/bin/brightnessctl s 10%-"
+        ",XF86AudioRaiseVolume, exec, ${pkgs.pamixer}/bin/pamixer -i 5"
+        ",XF86AudioLowerVolume, exec, ${pkgs.pamixer}/bin/pamixer -d 5"
+        ",XF86AudioMicMute, exec, ${pkgs.pamixer}/bin/pamixer --default-source -m"
+        ",XF86AudioMute, exec, ${pkgs.pamixer}/bin/pamixer -t"
+        ",XF86AudioPlay, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
+        ",XF86AudioPause, exec, ${pkgs.playerctl}/bin/playerctl play-pause"
+        ",XF86AudioNext, exec, ${pkgs.playerctl}/bin/playerctl next"
+        ",XF86AudioPrev, exec, ${pkgs.playerctl}/bin/playerctl previous"
+        #: }}}
+
+        # Workspaces
+        "$mod, code:10, workspace, 1"
+        "$mod, code:11, workspace, 2"
+        "$mod, code:12, workspace, 3"
+        "$mod, code:13, workspace, 4"
+        "$mod, code:14, workspace, 5"
+        "$mod, code:15, workspace, 6"
+        "$mod, code:16, workspace, 7"
+        "$mod, code:17, workspace, 8"
+        "$mod, code:18, workspace, 9"
+        "$mod, code:19, workspace, 10"
+
+        # Send to Workspaces
+        "$mod SHIFT, code:10, movetoworkspace, 1"
+        "$mod SHIFT, code:11, movetoworkspace, 2"
+        "$mod SHIFT, code:12, movetoworkspace, 3"
+        "$mod SHIFT, code:13, movetoworkspace, 4"
+        "$mod SHIFT, code:14, movetoworkspace, 5"
+        "$mod SHIFT, code:15, movetoworkspace, 6"
+        "$mod SHIFT, code:16, movetoworkspace, 7"
+        "$mod SHIFT, code:17, movetoworkspace, 8"
+        "$mod SHIFT, code:18, movetoworkspace, 9"
+        "$mod SHIFT, code:19, movetoworkspace, 10"
+      ];
     };
   };
 }
diff --git a/hosts/brontes/default.nix b/hosts/brontes/default.nix
index c85205a..4b2f5a2 100644
--- a/hosts/brontes/default.nix
+++ b/hosts/brontes/default.nix
@@ -36,7 +36,10 @@ in
 
   modules = {
     system = {
-      roles.desktop.enable = true;
+      roles = {
+        desktop.enable = true;
+        gaming.enable = true;
+      };
 
       outputs = {
         "DP-2" = {
diff --git a/hosts/marr/default.nix b/hosts/marr/default.nix
index 6e871ff..ea5a5b7 100644
--- a/hosts/marr/default.nix
+++ b/hosts/marr/default.nix
@@ -20,7 +20,6 @@
     system = {
       roles = {
         desktop.enable = true;
-        gaming.enable = true;
       };
 
       outputs = {