diff --git a/home/hypr/hyprland/env.nix b/home/hypr/hyprland/env.nix index 5c14385..67a49b3 100644 --- a/home/hypr/hyprland/env.nix +++ b/home/hypr/hyprland/env.nix @@ -3,16 +3,16 @@ { wayland.windowManager.hyprland.settings = { env = [ - "XCURSOR_SIZE,24" - "XCURSOR_THEME,Bibata-Modern-Classic" - "QT_STYLE_OVERRIDE,adwaita-dark" - "GDK_BACKEND,wayland,x11" - "QT_QPA_PLATFORM,wayland;xcb" - "QT_QPA_PLATFORMTHEME,gtk3" - "ELECTRON_OZONE_PLATFORM_HINT,auto" - "TERMINAL,ghostty" - "MESA_GL_VERSION_OVERRIDE,4.6" - "MESA_GLSL_VERSION_OVERRIDE,460" + { _args = [ "XCURSOR_SIZE" "24" ]; } + { _args = [ "XCURSOR_THEME" "Bibata-Modern-Classic" ]; } + { _args = [ "QT_STYLE_OVERRIDE" "adwaita-dark" ]; } + { _args = [ "GDK_BACKEND" "wayland" "x11" ]; } + { _args = [ "QT_QPA_PLATFORM" "wayland;xcb" ]; } + { _args = [ "QT_QPA_PLATFORMTHEME" "gtk3" ]; } + { _args = [ "ELECTRON_OZONE_PLATFORM_HINT" "auto" ]; } + { _args = [ "TERMINAL" "ghostty" ]; } + { _args = [ "MESA_GL_VERSION_OVERRIDE" "4.6" ]; } + { _args = [ "MESA_GLSL_VERSION_OVERRIDE" "460" ]; } ]; }; } diff --git a/home/hypr/hyprland/general.nix b/home/hypr/hyprland/general.nix index cc06c42..ac8bccb 100644 --- a/home/hypr/hyprland/general.nix +++ b/home/hypr/hyprland/general.nix @@ -2,7 +2,16 @@ { wayland.windowManager.hyprland.settings = { - monitor = ",preferred,auto,1"; + monitor = [ + { + _args = [ + "" + "preferred" + "auto" + "1" + ]; + } + ]; general = { gaps_in = 4; @@ -73,28 +82,175 @@ }; bezier = [ - "omniDecel, 0.05, 0.9, 0.1, 1" - "omniAccel, 0.3, 0, 0.8, 0.15" - "omniSmooth, 0.25, 0.1, 0.25, 1" - "omniOvershoot, 0.16, 1, 0.3, 1" - "menu_decel, 0.1, 1, 0, 1" - "menu_accel, 0.52, 0.03, 0.72, 0.08" + { + _args = [ + "omniDecel" + "0.05" + "0.9" + "0.1" + "1" + ]; + } + { + _args = [ + "omniAccel" + "0.3" + "0" + "0.8" + "0.15" + ]; + } + { + _args = [ + "omniSmooth" + "0.25" + "0.1" + "0.25" + "1" + ]; + } + { + _args = [ + "omniOvershoot" + "0.16" + "1" + "0.3" + "1" + ]; + } + { + _args = [ + "menu_decel" + "0.1" + "1" + "0" + "1" + ]; + } + { + _args = [ + "menu_accel" + "0.52" + "0.03" + "0.72" + "0.08" + ]; + } ]; animation = [ - "windowsIn, 1, 6, omniOvershoot, popin 86%" - "windowsOut, 1, 5, omniAccel, popin 92%" - "windowsMove, 1, 6, omniDecel, slide" - "fadeIn, 1, 5, omniDecel" - "fadeOut, 1, 4, omniAccel" - "border, 1, 10, omniSmooth" - "layersIn, 1, 5, omniDecel, popin 92%" - "layersOut, 1, 4, omniAccel, popin 94%" - "fadeLayersIn, 1, 3, omniDecel" - "fadeLayersOut, 1, 3, omniAccel" - "workspaces, 1, 8, omniDecel, slide" - "specialWorkspaceIn, 1, 5, omniDecel, slidevert" - "specialWorkspaceOut, 1, 4, omniAccel, slidevert" + { + _args = [ + "windowsIn" + "1" + "6" + "omniOvershoot" + "popin 86%" + ]; + } + { + _args = [ + "windowsOut" + "1" + "5" + "omniAccel" + "popin 92%" + ]; + } + { + _args = [ + "windowsMove" + "1" + "6" + "omniDecel" + "slide" + ]; + } + { + _args = [ + "fadeIn" + "1" + "5" + "omniDecel" + ]; + } + { + _args = [ + "fadeOut" + "1" + "4" + "omniAccel" + ]; + } + { + _args = [ + "border" + "1" + "10" + "omniSmooth" + ]; + } + { + _args = [ + "layersIn" + "1" + "5" + "omniDecel" + "popin 92%" + ]; + } + { + _args = [ + "layersOut" + "1" + "4" + "omniAccel" + "popin 94%" + ]; + } + { + _args = [ + "fadeLayersIn" + "1" + "3" + "omniDecel" + ]; + } + { + _args = [ + "fadeLayersOut" + "1" + "3" + "omniAccel" + ]; + } + { + _args = [ + "workspaces" + "1" + "8" + "omniDecel" + "slide" + ]; + } + { + _args = [ + "specialWorkspaceIn" + "1" + "5" + "omniDecel" + "slidevert" + ]; + } + { + _args = [ + "specialWorkspaceOut" + "1" + "4" + "omniAccel" + "slidevert" + ]; + } ]; device = [ diff --git a/home/hypr/hyprland/keybinds.nix b/home/hypr/hyprland/keybinds.nix index 57ba2d6..f3c77f5 100644 --- a/home/hypr/hyprland/keybinds.nix +++ b/home/hypr/hyprland/keybinds.nix @@ -8,119 +8,119 @@ in "$mainMod" = "SUPER"; bindr = [ - "$mainMod, SUPER_L, exec, ${ipc} launcher toggle" + { _args = [ "$mainMod" "SUPER_L" "exec" "${ipc} launcher toggle" ]; } ]; bind = [ # workspace - "CTRL $mainMod, right, layoutmsg, focus r" - "CTRL $mainMod, left, layoutmsg, focus l" - "CTRL $mainMod, down, workspace, r+1" - "CTRL $mainMod, up, workspace, r-1" - "CTRL $mainMod SHIFT, right, layoutmsg, movewindowto r" - "CTRL $mainMod SHIFT, left, layoutmsg, movewindowto l" - "CTRL $mainMod SHIFT, down, movetoworkspace, r+1" - "CTRL $mainMod SHIFT, up, movetoworkspace, r-1" - "$mainMod, R, layoutmsg, colresize +conf" - "$mainMod, C, layoutmsg, center" - "$mainMod SHIFT, R, layoutmsg, colresize 0.7" + { _args = [ "CTRL $mainMod" "right" "layoutmsg" "focus r" ]; } + { _args = [ "CTRL $mainMod" "left" "layoutmsg" "focus l" ]; } + { _args = [ "CTRL $mainMod" "down" "workspace" "r+1" ]; } + { _args = [ "CTRL $mainMod" "up" "workspace" "r-1" ]; } + { _args = [ "CTRL $mainMod SHIFT" "right" "layoutmsg" "movewindowto r" ]; } + { _args = [ "CTRL $mainMod SHIFT" "left" "layoutmsg" "movewindowto l" ]; } + { _args = [ "CTRL $mainMod SHIFT" "down" "movetoworkspace" "r+1" ]; } + { _args = [ "CTRL $mainMod SHIFT" "up" "movetoworkspace" "r-1" ]; } + { _args = [ "$mainMod" "R" "layoutmsg" "colresize +conf" ]; } + { _args = [ "$mainMod" "C" "layoutmsg" "center" ]; } + { _args = [ "$mainMod SHIFT" "R" "layoutmsg" "colresize 0.7" ]; } # interface - "$mainMod, P, exec, ${ipc} bar toggle" - "CTRL ALT, Delete, exec, ${ipc} sessionMenu toggle" + { _args = [ "$mainMod" "P" "exec" "${ipc} bar toggle" ]; } + { _args = [ "CTRL ALT" "Delete" "exec" "${ipc} sessionMenu toggle" ]; } # plugins - "$mainMod SHIFT, S, exec, ${ipc} plugin:screen-shot-and-record screenshot" - "$mainMod SHIFT, Z, exec, ${ipc} plugin:screen-shot-and-record search" - "$mainMod SHIFT, X, exec, ${ipc} plugin:screen-shot-and-record ocr" - "$mainMod SHIFT, C, exec, ${ipc} plugin:music panel" + { _args = [ "$mainMod SHIFT" "S" "exec" "${ipc} plugin:screen-shot-and-record screenshot" ]; } + { _args = [ "$mainMod SHIFT" "Z" "exec" "${ipc} plugin:screen-shot-and-record search" ]; } + { _args = [ "$mainMod SHIFT" "X" "exec" "${ipc} plugin:screen-shot-and-record ocr" ]; } + { _args = [ "$mainMod SHIFT" "C" "exec" "${ipc} plugin:music panel" ]; } # launchers - "$mainMod, Return, exec, ghostty" - "$mainMod, W, exec, zen-beta" - "$mainMod, E, exec, nautilus" - "$mainMod, Z, exec, zeditor" - "$mainMod ALT, V, exec, pavucontrol" - "$mainMod SHIFT, V, exec, ${ipc} launcher clipboard" - "$mainMod SHIFT, L, exec, ${ipc} lockScreen lock" - "CTRL SHIFT, Escape, exec, ghostty -e btop" + { _args = [ "$mainMod" "Return" "exec" "ghostty" ]; } + { _args = [ "$mainMod" "W" "exec" "zen-beta" ]; } + { _args = [ "$mainMod" "E" "exec" "nautilus" ]; } + { _args = [ "$mainMod" "Z" "exec" "zeditor" ]; } + { _args = [ "$mainMod ALT" "V" "exec" "pavucontrol" ]; } + { _args = [ "$mainMod SHIFT" "V" "exec" "${ipc} launcher clipboard" ]; } + { _args = [ "$mainMod SHIFT" "L" "exec" "${ipc} lockScreen lock" ]; } + { _args = [ "CTRL SHIFT" "Escape" "exec" "ghostty -e btop" ]; } # window management - "$mainMod, Q, killactive" - "$mainMod ALT, SPACE, togglefloating" - "$mainMod, F, fullscreen, 0" - "$mainMod, D, fullscreen, 1" - "$mainMod ALT, P, pin" + { _args = [ "$mainMod" "Q" "killactive" ]; } + { _args = [ "$mainMod ALT" "SPACE" "togglefloating" ]; } + { _args = [ "$mainMod" "F" "fullscreen" "0" ]; } + { _args = [ "$mainMod" "D" "fullscreen" "1" ]; } + { _args = [ "$mainMod ALT" "P" "pin" ]; } # focus windows - "$mainMod, left, layoutmsg, move -col" - "$mainMod, right, layoutmsg, move +col" - "$mainMod, up, movefocus, u" - "$mainMod, down, movefocus, d" + { _args = [ "$mainMod" "left" "layoutmsg" "move -col" ]; } + { _args = [ "$mainMod" "right" "layoutmsg" "move +col" ]; } + { _args = [ "$mainMod" "up" "movefocus" "u" ]; } + { _args = [ "$mainMod" "down" "movefocus" "d" ]; } - "$mainMod SHIFT, left, layoutmsg, movewindowto l" - "$mainMod SHIFT, right, layoutmsg, movewindowto r" - "$mainMod SHIFT, up, movewindow, u" - "$mainMod SHIFT, down, movewindow, d" + { _args = [ "$mainMod SHIFT" "left" "layoutmsg" "movewindowto l" ]; } + { _args = [ "$mainMod SHIFT" "right" "layoutmsg" "movewindowto r" ]; } + { _args = [ "$mainMod SHIFT" "up" "movewindow" "u" ]; } + { _args = [ "$mainMod SHIFT" "down" "movewindow" "d" ]; } # workspace navigation - "$mainMod, 1, workspace, 1" - "$mainMod, 2, workspace, 2" - "$mainMod, 3, workspace, 3" - "$mainMod, 4, workspace, 4" - "$mainMod, 5, workspace, 5" - "$mainMod, 6, workspace, 6" - "$mainMod, 7, workspace, 7" - "$mainMod, 8, workspace, 8" - "$mainMod, 9, workspace, 9" - "$mainMod, 0, workspace, 10" + { _args = [ "$mainMod" "1" "workspace" "1" ]; } + { _args = [ "$mainMod" "2" "workspace" "2" ]; } + { _args = [ "$mainMod" "3" "workspace" "3" ]; } + { _args = [ "$mainMod" "4" "workspace" "4" ]; } + { _args = [ "$mainMod" "5" "workspace" "5" ]; } + { _args = [ "$mainMod" "6" "workspace" "6" ]; } + { _args = [ "$mainMod" "7" "workspace" "7" ]; } + { _args = [ "$mainMod" "8" "workspace" "8" ]; } + { _args = [ "$mainMod" "9" "workspace" "9" ]; } + { _args = [ "$mainMod" "0" "workspace" "10" ]; } # move windows to workspace - "$mainMod SHIFT, 1, movetoworkspace, 1" - "$mainMod SHIFT, 2, movetoworkspace, 2" - "$mainMod SHIFT, 3, movetoworkspace, 3" - "$mainMod SHIFT, 4, movetoworkspace, 4" - "$mainMod SHIFT, 5, movetoworkspace, 5" - "$mainMod SHIFT, 6, movetoworkspace, 6" - "$mainMod SHIFT, 7, movetoworkspace, 7" - "$mainMod SHIFT, 8, movetoworkspace, 8" - "$mainMod SHIFT, 9, movetoworkspace, 9" - "$mainMod SHIFT, 0, movetoworkspace, 10" + { _args = [ "$mainMod SHIFT" "1" "movetoworkspace" "1" ]; } + { _args = [ "$mainMod SHIFT" "2" "movetoworkspace" "2" ]; } + { _args = [ "$mainMod SHIFT" "3" "movetoworkspace" "3" ]; } + { _args = [ "$mainMod SHIFT" "4" "movetoworkspace" "4" ]; } + { _args = [ "$mainMod SHIFT" "5" "movetoworkspace" "5" ]; } + { _args = [ "$mainMod SHIFT" "6" "movetoworkspace" "6" ]; } + { _args = [ "$mainMod SHIFT" "7" "movetoworkspace" "7" ]; } + { _args = [ "$mainMod SHIFT" "8" "movetoworkspace" "8" ]; } + { _args = [ "$mainMod SHIFT" "9" "movetoworkspace" "9" ]; } + { _args = [ "$mainMod SHIFT" "0" "movetoworkspace" "10" ]; } # special workspaces - "$mainMod, S, togglespecialworkspace" - "$mainMod ALT, S, movetoworkspacesilent, special" + { _args = [ "$mainMod" "S" "togglespecialworkspace" ]; } + { _args = [ "$mainMod ALT" "S" "movetoworkspacesilent" "special" ]; } # mouse workspace navigation - "$mainMod, mouse_up, workspace, +1" - "$mainMod, mouse_down, workspace, -1" + { _args = [ "$mainMod" "mouse_up" "workspace" "+1" ]; } + { _args = [ "$mainMod" "mouse_down" "workspace" "-1" ]; } # media keys - "$mainMod SHIFT, N, exec, playerctl next" - "$mainMod SHIFT, B, exec, playerctl previous" - "$mainMod SHIFT, P, exec, playerctl play-pause" + { _args = [ "$mainMod SHIFT" "N" "exec" "playerctl next" ]; } + { _args = [ "$mainMod SHIFT" "B" "exec" "playerctl previous" ]; } + { _args = [ "$mainMod SHIFT" "P" "exec" "playerctl play-pause" ]; } ]; # mouse binds bindm = [ - "$mainMod, mouse:272, movewindow" - "$mainMod, mouse:273, resizewindow" + { _args = [ "$mainMod" "mouse:272" "movewindow" ]; } + { _args = [ "$mainMod" "mouse:273" "resizewindow" ]; } ]; # volume and brightness binds bindel = [ - ", XF86AudioRaiseVolume, exec, ${ipc} volume increase" - ", XF86AudioLowerVolume, exec, ${ipc} volume decrease" - ", XF86MonBrightnessUp, exec, ${ipc} brightness increase" - ", XF86MonBrightnessDown, exec, ${ipc} brightness decrease" + { _args = [ "" "XF86AudioRaiseVolume" "exec" "${ipc} volume increase" ]; } + { _args = [ "" "XF86AudioLowerVolume" "exec" "${ipc} volume decrease" ]; } + { _args = [ "" "XF86MonBrightnessUp" "exec" "${ipc} brightness increase" ]; } + { _args = [ "" "XF86MonBrightnessDown" "exec" "${ipc} brightness decrease" ]; } ]; # volume and media keys bindl = [ - ", XF86AudioMute, exec, ${ipc} volume muteOutput" - ", XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_SOURCE@ toggle" - ", XF86AudioNext, exec, playerctl next" - ", XF86AudioPrev, exec, playerctl previous" - ", XF86AudioPlay, exec, playerctl play-pause" - ", XF86AudioPause, exec, playerctl play-pause" + { _args = [ "" "XF86AudioMute" "exec" "${ipc} volume muteOutput" ]; } + { _args = [ "" "XF86AudioMicMute" "exec" "wpctl set-mute @DEFAULT_SOURCE@ toggle" ]; } + { _args = [ "" "XF86AudioNext" "exec" "playerctl next" ]; } + { _args = [ "" "XF86AudioPrev" "exec" "playerctl previous" ]; } + { _args = [ "" "XF86AudioPlay" "exec" "playerctl play-pause" ]; } + { _args = [ "" "XF86AudioPause" "exec" "playerctl play-pause" ]; } ]; }; } diff --git a/home/hypr/hyprland/lua_converter.py b/home/hypr/hyprland/lua_converter.py new file mode 100644 index 0000000..2d077c9 --- /dev/null +++ b/home/hypr/hyprland/lua_converter.py @@ -0,0 +1,46 @@ +#!/usr/bin/env nix-shell +#!nix-shell -i python3 -p python3 + +import sys +import re +import os + +def convert_file(filepath): + if not os.path.isfile(filepath): + return + + with open(filepath, 'r', encoding='utf-8') as f: + lines = f.readlines() + + new_lines = [] + changed = False + + # "CTRL $mainMod, right, layoutmsg, focus r" + pattern = re.compile(r'^(\s*)"([^"]*,[^"]*)"\s*$') + + for line in lines: + match = pattern.match(line) + if match: + indent = match.group(1) + content = match.group(2) + parts = [f'"{p.strip()}"' for p in content.split(',')] + args_str = " ".join(parts) + new_line = f'{indent}{{ _args = [ {args_str} ]; }}\n' + new_lines.append(new_line) + changed = True + else: + new_lines.append(line) + if changed: + with open(filepath, 'w', encoding='utf-8') as f: + f.writelines(new_lines) + print(f"Converted: {filepath}") + else: + print(f"Skipped (no changes): {filepath}") + +if __name__ == "__main__": + if len(sys.argv) < 2: + print("Usage: python3 lua_converter.py ...") + sys.exit(1) + + for file in sys.argv[1:]: + convert_file(file) diff --git a/home/hypr/hyprland/rules.nix b/home/hypr/hyprland/rules.nix index c86eb86..94f84e1 100644 --- a/home/hypr/hyprland/rules.nix +++ b/home/hypr/hyprland/rules.nix @@ -3,21 +3,21 @@ { wayland.windowManager.hyprland.settings = { windowrule = [ - "float on, match:title ^(Open File)(.*)$" - "center on, match:title ^(Open File)(.*)$" - "float on, match:title ^(Save As)(.*)$" - "center on, match:title ^(Save As)(.*)$" - "float on, match:title ^(File Upload)(.*)$" - "center on, match:title ^(File Upload)(.*)$" - "float on, match:class ^(pavucontrol)$" - "center on, match:class ^(pavucontrol)$" - "size 45% 45%, match:class ^(pavucontrol)$" - "float on, match:title ^([Pp]icture[-\\s]?[Ii]n[-\\s]?[Pp]icture)(.*)$" - "pin on, match:title ^([Pp]icture[-\\s]?[Ii]n[-\\s]?[Pp]icture)(.*)$" - "keep_aspect_ratio on, match:title ^([Pp]icture[-\\s]?[Ii]n[-\\s]?[Pp]icture)(.*)$" - "immediate on, match:class ^(steam_app).*" - "float on, match:class ^(steam)$" - "float off, match:class ^(steam)$, match:title ^(Steam)$" + { _args = [ "float on" "match:title ^(Open File)(.*)$" ]; } + { _args = [ "center on" "match:title ^(Open File)(.*)$" ]; } + { _args = [ "float on" "match:title ^(Save As)(.*)$" ]; } + { _args = [ "center on" "match:title ^(Save As)(.*)$" ]; } + { _args = [ "float on" "match:title ^(File Upload)(.*)$" ]; } + { _args = [ "center on" "match:title ^(File Upload)(.*)$" ]; } + { _args = [ "float on" "match:class ^(pavucontrol)$" ]; } + { _args = [ "center on" "match:class ^(pavucontrol)$" ]; } + { _args = [ "size 45% 45%" "match:class ^(pavucontrol)$" ]; } + { _args = [ "float on" "match:title ^([Pp]icture[-\\s]?[Ii]n[-\\s]?[Pp]icture)(.*)$" ]; } + { _args = [ "pin on" "match:title ^([Pp]icture[-\\s]?[Ii]n[-\\s]?[Pp]icture)(.*)$" ]; } + { _args = [ "keep_aspect_ratio on" "match:title ^([Pp]icture[-\\s]?[Ii]n[-\\s]?[Pp]icture)(.*)$" ]; } + { _args = [ "immediate on" "match:class ^(steam_app).*" ]; } + { _args = [ "float on" "match:class ^(steam)$" ]; } + { _args = [ "float off" "match:class ^(steam)$" "match:title ^(Steam)$" ]; } ]; }; } diff --git a/home/hyprland.nix b/home/hyprland.nix index 6005315..1f7cb47 100644 --- a/home/hyprland.nix +++ b/home/hyprland.nix @@ -9,6 +9,7 @@ wayland.windowManager.hyprland = { enable = true; + configType = "lua"; package = inputs.hyprland.packages.${pkgs.system}.hyprland; xwayland.enable = true; systemd.enable = false;