From ca52e2776fab24c97c9e772172a75224791ec795 Mon Sep 17 00:00:00 2001
From: DerGrumpf <p.keier@beyerstedt-it.de>
Date: Tue, 25 Mar 2025 01:59:21 +0100
Subject: [PATCH] Changed: Hyprland

---
 flake.nix                 |  7 ++++++
 home/hyprland/default.nix | 53 ++++++++++++++++++++++++++-------------
 2 files changed, 43 insertions(+), 17 deletions(-)

diff --git a/flake.nix b/flake.nix
index a0ba8b1..8ea43c7 100644
--- a/flake.nix
+++ b/flake.nix
@@ -22,9 +22,16 @@
 
   inputs = {
     nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05";
+    hyprland.url = "github:hyprwm/Hyprland";
+
     home-manager.url = "github:nix-community/home-manager/release-24.05";
     home-manager.inputs.nixpkgs.follows = "nixpkgs";
 
+    hyprland-plugins = {
+        url = "github:hyprwm/hyprland-plugins";
+        inputs.hyprland.follows = "hyprland";
+    };
+
     catppuccin-bat = {
       url = "github:catppuccin/bat";
       flake = false;
diff --git a/home/hyprland/default.nix b/home/hyprland/default.nix
index 0b0a34f..62b7cd7 100644
--- a/home/hyprland/default.nix
+++ b/home/hyprland/default.nix
@@ -1,25 +1,44 @@
-{ pkgs, ...}:
+{ inputs, pkgs, ...}:
 
 {
     programs.kitty.enable = true;
-    wayland.windowManager.hyprland.enable = true;
+    wayland.windowManager.hyprland = {
+        enable = true;
+        package = null;
+        portalPackage = null;
+        systemd.variables = [ "--all" ];
+        plugins = [
+            inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprbars
+        ];
+    };
     home.sessionVariables.NIXOS_OZONE_WL = "1";
 
     wayland.windowManager.hyprland.settings = {
-	"$mod" = "SUPER";
-    "$terminal" = "kitty";
-    "$filemanager" = "dolphin";
-    
-	bind = [
-		"$mod, F, exec, firefox"
-	    "$mod, Q, exec, $terminal"
-        "$mod, C, killactive, "
-        "$mod, M, exit, "
-        "$mod, V, togglefloating, "
-        "$mod, R, exec, $menu"
-        "$mod, S, exec, $power"
-        "$mod, P, pseudo, "
-        "$mod, J, togglesplit, "
-    ];
+        "$mod" = "SUPER";
+        "$terminal" = "kitty";
+        "$filemanager" = "dolphin";
+        
+        bind = [
+            "$mod, F, exec, firefox"
+            "$mod, Q, exec, $terminal"
+            "$mod, C, killactive, "
+            "$mod, M, exit, "
+            "$mod, V, togglefloating, "
+            "$mod, R, exec, $menu"
+            "$mod, S, exec, $power"
+            "$mod, P, pseudo, "
+            "$mod, J, togglesplit, "
+        ] ++ (
+            # workspaces
+            # binds $mod + [shift +] {1..9} to [move to] workspace {1..9}
+            builtins.concatLists (builtins.genList (i:
+                let ws = i + 1;
+                in [
+                  "$mod, code:1${toString i}, workspace, ${toString ws}"
+                  "$mod SHIFT, code:1${toString i}, movetoworkspace, ${toString ws}"
+                ]
+              )
+              9)
+        );
     };
 }