nix/modules/home-manager/hyprland.nix

421 lines
12 KiB
Nix
Raw Normal View History

2023-10-05 13:43:28 -05:00
{
2024-03-27 09:36:04 -05:00
pkgs,
2024-11-24 16:44:17 -06:00
style,
2023-11-07 17:09:05 -06:00
config,
2023-11-07 23:55:16 -06:00
lib,
2023-10-05 13:43:28 -05:00
# font,
...
2024-11-24 16:44:17 -06:00
}: let
inherit (style) colors;
in {
2024-12-21 17:10:45 -06:00
# TODO: Hyprland seems to sometimes use a ton of CPU?
2024-03-29 10:15:54 -05:00
2024-03-27 09:36:04 -05:00
home.packages = with pkgs; [
swayosd
];
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"
2024-09-12 11:22:43 -05:00
"mako"
2024-03-27 10:38:30 -05:00
"swayosd-server"
"eww daemon"
"[workspace 1 silent] firefox"
"[workspace 1 silent] wezterm"
2024-03-27 10:38:30 -05:00
"xwaylandvideobridge"
"systemctl --user import-environment QT_QPA_PLATFORMTHEME"
2024-12-21 17:10:45 -06:00
"hypridle"
2023-11-07 17:09:05 -06:00
];
env = [
"XCURSOR_SIZE,24"
];
input = {
kb_layout = "us";
kb_options = "ctrl:nocaps";
2024-09-12 11:58:24 -05:00
/*
kb_variant =
kb_model =
kb_rules =
*/
2023-10-05 13:43:28 -05:00
2023-11-07 17:09:05 -06:00
follow_mouse = 2;
2023-10-05 13:43:28 -05:00
2024-12-02 13:27:49 -06:00
repeat_delay = 180;
repeat_rate = 120;
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
2024-11-24 16:44:17 -06:00
cursor = {
no_warps = true;
};
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;
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 = {
2024-12-21 17:10:45 -06:00
rounding = 5;
2024-09-12 11:58:24 -05:00
/*
blur = "no";
blur_size = 3
blur_passes = 1
blur_new_optimizations = on
*/
2023-10-05 13:43:28 -05:00
2024-11-24 16:44:17 -06:00
shadow = {
enabled = true;
color = "rgba(1a1a1aee)";
range = 4;
render_power = 3;
};
2023-11-07 17:09:05 -06:00
dim_inactive = false;
};
2024-03-27 10:38:30 -05:00
"$mod" = "SUPER";
2023-11-07 17:09:05 -06:00
bind = [
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
2024-09-12 11:58:24 -05:00
/*
"$mod, return, exec, wezterm"
"$mod SHIFT, return, exec, wezterm"
*/
2024-03-27 10:38:30 -05:00
"$mod, return, exec, wezterm"
"$mod SHIFT, return, exec, kitty"
"$mod, U, exec, firefox"
"$mod, space, exec, tofi-run | xargs hyprctl dispatch exec --"
"$mod, C, killactive,"
"$mod SHIFT, E, exit,"
"$mod, E, exec, dolphin"
"$mod, F, togglefloating,"
"$mod SHIFT, F, fullscreen,"
"$mod, R, exec, anyrun"
"$mod, S, pseudo, # dwindle"
"$mod, P, togglesplit, # dwindle"
# Move focus with mod + arrow keys
"$mod, left, movefocus, l"
"$mod, right, movefocus, r"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
"$mod, h, movefocus, l"
"$mod, l, movefocus, r"
"$mod, k, movefocus, u"
"$mod, j, movefocus, d"
"$mod SHIFT, H, movewindow, l"
"$mod SHIFT, L, movewindow, r"
"$mod SHIFT, K, movewindow, u"
"$mod SHIFT, J, movewindow, d"
2024-03-27 10:38:30 -05:00
"$mod SHIFT, V, exec, swayosd-client --input-volume mute-toggle"
", XF86AudioMicMute, exec, swayosd-client --input-volume mute-toggle"
", XF86AudioMute, exec, swayosd-client --output-volume mute-toggle"
", XF86AudioRaiseVolume, exec, swayosd-client --output-volume raise"
", XF86AudioLowerVolume, exec, swayosd-client --output-volume lower"
", XF86MonBrightnessUp, exec, swayosd-client --brightness raise"
", XF86MonBrightnessDown, exec, swayosd-client --brightness lower"
2023-11-07 17:09:05 -06:00
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
2024-03-27 13:06:50 -05:00
2024-03-27 10:38:30 -05:00
"$mod, tab, workspace, previous"
2024-03-25 09:44:55 -05:00
"ALT, tab, workspace, previous"
2023-11-07 17:09:05 -06:00
2024-03-27 10:38:30 -05:00
# Switch workspaces with mod + [0-9]
"$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"
# Move active window to a workspace with mod + SHIFT + [0-9]
"$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, S, exec, clipshot"
# Scroll through existing workspaces with mod + scroll
"$mod, mouse_down, workspace, e+1"
"$mod, mouse_up, workspace, e-1"
2024-12-21 17:10:45 -06:00
"CTRL SHIFT $mod, L, exec, hyprlock"
2024-03-27 10:38:30 -05:00
"$mod CTRL, space, exec, makoctl dismiss"
"$mod SHIFT CTRL, space, exec, makoctl restore"
"$mod SHIFT, space, exec, makoctl invoke default"
2024-03-27 10:38:30 -05:00
"$mod, E, exec, thunar"
2023-11-07 17:09:05 -06:00
];
2023-10-05 13:43:28 -05:00
2024-03-27 10:38:30 -05:00
# Move/resize windows with mod + LMB/RMB and dragging
bindm = ["$mod, mouse:272, movewindow" "$mod, mouse:273, resizewindow"];
2023-11-07 17:09:05 -06:00
};
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
2024-03-27 10:38:30 -05:00
# master switch for pseudotiling. Enabling is bound to mod + P in the keybinds section below
2023-10-05 13:43:28 -05:00
pseudotile = yes
preserve_split = 1
2024-11-24 16:44:17 -06:00
# no_gaps_when_only = true
2023-10-05 13:43:28 -05:00
}
master {
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
2024-11-24 16:44:17 -06:00
# new_is_master = true
2023-10-05 13:43:28 -05:00
}
gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = on
}
2024-09-12 11:58:24 -05:00
## Example per-device config
## See https://wiki.hyprland.org/Configuring/Keywords/#executing for more
## device:epic-mouse-v1 {
## sensitivity = -0.5
## }
2023-10-05 13:43:28 -05:00
2024-09-12 11:58:24 -05:00
## See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
windowrulev2 = idleinhibit,class:^.*([Ss]lippi).*$
windowrulev2 = float,class:^.*$
windowrulev2 = tile,class:^.*([Kk]itty|[Ff]irefox|[Ww]ezterm|[Dd]iscord|[Ss]potify|[Ss]lack).*$
windowrulev2 = opacity 1.0 0.95,class:^.*$
2024-12-20 14:08:02 -06:00
windowrulev2 = center 1,floating:1
2024-12-20 10:40:28 -06:00
windowrulev2 = opacity 0.0 override, class:^(xwaylandvideobridge)$
windowrulev2 = noanim, class:^(xwaylandvideobridge)$
windowrulev2 = noinitialfocus, class:^(xwaylandvideobridge)$
windowrulev2 = maxsize 1 1, class:^(xwaylandvideobridge)$
windowrulev2 = noblur, class:^(xwaylandvideobridge)$
windowrulev2 = nofocus, class:^(xwaylandvideobridge)$
2023-10-05 13:43:28 -05:00
'';
};
2024-12-21 17:10:45 -06:00
programs.hyprlock = {
enable = true;
settings = {
# docs: https://wiki.hyprland.org/Hypr-Ecosystem/hyprlock
general = {
grace = 0;
no_face_out = true;
};
input-field = [
{
monitor = "";
fade_on_empty = false;
placeholder_text = "Locked";
rounding = 5;
font_size = 20;
font_color = "rgba(255, 255, 255, 1.0)";
inner_color = "rgba(31, 31, 47, 0.95)";
outer_color = "0xff74c7ec 0xff74c7ec 45deg";
outline_thickness = 3;
position = "0, -200";
dots_size = 0.1;
size = "300 75";
font_family = "IosevkaLyteTerm";
shadow_passes = 3;
shadow_size = 8;
shadow_color = "rgba(0, 0, 0, 1.0)";
shadow_boost = 0.8;
}
];
background = [
{
path = "~/.wallpaper";
blur_passes = 2;
}
];
label = [
{
monitor = "";
font_size = 64;
halign = "center";
valign = "center";
text_align = "center";
# rotate = 10;
position = "0, 200";
font_family = "IosevkaLyteTerm";
text = ''Locked for <span foreground="##74c7ec">$USER</span>'';
shadow_passes = 1;
shadow_size = 8;
shadow_color = "rgba(0, 0, 0, 1.0)";
shadow_boost = 0.5;
}
{
monitor = "";
font_size = 20;
halign = "center";
valign = "center";
text_align = "center";
color = "rgba(255, 255, 255, 0.5)";
position = "0 120";
font_family = "IosevkaLyteTerm";
text = "cmd[update:1000] date '+%a %b %d %H:%M:%S'";
shadow_passes = 3;
shadow_size = 1;
shadow_color = "rgba(0, 0, 0, 1.0)";
shadow_boost = 1.0;
}
{
monitor = "";
font_size = 200;
halign = "center";
valign = "center";
text_align = "center";
color = "rgba(220, 240, 255, 0.8)";
position = "0 500";
font_family = "NerdFontSymbolsOnly";
text = "󰍁";
shadow_passes = 3;
shadow_size = 1;
shadow_color = "rgba(0, 0, 0, 1.0)";
shadow_boost = 1.0;
}
];
};
};
services.hypridle = let
secondsPerMinute = 60;
lockSeconds = 10 * secondsPerMinute;
in {
enable = true;
settings = {
general = {
after_sleep_cmd = "hyprctl dispatch dpms on";
before_sleep_cmd = "loginctl lock-session";
ignore_dbus_inhibit = false;
lock_cmd = "pidof hyprlock || hyprlock";
};
listener = [
{
timeout = lockSeconds - 300;
on-timeout = ''notify-send "Auto-locking in 5 minutes"'';
on-resume = ''notify-send "Auto-locking cancelled"'';
}
{
timeout = lockSeconds - 180;
on-timeout = ''notify-send "Auto-locking in 3 minutes"'';
}
{
timeout = lockSeconds - 120;
on-timeout = ''notify-send "Auto-locking in 2 minutes"'';
}
{
timeout = lockSeconds - 60;
on-timeout = ''notify-send "Auto-locking in 1 minute"'';
}
{
timeout = lockSeconds - 30;
on-timeout = ''notify-send "Auto-locking in 30 seconds"'';
}
{
timeout = lockSeconds - 10;
on-timeout = ''notify-send -u critical "Auto-locking in 10 seconds"'';
}
{
timeout = lockSeconds;
on-timeout = ''loginctl lock-session'';
}
{
timeout = lockSeconds + 5;
on-timeout = ''hyprctl dispatch dpms off'';
on-resume = ''hyprctl dispatch dpms on'';
}
];
};
};
2023-10-05 13:43:28 -05:00
}