From d9a26695775a74bfa537e44bb51caf86664118cc Mon Sep 17 00:00:00 2001 From: k Date: Tue, 19 Nov 2024 22:01:50 -0500 Subject: [PATCH] Added Hyprland --- hosts/home/hyprland.nix | 133 +++++++++++++++++++++++++++++++++ hosts/laptop/configuration.nix | 5 ++ 2 files changed, 138 insertions(+) create mode 100644 hosts/home/hyprland.nix diff --git a/hosts/home/hyprland.nix b/hosts/home/hyprland.nix new file mode 100644 index 0000000..2704fe9 --- /dev/null +++ b/hosts/home/hyprland.nix @@ -0,0 +1,133 @@ +{ config, pkgs, inputs, ... }: + +{ + imports = [ ./waybar.nix ./tile.nix ]; + + wayland.windowManager.hyprland = { + enable = true; + systemd.variables = [ "--all" ]; + xwayland.enable = true; + settings = { + exec-once = [ "${pkgs.hyprpaper}/bin/hyprpaper" ]; + monitor = ",preferred,auto,1"; + general = { + "$mainMod" = "SUPER"; + layout = "master"; + "$terminal" = "${pkgs.alacritty}/bin/alacritty"; + "$menu" = "${pkgs.wofi}/bin/wofi --show drun"; + gaps_in = 5; + gaps_out = 10; + border_size = 2; + }; + + decoration = { + rounding = 15; + blur = { + enabled = true; + size = 2; + passes = 2; + brightness = 1; + noise = .3; + new_optimizations = true; + }; + drop_shadow = true; + }; + + misc = { + disable_autoreload = true; + disable_hyprland_logo = true; + always_follow_on_dnd = true; + layers_hog_keyboard_focus = true; + animate_manual_resizes = false; + enable_swallow = true; + focus_on_activate = true; + new_window_takes_over_fullscreen = 2; + middle_click_paste = true; + vfr = true; + }; + + bind = [ + # keybindings + "$mainMod, Return, exec, $terminal" + "$mainMod, D, exec, $menu" + "$mainMod Shift, C, killactive," + "$mainMod, Space, exec, toggle_float" + "$mainMod, Escape, exec, ${pkgs.hyprlock}/bin/hyprlock" + + # switch focus + "$mainMod, left, movefocus, l" + "$mainMod, right, movefocus, r" + "$mainMod, up, movefocus, u" + "$mainMod, down, movefocus, d" + + + # switch workspace + "$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" + + # same as above, but switch to the workspace + "$mainMod SHIFT, 1, movetoworkspacesilent, 1" # movetoworkspacesilent + "$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" + "$mainMod CTRL, c, movetoworkspace, empty" + + # window control + "$mainMod SHIFT, left, movewindow, l" + "$mainMod SHIFT, right, movewindow, r" + "$mainMod SHIFT, up, movewindow, u" + "$mainMod SHIFT, down, movewindow, d" + "$mainMod CTRL, left, resizeactive, -80 0" + "$mainMod CTRL, right, resizeactive, 80 0" + "$mainMod CTRL, up, resizeactive, 0 -80" + "$mainMod CTRL, down, resizeactive, 0 80" + "$mainMod ALT, left, moveactive, -80 0" + "$mainMod ALT, right, moveactive, 80 0" + "$mainMod ALT, up, moveactive, 0 -80" + "$mainMod ALT, down, moveactive, 0 80" + + # media and volume controls + # ",XF86AudioMute,exec, pamixer -t" + ",XF86AudioPlay,exec, playerctl play-pause" + ",XF86AudioNext,exec, playerctl next" + ",XF86AudioPrev,exec, playerctl previous" + ",XF86AudioStop,exec, playerctl stop" + ]; + + bindm = [ + "$mainMod, mouse:272, movewindow" + "$mainMod, mouse:273, resizewindow" + ]; + + windowrule = + [ "float,mpv" "center,mpv" "pin,wofi" "idleinhibit focus,mpv" ]; + + windowrulev2 = [ ]; + }; + }; + + home.sessionVariables = { + MOZ_ENABLE_WAYLAND = "1"; + MOZ_USE_XINPUT2 = "1"; + XDG_SESSION_TYPE = "wayland"; + SDL_VIDEODRIVER = "wayland"; + QT_QPA_PLATFORM = "wayland"; + QT_WAYLAND_DISABLE_WINDOWDECORATION = "1"; + _JAVA_AWT_WM_NONREPARENTING = 1; + }; +} + diff --git a/hosts/laptop/configuration.nix b/hosts/laptop/configuration.nix index c159ec5..60dd225 100644 --- a/hosts/laptop/configuration.nix +++ b/hosts/laptop/configuration.nix @@ -9,6 +9,7 @@ security.rtkit.enable = true; security.polkit.enable = true; security.pam.services.swaylock = {}; + security.pam.services.hyprlock = {}; powerManagement.enable = true; nix = { @@ -93,6 +94,7 @@ steam.enable = true; steam.gamescopeSession.enable = true; gamemode.enable = true; + hyprland.enable = true; }; users.users.k = { @@ -130,7 +132,10 @@ intel-vaapi-driver intel-compute-runtime intel-media-driver + vpl-gpu-rt microcodeIntel + mkl + embree neovim ]; };