From 7466262972b620db8b107df0ecd34238bc5dff84 Mon Sep 17 00:00:00 2001 From: Patrick Neff Date: Thu, 26 Sep 2024 21:54:24 +0200 Subject: [PATCH] add hyprland --- .../home-manager/desktop/hyprland/default.nix | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 modules/home-manager/desktop/hyprland/default.nix diff --git a/modules/home-manager/desktop/hyprland/default.nix b/modules/home-manager/desktop/hyprland/default.nix new file mode 100644 index 0000000..9e53d1d --- /dev/null +++ b/modules/home-manager/desktop/hyprland/default.nix @@ -0,0 +1,166 @@ +{ lib, config, ... }: { + options = { + desktop = { + hyprland = { + enable = lib.mkEnableOption "Hyprland"; + }; + }; + }; + + config = { + wayland.windowManager.hyprland = lib.mkIf config.desktop.awesome.enable { + enable = true; + xwayland.enable = true; + settings = { + #source = [ "~/.config/hypr/themes/catppuccin/mocha.conf" "~/.config/hypr/monitors.conf" ]; + + env = [ + "LIBVA_DRIVER_NAME,nvidia" + "XDG_SESSION_TYPE,wayland" + "GBM_BACKEND,nvidia-drm" + "__GLX_VENDOR_LIBRARY_NAME,nvidia" + ]; + + cursor = { + no_hardware_cursors = true; + }; + + input = { + kb_layout = "de"; + kb_variant = "nodeadkeys"; + follow_mouse = 1; + numlock_by_default = 1; + + touchpad = { + natural_scroll = false; + }; + + sensitivity = 0; + accel_profile = "flat"; + force_no_accel = true; + }; + + general = { + gaps_in = 3; + gaps_out = 6; + border_size = 2; + col.active_border = "0xaa$blueAlpha"; + col.inactive_border = "0xaa$surface0Alpha"; + layout = "dwindle"; + }; + + decoration = { + rounding = 3; + }; + + animations = { + enabled = true; + bezier = "easyInCubic, 0.32, 0, 0.67, 0"; + animation = [ + "windows, 1, 1.125, easyInCubic" + "windowsOut, 1, 1.125, easyInCubic, popin 80%" + "fade, 1, 1.125, easyInCubic" + "workspaces, 1, 1.125, easyInCubic" + ]; + }; + + dwindle = { + pseudotile = true; + preserve_split = true; + default_split_ratio = 1; + }; + + master = { + new_is_master = true; + }; + + gestures = { + workspace_swipe = false; + }; + + + # See https://wiki.hyprland.org/Configuring/Keywords/ for more + "$mainMod" = "SUPER"; + "$term" = "kitty"; + "$browser" = "firefox"; + "$filemanager" = "thunar"; + "$launcher" = "wofi -bt kitty --show drun"; + + bind = [ + "$mainMod, return, exec, $term" + "$mainMod, W, exec, $browser" + "$mainMod SHIFT, Q, exit," + "$mainMod, Q, killactive," + "$mainMod, F, togglefloating," + "$mainMod SHIFT, F, fullscreen," + "$mainMod, P, pseudo, # dwindle" + "$mainMod, N, togglesplit, # dwindle" + + # Launchers + "$mainMod, E, exec, $filemanager" + "$mainMod, R, exec, $launcher" + "$mainMod, O, exec, wofi-emoji" + "$mainMod SHIFT, X, exec, eww open powermenu" + "$mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy" + + # Move focus with mainMod + arrow keys + "ALT, Tab, cyclenext," + "ALT, Tab, bringactivetotop," + "$mainMod, H, movefocus, l" + "$mainMod, L, movefocus, r" + "$mainMod, K, movefocus, u" + "$mainMod, J, movefocus, d" + "$mainMod SHIFT, H, movewindow, l" + "$mainMod SHIFT, L, movewindow, r" + "$mainMod SHIFT, K, movewindow, u" + "$mainMod SHIFT, J, movewindow, d" + "$mainMod CONTROL, H, resizeactive, -50 0" + "$mainMod CONTROL, L, resizeactive, 50 0" + "$mainMod CONTROL, K, resizeactive, 0 -50" + "$mainMod CONTROL, J, resizeactive, 0 50" + + # 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, movetoworkspacesilent, 1" + "$mainMod SHIFT, 2, movetoworkspacesilent, 2" + "$mainMod SHIFT, 3, movetoworkspacesilent, 3" + "$mainMod SHIFT, 4, movetoworkspacesilent, 4" + "$mainMod SHIFT, 5, movetoworkspacesilent, 5" + "$mainMod SHIFT, 6, movetoworkspacesilent, 6" + "$mainMod SHIFT, 7, movetoworkspacesilent, 7" + "$mainMod SHIFT, 8, movetoworkspacesilent, 8" + "$mainMod SHIFT, 9, movetoworkspacesilent, 9" + "$mainMod SHIFT, 0, movetoworkspacesilent, 10" + + # Volume + ",XF86AudioRaiseVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ +5%" + ",XF86AudioLowerVolume, exec, pactl set-sink-volume @DEFAULT_SINK@ -5%" + ",XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle" + + # Playback controls + ",XF86AudioPlay, exec, playerctl play-pause" + ",XF86AudioStop, exec, playerctl stop" + ",XF86AudioNext, exec, playerctl next" + ",XF86AudioPrev, exec, playerctl previous" + ]; + + bindm = [ + # Move/resize windows with mainMod + LMB/RMB and dragging + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + }; + }; + }; +}