From b23774d0a23626a8530af5f3fdb7cf3b07ce47d2 Mon Sep 17 00:00:00 2001 From: kenji Date: Tue, 8 Jul 2025 22:28:17 -0500 Subject: [PATCH] organized hypr config --- packages/hyprland/config/binds.nix | 103 +++++++++++++++++++++++++ packages/hyprland/home.nix | 116 ++++------------------------- 2 files changed, 117 insertions(+), 102 deletions(-) create mode 100644 packages/hyprland/config/binds.nix diff --git a/packages/hyprland/config/binds.nix b/packages/hyprland/config/binds.nix new file mode 100644 index 0000000..d2c0f85 --- /dev/null +++ b/packages/hyprland/config/binds.nix @@ -0,0 +1,103 @@ +{ + config, + pkgs, + ... +}: { + wayland.windowManager.hyprland.settings = { + bind = + [ + "$mod, Return, exec, $term" + "$mod, Q, killactive," + "$mod, E, exec, $fileManager" + "$mod, V, togglefloating," + "$mod, R, exec, $menu" + "$mod, P, pseudo," + "$mod, B, togglesplit," + "$mod, W, exec, $browser" + + "$mod, H, movefocus, l" + "$mod, L, movefocus, r" + "$mod, K, movefocus, u" + "$mod, J, movefocus, d" + + "$mod Shift, M, exit," + "$mod SHIFT, K, movewindow, u" + "$mod SHIFT, J, movewindow, d" + "$mod SHIFT, H, movewindow, l" + "$mod SHIFT, L, movewindow, r" + + "$mod CTRL, K, resizeactive, 0 -50" + "$mod CTRL, J, resizeactive, 0 50" + "$mod CTRL, H, resizeactive, -50 0" + "$mod CTRL, L, resizeactive, 50 0" + + "$mod, S, togglespecialworkspace, magic" + "$mod SHIFT, S, movetoworkspace, special:magic" + + "$mod, mouse_down, workspace, e+1" + "$mod, mouse_up, workspace, e-1" + + "$mod, F, fullscreen, 0" + + "$mod, Space, exec, pkill rofi || rofi -show drun" + "$mod, C, exec, pkill rofi || rofi -show calc -modi calc -no-show-match -no-sort" + ] + ++ ( + # workspaces + builtins.concatLists (builtins.genList ( + i: let + ws = i + 1; + in [ + "$mod, ${toString ws}, workspace, ${toString ws}" + # "$mod, ${toString ws}, exec, $wsaction workspace, ${toString ws}" + "$mod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}" + ] + ) + 9) + ) + ++ [ + "$mod, 0, workspace, 10" + "$mod, 0, movetoworkspace, 10" # This seems like a duplicate binding for workspace 10, check if this is intended + ]; + + # You can also move bindm, bindel, bindl, bindi, bindin here if you want + # For example: + bindm = [ + "$mod, mouse:272, movewindow" + "$mod, mouse:273, resizewindow" + ]; + + bindel = [ + ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" + ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" + ",XF86MonBrightnessUp, exec, brightnessctl s 10%+" + ",XF86MonBrightnessDown, exec, brightnessctl s 10%-" + ]; + + bindl = [ + ",XF86AudioNext, exec, playerctl next" + ",XF86AudioPause, exec, playerctl play-pause" + ",XF86AudioPlay, exec, playerctl play-pause" + ",XF86AudioPrev, exec, playerctl previous" + ]; + + bindi = [ + "Super, Super_L, global, caelestia:launcher" + # "$mod, Space, global, caelestia:launcher" + ]; + + bindin = [ + "Super, catchall, global, caelestia:launcherInterrupt" + "Super, mouse:272, global, caelestia:launcherInterrupt" + "Super, mouse:273, global, caelestia:launcherInterrupt" + "Super, mouse:274, global, caelestia:launcherInterrupt" + "Super, mouse:275, global, caelestia:launcherInterrupt" + "Super, mouse:276, global, caelestia:launcherInterrupt" + "Super, mouse:277, global, caelestia:launcherInterrupt" + "Super, mouse_up, global, caelestia:launcherInterrupt" + "Super, mouse_down, global, caelestia:launcherInterrupt" + ]; + }; +} diff --git a/packages/hyprland/home.nix b/packages/hyprland/home.nix index 94dc3e1..e011dca 100644 --- a/packages/hyprland/home.nix +++ b/packages/hyprland/home.nix @@ -1,8 +1,13 @@ {myConfig, ...}: { + imports = [ + ./config/binds.nix + ]; + home.file.".config/hypr/scripts/wsaction.fish" = { source = builtins.toPath ./scripts/wsaction.fish; executable = true; }; + wayland.windowManager.hyprland = { enable = true; xwayland.enable = true; @@ -27,7 +32,8 @@ "[workspace 20 silent] kitty --single-insance --hold fastfetch" "[workspace 20 silent] firefox" "[workspace 1] kitty --single-instance --hold fastfetch" - "$bar" + # If $bar is uncommented here, make sure it's defined either here or in another imported file + # "$bar" "matugen image /home/${myConfig.essentials.Username}/.config/nixos/assets/wallpapers/ultrawide-nixos-default.png" "hyprctl setcursor Bibata-Original-Classic 24" "solaar -w hide" @@ -40,8 +46,8 @@ # col.active_border = "#0DB7D4FF"; # col.inactive_border = "#31313600"; # col = { - # "inactive_border" = "rgba(595959aa)"; - # "active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + # "inactive_border" = "rgba(595959aa)"; + # "active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; # }; resize_on_border = false; allow_tearing = false; @@ -144,106 +150,12 @@ scroll_event_delay = 0; }; - device = [ - { - name = "epic-mouse-v1"; - sensitivity = -0.5; - } - ]; + # The 'bind' array is now entirely managed by the imported binds.nix + # You would remove the existing 'bind' section from here: + # bind = ... (remove this section) - bind = - [ - "$mod, Return, exec, $term" - "$mod, Q, killactive," - "$mod, E, exec, $fileManager" - "$mod, V, togglefloating," - "$mod, R, exec, $menu" - "$mod, P, pseudo," - "$mod, B, togglesplit," - "$mod, W, exec, $browser" - - "$mod, H, movefocus, l" - "$mod, L, movefocus, r" - "$mod, K, movefocus, u" - "$mod, J, movefocus, d" - - "$mod Shift, M, exit," - "$mod SHIFT, K, movewindow, u" - "$mod SHIFT, J, movewindow, d" - "$mod SHIFT, H, movewindow, l" - "$mod SHIFT, L, movewindow, r" - - "$mod CTRL, K, resizeactive, 0 -50" - "$mod CTRL, J, resizeactive, 0 50" - "$mod CTRL, H, resizeactive, -50 0" - "$mod CTRL, L, resizeactive, 50 0" - - "$mod, S, togglespecialworkspace, magic" - "$mod SHIFT, S, movetoworkspace, special:magic" - - "$mod, mouse_down, workspace, e+1" - "$mod, mouse_up, workspace, e-1" - - "$mod, F, fullscreen, 0" - - "$mod, Space, exec, pkill rofi || rofi -show drun" - "$mod, C, exec, pkill rofi || rofi -show calc -modi calc -no-show-match -no-sort" - ] - ++ ( - # workspaces - builtins.concatLists (builtins.genList ( - i: let - ws = i + 1; - in [ - "$mod, ${toString ws}, workspace, ${toString ws}" - # "$mod, ${toString ws}, exec, $wsaction workspace, ${toString ws}" - "$mod SHIFT, ${toString ws}, movetoworkspace, ${toString ws}" - ] - ) - 9) - ) - ++ [ - "$mod, 0, workspace, 10" - "$mod, 0, movetoworkspace, 10" - ]; - - bindm = [ - "$mod, mouse:272, movewindow" - "$mod, mouse:273, resizewindow" - ]; - - bindel = [ - ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+" - ",XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" - ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" - ",XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle" - ",XF86MonBrightnessUp, exec, brightnessctl s 10%+" - ",XF86MonBrightnessDown, exec, brightnessctl s 10%-" - ]; - - bindl = [ - ",XF86AudioNext, exec, playerctl next" - ",XF86AudioPause, exec, playerctl play-pause" - ",XF86AudioPlay, exec, playerctl play-pause" - ",XF86AudioPrev, exec, playerctl previous" - ]; - - bindi = [ - "Super, Super_L, global, caelestia:launcher" - # "$mod, Space, global, caelestia:launcher" - ]; - - bindin = [ - "Super, catchall, global, caelestia:launcherInterrupt" - "Super, mouse:272, global, caelestia:launcherInterrupt" - "Super, mouse:273, global, caelestia:launcherInterrupt" - "Super, mouse:274, global, caelestia:launcherInterrupt" - "Super, mouse:275, global, caelestia:launcherInterrupt" - "Super, mouse:276, global, caelestia:launcherInterrupt" - "Super, mouse:277, global, caelestia:launcherInterrupt" - "Super, mouse_up, global, caelestia:launcherInterrupt" - "Super, mouse_down, global, caelestia:launcherInterrupt" - ]; + # Similarly, remove other bind sections (bindm, bindel, bindl, bindi, bindin) + # if you've moved them into `binds.nix`. env = [ "HYPRCURSOR_THEME, Bibata-Original-Classic"