nix/homes/modules/wm/hyprland/hyprland.nix

312 lines
9.6 KiB
Nix

{...}: {
wayland.windowManager.hyprland = {
enable = true;
package = null;
portalPackage = null;
plugins = [
#inputs.hyprland-plugins.packages.${pkgs.stdenv.hostPlatform.system}.hyprscrolling
];
xwayland.enable = true;
extraConfig = ''
source = ./colors.conf
source = ./theme.conf
source = ./windowrules.conf
source = ./keybinds/virtual.conf
'';
settings = {
# shorthand command keywords
"$mod" = "SUPER";
# applications
"$terminal" = "kitty";
"$explorer" = "kitty -e yazi";
"$browser" = "zen-twilight";
# menu
"$menu" = "rofi";
# startup programs
exec-once = [
"waybar"
"awww-daemon"
"wl-paste --type text --watch cliphist store"
"wl-paste --type image --watch cliphist store"
"wl-clip-persist --clipboard regular"
"playerctld daemon"
# swaps around the 3rd and 4th workspace because they always start
# in the wrong order
"hyprctl dispatch workspace 4 && hyprctl dispatch workspace 5 && hyprctl dispatch workspace 3 && hyprctl dispatch workspace 4 && hyprctl dispatch workspace 5 && hyprctl dispatch workspace 3 && hyprctl dispatch workspace 1"
];
# monitor configuration
monitor = [
# note: display stream compression pending for open source
# amd gpu driver and my monitor (VG279QM) only supports DP 1.2
# so no >240hz atm
"DP-2, 1920x1080@239.76, 0x0, 1" # main monitor
"DP-3, 1920x1080@143.61, 1920x0, 1" # second monitor
"HDMI-A-2, 2560x1440@59.95, 3840x0, 1" # third monitor (drawing tablet)
"HDMI-A-1, 1920x1080@60.00, -1920x0, 1" # tv
];
general = {
gaps_in = 5;
gaps_out = "0, 10, 10, 10";
border_size = 2;
layout = "dwindle";
};
plugin = {
# options at https://github.com/hyprwm/hyprland-plugins/tree/main/hyprscrolling
hyprscrolling = {
fullscreen_on_one_column = false;
column_width = 1.0;
};
};
dwindle = {
preserve_split = true;
};
decoration = {
rounding = 8;
active_opacity = 1.00;
inactive_opacity = 1.00;
blur = {
xray = true;
size = 6;
passes = 2;
#vibrancy = 0.3;
special = true;
};
};
bezier = [
"workspace_curve, 0.56,0.19,0.24,0.58"
"workspace_in_curve, 0.56,0.19,0.56,0.99"
];
animation = [
#"workspaces, 1, 1.94, workspace_in_curve, slide"
#"workspacesIn, 1, 1.21, workspace_in_curve, slide"
#"workspacesOut, 1, 1.94, workspace_in_curve, slide"
];
input = {
repeat_rate = 50;
repeat_delay = 300;
sensitivity = 0; # 0 = no modification
accel_profile = "flat";
force_no_accel = false; # not recommended to turn on
};
cursor.no_hardware_cursors = true;
misc = {
enable_anr_dialog = false;
font_family = "DepartureMono Nerd Font";
};
# bindings
bind = [
# binds for applications
"$mod, t, exec, $terminal"
"$mod, r, exec, $browser"
"$mod, e, exec, $explorer"
# binds for rofi
"$mod, d, exec, pkill -x rofi || rofi -show drun -show-icons"
"alt, tab, exec, pkill -x rofi || rofi -modi window -show window -show-icons"
"$mod, v, exec, pkill -x rofi || cliphist list | rofi -dmenu | cliphist decode | wl-copy"
# screenshots
# todo: add active monitor
"$mod, s, exec, grim -g \"\$(slurp -d)\" - | wl-copy" # region
"$mod+alt, s, exec, grim -g \"\$(slurp -o)\" - | wl-copy" # monitor
"$mod+ctrl, s, exec, grim - | wl-copy" # all monitors
# hyprpicker
"$mod, n, exec, hyprpicker -v"
# hyprlock
"$mod+alt, y, exec, hyprlock"
# task manager
"$mod+ctrl, escape, exec, task-manager.sh"
"$mod+ctrl, grave, exec, task-manager.sh"
# media binds (more in binde below)
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
"Shift_R, XF86AudioPlay, exec, playerctl shuffle toggle"
"Shift_R, XF86AudioNext, exec, playerctl loop track"
# manage windows / session
"$mod+alt, c, killactive"
"$mod, f, fullscreen"
"$mod, x, togglefloating"
"$mod, i, togglesplit"
"$mod+Alt, Delete, exit" # exit hyprland
# move focus
"$mod, h, movefocus, l"
"$mod, j, movefocus, d"
"$mod, k, movefocus, u"
"$mod, l, movefocus, r"
# move window
"$mod+alt, h, movewindow, l"
"$mod+alt, j, movewindow, d"
"$mod+alt, k, movewindow, u"
"$mod+alt, l, movewindow, r"
# swap window
"$mod+ctrl, h, swapwindow, l"
"$mod+ctrl, j, swapwindow, d"
"$mod+ctrl, k, swapwindow, u"
"$mod+ctrl, l, swapwindow, r"
# move column (hyprscrolling)
"$mod, period, layoutmsg, move +col"
"$mod, comma, layoutmsg, move -col"
# focus monitor
#"$mod+Ctrl+Tab, 1, focusmonitor, DP-2"
#"$mod+Ctrl+Tab, 2, focusmonitor, DP-3"
#"$mod+Ctrl+Tab, 3, focusmonitor, HDMI-A-2"
#"$mod+Ctrl+Tab, 4, focusmonitor, HDMI-A-1"
# move workspace to monitor
#"$mod+Tab, 1, movecurrentworkspacetomonitor, DP-2"
#"$mod+Tab, 2, movecurrentworkspacetomonitor, DP-3"
#"$mod+Tab, 3, movecurrentworkspacetomonitor, HDMI-A-2"
#"$mod+Tab, 4, movecurrentworkspacetomonitor, HDMI-A-1"
# special workspace
"$mod, escape, togglespecialworkspace"
"$mod+shift, escape, movetoworkspace, special"
"$mod+alt, escape, movetoworkspacesilent, special"
"$mod, grave, togglespecialworkspace"
"$mod+shift, grave, movetoworkspace, special"
"$mod+alt, grave, movetoworkspacesilent, special"
# switch workspaces
"$mod, 1, workspace, 1"
"$mod, 2, workspace, 2"
"$mod, 3, workspace, 3"
"$mod, 4, workspace, 4"
"$mod, 5, workspace, 5"
"$mod, 6, workspace, 6"
"$mod, 7, workspace, 7"
"$mod, 8, workspace, 8"
"$mod, 9, workspace, 9"
"$mod, 0, workspace, 10"
"$mod, minus, workspace, 11"
"$mod, equal, workspace, 12"
# move focused window to workspace
"$mod+shift, 1, movetoworkspace, 1"
"$mod+shift, 2, movetoworkspace, 2"
"$mod+shift, 3, movetoworkspace, 3"
"$mod+shift, 4, movetoworkspace, 4"
"$mod+shift, 5, movetoworkspace, 5"
"$mod+shift, 6, movetoworkspace, 6"
"$mod+shift, 7, movetoworkspace, 7"
"$mod+shift, 8, movetoworkspace, 8"
"$mod+shift, 9, movetoworkspace, 9"
"$mod+shift, 0, movetoworkspace, 10"
"$mod+shift, minus, movetoworkspace, 11"
"$mod+shift, equal, movetoworkspace, 12"
# move focused window to workspace silently
"$mod+alt, 1, movetoworkspacesilent, 1"
"$mod+alt, 2, movetoworkspacesilent, 2"
"$mod+alt, 3, movetoworkspacesilent, 3"
"$mod+alt, 4, movetoworkspacesilent, 4"
"$mod+alt, 5, movetoworkspacesilent, 5"
"$mod+alt, 6, movetoworkspacesilent, 6"
"$mod+alt, 7, movetoworkspacesilent, 7"
"$mod+alt, 8, movetoworkspacesilent, 8"
"$mod+alt, 9, movetoworkspacesilent, 9"
"$mod+alt, 0, movetoworkspacesilent, 10"
"$mod+alt, minus, movetoworkspacesilent, 11"
"$mod+alt, equal, movetoworkspacesilent, 12"
# move current workspace to monitor
"$mod+shift+alt, 1, movecurrentworkspacetomonitor, DP-2"
"$mod+shift+alt, 2, movecurrentworkspacetomonitor, DP-3"
"$mod+shift+alt, 3, movecurrentworkspacetomonitor, HDMI-A-2"
"$mod+shift+alt, 4, movecurrentworkspacetomonitor, HDMI-A-1"
];
# bindings for mouse
bindm = [
"$mod, mouse:272, movewindow" # left click
"$mod, mouse:273, resizewindow" # right click
];
# repeating binds, repeats when held
binde = [
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%-"
"Shift_R, XF86AudioRaiseVolume, exec, playerctl volume 0.05+"
"Shift_R, XF86AudioLowerVolume, exec, playerctl volume 0.05-"
# resize window
# variable for `resizeactive` is (x, y)
# starting at 0, 0 in the top left
# meaning:
# -x = left
# +x = right
# -y = up
# +y = down
"$mod+ctrl+shift, h, resizeactive, -10 0"
"$mod+ctrl+shift, j, resizeactive, 0 10"
"$mod+ctrl+shift, k, resizeactive, 0 -10"
"$mod+ctrl+shift, l, resizeactive, 10 0"
];
layerrule = [
#"blur, aurorashell"
#"ignorealpha 0.7, aurorashell"
"blur on, match:namespace waybar"
"ignore_alpha 0, match:namespace waybar"
"blur on, match:namespace rofi"
"xray on, match:namespace rofi"
"ignore_alpha 0, match:namespace rofi"
];
env = [
"EDITOR,auravim"
"XCURSOR_THEME,Bunny (Icy) and Strawberries"
"XCURSOR_SIZE,24"
"HYPRCURSOR_THEME,Bunny (Icy) and Strawberries"
"HYPRCURSOR_SIZE,24"
"QT_QPA_PLATFORM,wayland"
];
};
};
# extra hyprland config for organisation,
# and to load colors.conf
# writes ./hypr to ~/.config/hypr
xdg.configFile."hypr" = {
recursive = true;
source = ./hypr;
};
}