From f50ce8853f2336cdb1b351a2234b6ee842606792 Mon Sep 17 00:00:00 2001 From: Gene Liverman Date: Fri, 15 Sep 2023 21:46:19 -0400 Subject: [PATCH] Migrate Hyprland config to Home Manager --- modules/home-manager/nixos.nix | 188 +++++++++++++++++++++++++++++++++ 1 file changed, 188 insertions(+) diff --git a/modules/home-manager/nixos.nix b/modules/home-manager/nixos.nix index ee7d36d..1823229 100644 --- a/modules/home-manager/nixos.nix +++ b/modules/home-manager/nixos.nix @@ -1,9 +1,17 @@ { pkgs, ... }: { + home.file.".config/hypr/frappe.conf".source = (pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "hyprland"; + rev = "99a88fd21fac270bd999d4a26cf0f4a4222c58be"; + hash = "sha256-07B5QmQmsUKYf38oWU3+2C6KO4JvinuTwmW1Pfk8CT8="; + } + "/themes/frappe.conf"); + programs = { waybar = { enable = true; }; }; + services.dunst = { enable = true; settings = { @@ -29,5 +37,185 @@ }; }; }; + + wayland.windowManager.hyprland = { + enable = true; + settings = { + # Catppuccin Theme + source = "~/.config/hypr/frappe.conf"; + + # See https://wiki.hyprland.org/Configuring/Monitors/ + monitor = ",preferred,auto,auto"; + + exec-once = [ + "waybar & dunst & ulauncher" + + # start polkit-kde-agent + "/nix/store/$(ls -la /nix/store | grep polkit-kde-agent | grep '^d' | awk '{print $9}')/libexec/polkit-kde-authentication-agent-1" + ]; + + # Some default env vars. + env = "XCURSOR_SIZE,24"; + + input = { + follow_mouse = 1; + + kb_layout = "us"; + kb_variant = ""; + kb_model = ""; + kb_options = ""; + kb_rules = ""; + + touchpad = { + natural_scroll = "no"; + }; + + # -1.0 - 1.0, 0 means no modification. + sensitivity = 0; + }; + + general = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + border_size = 2; + "col.active_border" = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + "col.inactive_border" = "rgba(595959aa)"; + gaps_in = 5; + gaps_out = 20; + layout = "dwindle"; + }; + + decoration = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + blur = { + enabled = true; + size = 3; + passes = 1; + }; + "col.shadow" = "rgba(1a1a1aee)"; + drop_shadow = "yes"; + rounding = 10; + shadow_range = 4; + shadow_render_power = 3; + }; + + animations = { + enabled = "yes"; + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = "myBezier, 0.05, 0.9, 0.1, 1.05"; + + animation = [ + "windows, 1, 7, myBezier" + "windowsOut, 1, 7, default, popin 80%" + "border, 1, 10, default" + "borderangle, 1, 8, default" + "fade, 1, 7, default" + "workspaces, 1, 6, default" + ]; + }; + + dwindle = { + # See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more + + # master switch for pseudotiling. + # Enabling is bound to mainMod + P in the keybinds section below + pseudotile = "yes"; + + preserve_split = "yes"; # you probably want this + }; + + master = { + # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more + new_is_master = true; + }; + + gestures = { + # See https://wiki.hyprland.org/Configuring/Variables/ for more + workspace_swipe = "off"; + }; + + # Example per-device config + # See https://wiki.hyprland.org/Configuring/Keywords/#executing for more + "device:epic-mouse-v1" = { + sensitivity = "-0.5"; + }; + + # Example windowrule v1 + # windowrule = float, ^(kitty)$ + # Example windowrule v2 + # windowrulev2 = float,class:^(kitty)$,title:^(kitty)$ + # See https://wiki.hyprland.org/Configuring/Window-Rules/ for more + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + "$mainMod" = "SUPER"; + + # Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more + bind = [ + "$mainMod, T, exec, tilix" + "$mainMod, Return, exec, xfce4-terminal" + "$mainMod, F, exec, firefox" + "$mainMod, S, exec, slack" + "$mainMod, C, killactive," + "$mainMod, M, exit," + "$mainMod, E, exec, nautilus" + "$mainMod, V, togglefloating," + "$mainMod, space, exec, ulauncher-toggle" + "$mainMod, P, pseudo," # dwindle + "$mainMod, J, togglesplit," # dwindle + + # Move focus with mainMod + arrow keys + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + # 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" + + # Scroll through existing workspaces with mainMod + scroll + "$mainMod, mouse_down, workspace, e+1" + "$mainMod, mouse_up, workspace, e-1" + + # Laptop keys along the top + ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" + ", XF86MonBrightnessUp, exec, brightnessctl set +5%" + ", XF86MonBrightnessDown, exec, brightnessctl set 5%-" + ]; + + binde = [ + # Example volume button that allows press and hold, volume limited to 100% + ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+" + ", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-" + ]; + + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; # end settings + }; # end hyprland }