From 2753c62224ffec0566cc4995d8349d48f0d881a3 Mon Sep 17 00:00:00 2001 From: iFargle Date: Wed, 3 Jan 2024 23:33:36 +0900 Subject: [PATCH] breaking Hyprland --- .../common/hyprland/hyprland-binds.nix | 161 +++++++++--------- .../hyprland/themes/stylix/hyprland-conf.nix | 1 - .../desktops/hyprland/default.nix | 85 +++------ 3 files changed, 100 insertions(+), 147 deletions(-) diff --git a/home-manager/common/desktops/hyprland/common/hyprland/hyprland-binds.nix b/home-manager/common/desktops/hyprland/common/hyprland/hyprland-binds.nix index 820ff66e..d4277302 100644 --- a/home-manager/common/desktops/hyprland/common/hyprland/hyprland-binds.nix +++ b/home-manager/common/desktops/hyprland/common/hyprland/hyprland-binds.nix @@ -1,104 +1,105 @@ { theme, ... }: { - home.file = { - ".config/hypr/hyprland.conf" = { - enable = true; - text = '' - # See https://wiki.hyprland.org/Configuring/Keywords/ for more - - # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more - bind = $mainMod, Q, exec, kitty - bind = $mainMod, C, killactive, - bind = $mainMod, M, exit, - bind = $mainMod, V, togglefloating, - # bind = $mainMod, R, exec, wofi --show drun - bind = $mainMod, P, pseudo, # dwindle - bind = $mainMod, J, togglesplit, # dwindle + wayland.windowManager.hyprland = { + settings = { + exec-once = ''bash ~/.config/hypr/start.sh''; + bind = [ + ''SUPER, Q, exec, kitty'' + ''SUPER, C, killactive,'' + ''SUPER, M, exit,'' + ''SUPER, V, togglefloating,'' + ''SUPER, P, pseudo, # dwindle'' + ''SUPER, J, togglesplit, # dwindle'' # Move focus with mainMod + arrow keys - bind = SUPER_ALT, left, movefocus, l - bind = SUPER_ALT, right, movefocus, r - bind = SUPER_ALT, up, movefocus, u - bind = SUPER_ALT, down, movefocus, d + ''SUPER_ALT, left, movefocus, l'' + ''SUPER_ALT, right, movefocus, r'' + ''SUPER_ALT, up, movefocus, u'' + ''SUPER_ALT, down, movefocus, d'' - bind = SUPER_ALT, H, movefocus, l - bind = SUPER_ALT, L, movefocus, r - bind = SUPER_ALT, K, movefocus, u - bind = SUPER_ALT, J, movefocus, d + ''SUPER_ALT, H, movefocus, l'' + ''SUPER_ALT, L, movefocus, r'' + ''SUPER_ALT, K, movefocus, u'' + ''SUPER_ALT, J, movefocus, d'' # Switch workspaces with mainMod + [0-9] - bind = $mainMod, 1, workspace, 1 - bind = $mainMod, 2, workspace, 2 - bind = $mainMod, 3, workspace, 3 - bind = $mainMod, 4, workspace, 4 - bind = $mainMod, 5, workspace, 5 - bind = $mainMod, 6, workspace, 6 - bind = $mainMod, 7, workspace, 7 - bind = $mainMod, 8, workspace, 8 - bind = $mainMod, 9, workspace, 9 - bind = $mainMod, 0, workspace, 10 + ''SUPER, 1, workspace, 1'' + ''SUPER, 2, workspace, 2'' + ''SUPER, 3, workspace, 3'' + ''SUPER, 4, workspace, 4'' + ''SUPER, 5, workspace, 5'' + ''SUPER, 6, workspace, 6'' + ''SUPER, 7, workspace, 7'' + ''SUPER, 8, workspace, 8'' + ''SUPER, 9, workspace, 9'' + ''SUPER, 0, workspace, 10'' # Move active window to a workspace with mainMod + SHIFT + [0-9] - bind = $mainMod SHIFT, 1, movetoworkspace, 1 - bind = $mainMod SHIFT, 2, movetoworkspace, 2 - bind = $mainMod SHIFT, 3, movetoworkspace, 3 - bind = $mainMod SHIFT, 4, movetoworkspace, 4 - bind = $mainMod SHIFT, 5, movetoworkspace, 5 - bind = $mainMod SHIFT, 6, movetoworkspace, 6 - bind = $mainMod SHIFT, 7, movetoworkspace, 7 - bind = $mainMod SHIFT, 8, movetoworkspace, 8 - bind = $mainMod SHIFT, 9, movetoworkspace, 9 - bind = $mainMod SHIFT, 0, movetoworkspace, 10 + ''SUPER SHIFT, 1, movetoworkspace, 1'' + ''SUPER SHIFT, 2, movetoworkspace, 2'' + ''SUPER SHIFT, 3, movetoworkspace, 3'' + ''SUPER SHIFT, 4, movetoworkspace, 4'' + ''SUPER SHIFT, 5, movetoworkspace, 5'' + ''SUPER SHIFT, 6, movetoworkspace, 6'' + ''SUPER SHIFT, 7, movetoworkspace, 7'' + ''SUPER SHIFT, 8, movetoworkspace, 8'' + ''SUPER SHIFT, 9, movetoworkspace, 9'' + ''SUPER SHIFT, 0, movetoworkspace, 10'' # Scroll through existing workspaces with mainMod + scroll - bind = $mainMod, mouse_down, workspace, e+1 - bind = $mainMod, mouse_up, workspace, e-1 + ''SUPER, mouse_down, workspace, e+1'' + ''SUPER, mouse_up, workspace, e-1'' - # Move/resize windows with mainMod + LMB/RMB and dragging - bindm = $mainMod, mouse:272, movewindow - bindm = $mainMod, mouse:273, resizewindow + # Resize + ''SUPER, R, exec, notify-send "Entered resize mode. Press ESC to quit."'' + ''SUPER, R, submap, resize'' ############################################################################# # Custom keybinds # Show Rofi on SUPER-SPACE - bind = $mainMod, space, exec, rofi -show combi -show-icons - # bind = $mainMod, space, exec, rofi -show drun -show-icons - # Take a screenshot with the Print key - bind = , Print, exec, grim -g "$(slurp)" | wl-copy -t image/png + ''SUPER, space, exec, rofi -show combi -show-icons'' + # ''SUPER, space, exec, rofi -show drun -show-icons + # Take a screenshot with the Print key'' + '', Print, exec, grim -g "$(slurp)" | wl-copy -t image/png'' # Move to the previous / next workspace with SUPER-LEFT and SUPER-RIGHT - bind = $mainMod , right, workspace, e+1 - bind = $mainMod , left , workspace, e-1 - bind = $mainMod SHIFT, right, movetoworkspace, e+1 - bind = $mainMod SHIFT, left , movetoworkspace, e-1 - bind = SHIFT ALT, L, workspace, e+1 - bind = SHIFT ALT, H, workspace, e-1 + ''SUPER , right, workspace, e+1'' + ''SUPER , left , workspace, e-1'' + ''SUPER SHIFT, right, movetoworkspace, e+1'' + ''SUPER SHIFT, left , movetoworkspace, e-1'' + ''SHIFT ALT, L, workspace, e+1'' + ''SHIFT ALT, H, workspace, e-1'' # Lock the screen, send to swaylock and pause music - bind = $mainMod, L, exec, swaylock - bind = $mainMod, L, exec, playerctl pause + ''SUPER, L, exec, swaylock'' + ''SUPER, L, exec, playerctl pause'' # to switch between windows in a floating workspace - bind = $mainMod ,Tab, cyclenext, # change focus to another window - bind = $mainMod ,Tab, bringactivetotop, # bring it to the top + ''SUPER ,Tab, cyclenext, # change focus to another window'' + ''SUPER ,Tab, bringactivetotop, # bring it to the top'' - # Resize - bind = $mainMod, R, exec, notify-send "Entered resize mode. Press ESC to quit." - bind = $mainMod, R, submap, resize - submap = resize - binde = , H, resizeactive,-50 0 - binde = , L, resizeactive,50 0 - binde = , K, resizeactive,0 -50 - binde = , J, resizeactive,0 50 - binde = , left, resizeactive,-50 0 - binde = , right, resizeactive,50 0 - binde = , up, resizeactive,0 -50 - binde = , down, resizeactive,0 50 - bind = , escape, submap, reset - submap = reset - - # Start the config: - exec-once=bash ~/.config/hypr/start.sh - ''; + ]; + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + ''SUPER, mouse:272, movewindow'' + ''SUPER, mouse:273, resizewindow'' + ]; + submap = { + resize = { + bind = [ + '', escape, submap, reset'' + ]; + binde = [ + '', H, resizeactive,-50 0'' + '', L, resizeactive,50 0'' + '', K, resizeactive,0 -50'' + '', J, resizeactive,0 50'' + '', left, resizeactive,-50 0'' + '', right, resizeactive,50 0'' + '', up, resizeactive,0 -50'' + '', down, resizeactive,0 50'' + ]; + }; + reset = {}; + }; }; - }; } diff --git a/home-manager/common/desktops/hyprland/themes/stylix/hyprland-conf.nix b/home-manager/common/desktops/hyprland/themes/stylix/hyprland-conf.nix index 0eef9a8a..c180a00d 100644 --- a/home-manager/common/desktops/hyprland/themes/stylix/hyprland-conf.nix +++ b/home-manager/common/desktops/hyprland/themes/stylix/hyprland-conf.nix @@ -1,5 +1,4 @@ { theme, ... }: { - wayland.windowManager.hyprland = { enable = true; settings = { diff --git a/home-manager/hosts/nixos-framework/desktops/hyprland/default.nix b/home-manager/hosts/nixos-framework/desktops/hyprland/default.nix index cf9d09a9..3e0cfaa9 100644 --- a/home-manager/hosts/nixos-framework/desktops/hyprland/default.nix +++ b/home-manager/hosts/nixos-framework/desktops/hyprland/default.nix @@ -1,70 +1,23 @@ { theme, ... }: { - home.file = { - ".config/hypr/hyprland.conf" = { - enable = true; - text = '' - - # Laptop specific: - monitor=,highrr,auto,1.25 - $mainMod = SUPER - - # Set up the FN keys: - - # F1 - Mute - # bind = , XF86AudioMute, exec, amixer set Master toggle && swayosd --output-volume=mute-toggle - bind = , XF86AudioMute, exec, swayosd --output-volume=mute-toggle - - # F2 - Volume Down - # binde = , XF86AudioLowerVolume, exec, amixer set Master 3%- - binde = , XF86AudioLowerVolume, exec, swayosd --output-volume=lower - - # F3 - Volume Up - # binde = , XF86AudioRaiseVolume, exec, amixer set Master 3%+ - binde = , XF86AudioRaiseVolume, exec, swayosd --output-volume=raise - - # F4 - Previous Track - # bind = , XF86AudioMicMute, exec, amixer set Capture toggle - bind = , XF86AudioPrev, exec, playerctl previous - - # F5 - Play/Pause - # binde = , XF86MonBrightnessDown, exec, light -U 5 - binde = , XF86AudioPlay, exec, playerctl play-pause - - # F6 - Next Track - # binde = , XF86MonBrightnessUp, exec, light -A 5 - binde = , XF86AudioNext, exec, playerctl next - - # F7 - Brightness Down - # bind = , XF86 - binde = , XF86MonBrightnessDown, exec, light -U 5 - - # F8 - Brightness Up - # bind = , XF86 - binde = , XF86MonBrightnessUp, exec, light -A 5 - - # F9 - External Displays - # bind = , XF86 - - # F10 - Airplane Mode - # bind = , XF86 - - # F11 - PRT SCR - # bind = , XF86 - - # F12 - "Framework Button" - # bind = , XF86 - - # Use rofi as an alt-tab switcher - # bind = ALT, TAB, exec, rofi -show window - - # Lid closure: - # trigger when the switch is toggled - # bindl=,switch:[switch name],exec,swaylock - # trigger when the switch is turning on - bindl=,switch:on:1241ec0,exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1" - # trigger when the switch is turning off - bindl=,switch:off:1241ec0,exec,hyprctl keyword monitor "eDP-1, disable" - ''; + wayland.windowManager.hyprland = { + settings = { + monitor = ",highrr,auto,1.25"; + bind = [ + '', XF86AudioMute, exec, swayosd --output-volume=mute-toggle'' + '', XF86AudioPrev, exec, playerctl previous'' + ]; + binde = [ + '', XF86AudioPlay, exec, playerctl play-pause'' + '', XF86AudioNext, exec, playerctl next'' + '', XF86MonBrightnessDown, exec, light -U 5'' + '', XF86MonBrightnessUp, exec, light -A 5'' + '', XF86AudioLowerVolume, exec, swayosd --output-volume=lower'' + '', XF86AudioRaiseVolume, exec, swayosd --output-volume=raise'' + ]; + bindl = [ + '',switch:on:1241ec0,exec,hyprctl keyword monitor "eDP-1, 2560x1600, 0x0, 1"'' + '',switch:off:1241ec0,exec,hyprctl keyword monitor "eDP-1, disable"'' + ]; }; # Set the custom launcher script ".config/hypr/start.sh" = {