nix/modules/home-manager/hyprland.nix

269 lines
9.3 KiB
Nix
Raw Permalink Normal View History

2023-10-05 13:43:28 -05:00
{
2023-11-07 17:09:05 -06:00
outputs,
colors,
config,
2023-11-07 23:55:16 -06:00
lib,
2023-10-05 13:43:28 -05:00
# font,
...
}: {
imports = with outputs.homeManagerModules; [
ewwbar
mako
swaylock
# TODO: figure out how to import this for this module _and_ for the sway module?
# linux-desktop
];
2023-11-07 17:09:05 -06:00
home.file."${config.xdg.configHome}/hypr/hyprpaper.conf" = {
2023-10-05 13:43:28 -05:00
enable = true;
2023-11-07 17:09:05 -06:00
text = ''
preload = ~/.wallpaper
wallpaper = ,~/.wallpaper
'';
};
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
wayland.windowManager.hyprland = {
enable = true;
settings = {
2023-10-05 13:43:28 -05:00
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
2023-11-07 17:09:05 -06:00
monitor = [
# See https://wiki.hyprland.org/Configuring/Monitors/
",preferred,auto,auto"
];
xwayland = {
force_zero_scaling = true;
};
2023-11-07 17:09:05 -06:00
exec-once = [
2023-11-07 21:30:26 -06:00
"hyprpaper"
"mako"
2023-11-07 23:55:16 -06:00
"eww daemon && eww open bar$EWW_BAR_MON"
2023-11-09 16:25:30 -06:00
"firefox"
"kitty --single-instance"
2023-11-12 11:19:33 -06:00
# "wezterm"
2023-11-07 23:55:16 -06:00
(lib.concatStringsSep " " [
"swayidle -w"
2024-01-23 15:10:34 -06:00
"timeout 300 'notify-send \"Idling in 300 seconds\"' resume 'notify-send \"Idling cancelled.\"'"
2023-11-26 16:47:06 -06:00
"timeout 480 'notify-send -u critical \"Idling in 120 seconds\"'"
"timeout 510 'notify-send -u critical \"Idling in 90 seconds\"'"
"timeout 540 'notify-send -u critical \"Idling in 60 seconds!\"'"
"timeout 570 'notify-send -u critical \"Idling in 30 seconds!\"'"
"timeout 590 'notify-send -u critical \"Idling in 10 seconds!\"'"
"timeout 591 'notify-send -u critical \"Idling in 9 seconds!\"'"
"timeout 592 'notify-send -u critical \"Idling in 8 seconds!\"'"
"timeout 593 'notify-send -u critical \"Idling in 7 seconds!\"'"
"timeout 594 'notify-send -u critical \"Idling in 6 seconds!\"'"
"timeout 595 'notify-send -u critical \"Idling in 5 seconds!\"'"
"timeout 596 'notify-send -u critical \"Idling in 4 seconds!\"'"
"timeout 597 'notify-send -u critical \"Idling in 3 seconds!\"'"
"timeout 598 'notify-send -u critical \"Idling in 2 seconds!\"'"
"timeout 599 'notify-send -u critical \"Idling in 1 second!\"'"
"timeout 600 'swaylock --daemonize'"
2024-01-23 15:10:34 -06:00
"timeout 600 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on'"
"after-resume 'maybe-good-morning'"
2023-11-09 15:41:27 -06:00
"before-sleep 'swaylock --daemonize'"
2023-11-07 23:55:16 -06:00
])
2023-11-07 17:09:05 -06:00
''swayidle -w timeout 600 'notify-send "Locking in 30 seconds..."' timeout 630 'swaylock -f' timeout 660 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on && maybe-good-morning' before-sleep 'swaylock -f'"''
"dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
];
env = [
"XCURSOR_SIZE,24"
2023-11-07 23:55:16 -06:00
"EWW_BAR_MON,0"
2023-11-07 17:09:05 -06:00
];
input = {
kb_layout = "us";
kb_options = "ctrl:nocaps";
2023-10-05 13:43:28 -05:00
# kb_variant =
# kb_model =
# kb_rules =
2023-11-07 17:09:05 -06:00
follow_mouse = 2;
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
repeat_delay = 200;
repeat_rate = 60;
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
touchpad = {
natural_scroll = "yes";
tap-to-click = true;
middle_button_emulation = true;
2024-03-25 09:44:55 -05:00
disable_while_typing = false;
2023-11-07 17:09:05 -06:00
};
};
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
misc = {
disable_hyprland_logo = true;
disable_splash_rendering = true;
};
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
binds = {
allow_workspace_cycles = true;
};
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
general = {
2023-10-05 13:43:28 -05:00
# See https://wiki.hyprland.org/Configuring/Variables/ for more
2023-11-07 17:09:05 -06:00
"col.active_border" = "0xff${colors.primary} 0xff${colors.green} 45deg";
"col.inactive_border" = "0xff${colors.fgdim}";
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
gaps_in = 3;
gaps_out = 6;
border_size = 2;
no_cursor_warps = true;
resize_on_border = true;
2023-11-21 10:06:10 -06:00
no_focus_fallback = true;
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
layout = "dwindle";
};
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
decoration = {
rounding = 3;
2023-11-07 21:30:26 -06:00
# blur = "no";
2023-10-05 13:43:28 -05:00
# blur_size = 3
# blur_passes = 1
# blur_new_optimizations = on
2023-11-07 17:09:05 -06:00
drop_shadow = "yes";
shadow_range = 4;
shadow_render_power = 3;
"col.shadow" = "rgba(1a1a1aee)";
dim_inactive = false;
};
"$mainMod" = "SUPER";
bind = [
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
2023-11-12 11:19:33 -06:00
# "$mainMod, return, exec, wezterm"
# "$mainMod SHIFT, return, exec, wezterm"
"$mainMod, return, exec, kitty --single-instance"
"$mainMod SHIFT, return, exec, kitty"
2023-11-07 17:09:05 -06:00
"$mainMod, U, exec, firefox"
"$mainMod, space, exec, wofi --show drun"
"$mainMod, C, killactive,"
"$mainMod, M, exit,"
"$mainMod, E, exec, dolphin"
"$mainMod, F, togglefloating,"
"$mainMod SHIFT, F, fullscreen,"
"$mainMod, R, exec, anyrun"
"$mainMod, S, pseudo, # dwindle"
"$mainMod, P, togglesplit, # dwindle"
# Move focus with mainMod + arrow keys
"$mainMod, left, movefocus, l"
"$mainMod, right, movefocus, r"
"$mainMod, up, movefocus, u"
"$mainMod, down, movefocus, d"
"$mainMod, h, movefocus, l"
"$mainMod, l, movefocus, r"
"$mainMod, k, movefocus, u"
"$mainMod, j, movefocus, d"
"$mainMod SHIFT, H, swapwindow, l"
"$mainMod SHIFT, L, swapwindow, r"
"$mainMod SHIFT, K, swapwindow, u"
"$mainMod SHIFT, J, swapwindow, d"
"$mainMod SHIFT, V, exec, pamixer --default-source --toggle-mute"
2023-11-26 16:47:06 -06:00
"$mainMod, F1, exec, pamixer --default-source --toggle-mute"
2023-11-07 17:09:05 -06:00
", XF86AudioMicMute, exec, pamixer --default-source --toggle-mute"
", XF86AudioMute, exec, pamixer --toggle-mute"
", XF86AudioRaiseVolume, exec, pamixer --increase 5"
", XF86AudioLowerVolume, exec, pamixer --decrease 5"
"CTRL, XF86AudioRaiseVolume, exec, pamixer --increase 1"
"CTRL, XF86AudioLowerVolume, exec, pamixer --decrease 1"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
"$mainMod, tab, workspace, previous"
2024-03-25 09:44:55 -05:00
"ALT, tab, workspace, previous"
2023-11-07 17:09:05 -06:00
# 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"
", XF86MonBrightnessDown, exec, brightnessctl set 10%-"
", XF86MonBrightnessUp, exec, brightnessctl set +10%"
"SHIFT, XF86MonBrightnessDown, exec, brightnessctl set 1%"
"SHIFT, XF86MonBrightnessUp, exec, brightnessctl set 100%"
"CTRL, XF86MonBrightnessDown, exec, brightnessctl set 1%-"
"CTRL, XF86MonBrightnessUp, exec, brightnessctl set +1%"
"$mainMod SHIFT, S, exec, clipshot"
# Scroll through existing workspaces with mainMod + scroll
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
"CTRL SHIFT $mainMod, L, exec, swaylock"
"$mainMod CTRL, space, exec, makoctl dismiss"
"$mainMod SHIFT CTRL, space, exec, makoctl restore"
"$mainMod SHIFT, space, exec, makoctl invoke"
"$mainMod, E, exec, thunar"
];
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = ["$mainMod, mouse:272, movewindow" "$mainMod, mouse:273, resizewindow"];
};
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
extraConfig = ''
2023-10-05 13:43:28 -05:00
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
2023-11-07 17:09:05 -06:00
bezier = overshot, 0.05, 0.9, 0.1, 1.1
# name, onoff, speed, curve, style
animation = global, 1, 2, default
animation = fadeDim, 1, 2, default
animation = windowsOut, 1, 2, default, popin 80%
2023-10-05 13:43:28 -05:00
}
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 = 1
no_gaps_when_only = true
}
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 = on
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
# device:epic-mouse-v1 {
# sensitivity = -0.5
# }
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
2023-11-12 11:19:33 -06:00
# windowrulev2 = float,class:^.*(kitty|firefox|org.wezfurlong.wezterm).*$
2023-10-05 13:43:28 -05:00
'';
};
}