From 6af271a05ee2d2afcd0a37dba532b4b4ae2af3e2 Mon Sep 17 00:00:00 2001 From: jmug Date: Fri, 30 May 2025 22:19:01 -0700 Subject: [PATCH] [Asahi] Add barebones hyprland config. Signed-off-by: jmug --- hosts/asahi/home.nix | 195 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 195 insertions(+) diff --git a/hosts/asahi/home.nix b/hosts/asahi/home.nix index c50d34f..171d48b 100644 --- a/hosts/asahi/home.nix +++ b/hosts/asahi/home.nix @@ -77,6 +77,201 @@ in }; }; + wayland.windowManager.hyprland.enable = true; + wayland.windowManager.hyprland.settings = { + monitor = [ + ",preferred,auto,auto" + "eDP-1,preferred,auto,1.333333" + ]; + + "$terminal" = "ghostty"; + "$fileManager" = "dolphin"; # TODO: Change. + "$menu" = "wofi --show drun"; # TODO: Change. + + env = [ + "XCURSOR_SIZE,24" + "HYPRCURSOR_SIZE,24" + ]; + + general = { + gaps_in = 5; + gaps_out = 20; + + border_size = 2; + + # https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + + # Set to true enable resizing windows by clicking and dragging on borders and gaps + resize_on_border = false; + + # Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on + allow_tearing = false; + + layout = "dwindle"; + }; + + decoration = { + rounding = 10; + rounding_power = 2; + + # Change transparency of focused and unfocused windows + active_opacity = "1.0"; + inactive_opacity = "1.0"; + + shadow = { + enabled = true; + range = 4; + render_power = 3; + color = "rgba(1a1a1aee)"; + }; + + # https://wiki.hyprland.org/Configuring/Variables/#blur + blur = { + enabled = true; + size = 3; + passes = 1; + + vibrancy = "0.1696"; + }; + }; + + animations = { + # enabled = yes, please :) + enabled = "no"; + }; + + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + dwindle = { + pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below + preserve_split = true; # You probably want this + }; + + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + master = { + new_status = "master"; + }; + + # https://wiki.hyprland.org/Configuring/Variables/#misc + misc = { + force_default_wallpaper = 1; # Set to 0 or 1 to disable the anime mascot wallpapers + disable_hyprland_logo = true; # If true disables the random hyprland logo / anime girl background. :( + }; + +# https://wiki.hyprland.org/Configuring/Variables/#input + input = { + kb_layout = "us"; + + follow_mouse = 1; + + sensitivity = 0; # -1.0 - 1.0, 0 means no modification. + + touchpad = { + natural_scroll = true; + tap-to-click = false; + disable_while_typing = true; + }; + }; + + gestures = { + workspace_swipe = false; + }; + + "$mainMod" = "SUPER"; # Sets "Windows" key as main modifier + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + bind = [ + "$mainMod, return, exec, $terminal" + "$mainMod, Q, killactive," + "$mainMod SHIFT, Q, exit," + # "$mainMod, E, exec, $fileManager" + "$mainMod, V, togglefloating," + "$mainMod, R, exec, $menu" + "$mainMod, P, pseudo," # dwindle + "$mainMod, J, togglesplit," # dwindle + + # Move focus with mainMod + arrow keys + "$mainMod, M, movefocus, l" + "$mainMod, I, movefocus, r" + "$mainMod, N, movefocus, d" + "$mainMod, E, movefocus, u" + + # Switch workspaces with mainMod + [0-9] + "$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" + + # Move active window to a workspace with mainMod + SHIFT + [0-9] + "$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" + + # Example special workspace (scratchpad) + "$mainMod, S, togglespecialworkspace, magic" + "$mainMod SHIFT, S, movetoworkspace, special:magic" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + ]; + + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + bindel = [ + # Laptop multimedia keys for volume and LCD brightness + ",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 -e4 -n2 set 5%+" + ",XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-" + ]; + + bindl = [ + # Requires playerctl + " , XF86AudioNext, exec, playerctl next" + " , XF86AudioPause, exec, playerctl play-pause" + " , XF86AudioPlay, exec, playerctl play-pause" + " , XF86AudioPrev, exec, playerctl previous" + ]; + + ############################## + ### WINDOWS AND WORKSPACES ### + ############################## + + # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + # See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules + + # Example windowrule + # windowrule = float,class:^(kitty)$,title:^(kitty)$ + + windowrule = [ + # Ignore maximize requests from apps. You'll probably like this. + "suppressevent maximize, class:.*" + # Fix some dragging issues with XWayland + "nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0" + ]; + }; + programs.zsh.shellAliases = { # TODO: Interpolate the name of the host here. nrsw = "sudo nixos-rebuild switch --flake /home/jmug/nixos#asahi"; # parametrize this as home dir.