about summary refs log tree commit diff
path: root/modules/hyprland.nix
diff options
context:
space:
mode:
authorazahi <azat@bahawi.net>2024-11-10 01:08:38 +0300
committerazahi <azat@bahawi.net>2024-11-10 01:08:38 +0300
commit693768ee37098dbebb38c86e27044f2faa38348d (patch)
tree37c92a1c83cf22fa5e5a570baa8598ba6063c795 /modules/hyprland.nix
parent2024-10-29 (diff)
2024-11-10 HEAD master
Diffstat (limited to 'modules/hyprland.nix')
-rw-r--r--modules/hyprland.nix143
1 files changed, 143 insertions, 0 deletions
diff --git a/modules/hyprland.nix b/modules/hyprland.nix
new file mode 100644
index 0000000..cab01b6
--- /dev/null
+++ b/modules/hyprland.nix
@@ -0,0 +1,143 @@
+{
+  config,
+  inputs,
+  lib,
+  ...
+}:
+let
+  cfg = config.nixfiles.modules.hyprland;
+in
+{
+  options.nixfiles.modules.hyprland.enable = lib.mkEnableOption "Hyprland";
+
+  config = lib.mkIf cfg.enable {
+    nixfiles.modules.wayland.enable = true;
+
+    hm = {
+      stylix.targets.hyprland.enable = false;
+
+      wayland.windowManager.hyprland = {
+        enable = true;
+
+        systemd = {
+          enable = true;
+          variables = [ "--all" ];
+        };
+
+        settings = {
+          misc = {
+            disable_hyprland_logo = true;
+            disable_splash_rendering = true;
+          };
+
+          general = {
+            gaps_in = 0;
+            gaps_out = 0;
+          };
+
+          decoration = {
+            blur.enabled = false;
+          };
+
+          animations.enabled = false;
+
+          debug.disable_logs = false;
+
+          input = with config.services.xserver.xkb; {
+            kb_layout = layout;
+            kb_variant = variant;
+            kb_options = options;
+
+            repeat_delay = config.services.xserver.autoRepeatDelay;
+            repeat_rate = config.services.xserver.autoRepeatInterval;
+          };
+
+          bindm = [
+            "SUPER, mouse:272, movewindow"
+            "SUPER, mouse:273, resizewindow"
+            "SUPER ALT, mouse:272, resizewindow"
+          ];
+
+          bind =
+            [
+              "SUPER SHIFT, E, exec, pkill Hyprland"
+
+              "SUPER, D, killactive,"
+              "SUPER, F, fullscreen,"
+
+              "SUPER, G, togglegroup,"
+              "SUPER SHIFT, N, changegroupactive, f"
+              "SUPER SHIFT, P, changegroupactive, b"
+
+              "SUPER, R, togglesplit,"
+              "SUPER, T, togglefloating,"
+              "SUPER, P, pseudo,"
+              "SUPER ALT, ,resizeactive,"
+
+              "SUPER, Return, exec, foot"
+              "SUPER, L, exec, pgrep hyprlock || hyprlock"
+
+              "SUPER, H, movefocus, l"
+              "SUPER, J, movefocus, d"
+              "SUPER, K, movefocus, u"
+              "SUPER, L, movefocus, r"
+
+              "SUPER SHIFT, H, movewindow, l"
+              "SUPER SHIFT, J, movewindow, d"
+              "SUPER SHIFT, K, movewindow, u"
+              "SUPER SHIFT, L, movewindow, r"
+
+              "SUPER ALT, H, resizeactive, 10 0"
+              "SUPER ALT, J, resizeactive, 0 10"
+              "SUPER ALT, K, resizeactive, 0 -10"
+              "SUPER ALT, L, resizeactive, -10 0"
+
+              ", XF86AudioPlay, exec, mpc play"
+              ", XF86AudioPrev, exec, mpc prev"
+              ", XF86AudioNext, exec, mpc next"
+
+              ", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ .1+"
+              ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ .1-"
+
+              ", XF86AudioMute,    exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
+              ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"
+
+              ", XF86MonBrightnessUp,   exec, brightnessctl set +5%"
+              ", XF86MonBrightnessDown, exec, brightnessctl set 5%-"
+            ]
+            ++ (builtins.concatLists (
+              builtins.genList (
+                x:
+                let
+                  ws =
+                    let
+                      c = (x + 1) / 10;
+                    in
+                    toString (x + 1 - (c * 10));
+                in
+                [
+                  "SUPER, ${ws}, workspace, ${toString (x + 1)}"
+                  "SUPER SHIFT, ${ws}, movetoworkspace, ${toString (x + 1)}"
+                ]
+              ) 10
+            ));
+        };
+      };
+
+      programs.hyprlock.enable = true;
+    };
+
+    programs.hyprland.enable = true;
+
+    nixpkgs.overlays = [ inputs.hyprland.overlays.default ];
+
+    nix.settings = {
+      substituters = [
+        "https://hyprland.cachix.org"
+      ];
+      trusted-public-keys = [
+        "hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="
+      ];
+    };
+  };
+}

Consider giving Nix/NixOS a try! <3