nixify: hyprland & kitty

This commit is contained in:
js0ny 2025-11-22 18:43:51 +00:00
parent db78fc2289
commit f56fa1259c
22 changed files with 449 additions and 29 deletions

View file

@ -0,0 +1,137 @@
{pkgs, ...}: {
home.packages = with pkgs; [
grimblast
];
imports = [
../packages.nix
./keymaps.nix
./window-rules.nix
];
wayland.windowManager.hyprland = {
enable = true;
portalPackage = pkgs.xdg-desktop-portal-hyprland;
systemd.enableXdgAutostart = true;
xwayland.enable = true;
# extraConfig = ''
# source=~/.config/hypr/debug.conf
# '';
settings = {
ecosystem = {
no_update_news = true;
};
exec-once = [
"waybar"
"dunst"
"${pkgs.hyprpolkitagent}/libexec/hyprpolkitagent"
];
general = {
gaps_in = 0;
gaps_out = 0;
border_size = 5;
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
"col.active_border" = "$lavender $pink 45deg";
"col.inactive_border" = "$overlay1";
# Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = true;
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false;
layout = "dwindle";
no_border_on_floating = false;
};
xwayland = {
force_zero_scaling = true;
};
input = {
follow_mouse = 1;
sensitivity = 0; # -1.0 - 1.0, 0 means no modification.
touchpad = {
natural_scroll = true;
scroll_factor = 0.2;
};
};
misc = {
force_default_wallpaper = -1;
disable_hyprland_logo = true;
};
dwindle = {
pseudotile = true; # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true; # You probably want this
};
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master = {
new_status = "slave";
};
animations = {
enabled = true;
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = [
"easeOutQuint,0.23,1,0.32,1"
"easeInOutCubic,0.65,0.05,0.36,1"
"linear,0,0,1,1"
"almostLinear,0.5,0.5,0.75,1.0"
"quick,0.15,0,0.1,1"
];
animation = [
"global, 1, 10, default"
"border, 1, 5.39, easeOutQuint"
"windows, 1, 4.79, easeOutQuint"
"windowsIn, 1, 4.1, easeOutQuint, popin 87%"
# "windowsIn, 1, 4.1, easeOutQuint, popin 87%"
"windowsOut, 1, 1.49, linear, popin 87%"
"fadeIn, 1, 1.73, almostLinear"
"fadeOut, 1, 1.46, almostLinear"
"fade, 1, 3.03, quick"
"layers, 1, 3.81, easeOutQuint"
"layersIn, 1, 4, easeOutQuint, fade"
"layersOut, 1, 1.5, linear, fade"
"fadeLayersIn, 1, 1.79, almostLinear"
"fadeLayersOut, 1, 1.39, almostLinear"
"workspaces, 1, 1.94, almostLinear, slide"
"workspacesIn, 1, 1.21, almostLinear, fade"
"workspacesOut, 1, 1.94, almostLinear, fade"
"specialWorkspace, 1, 1.94, almostLinear, fade"
];
};
decoration = {
rounding = 20;
# Change transparency of focused and unfocused windows
# active_opacity = 1
# inactive_opacity = 0.9
active_opacity = 0.9;
inactive_opacity = 0.85;
shadow = {
enabled = true;
range = 4;
render_power = 3;
color = "$base";
};
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur = {
enabled = true;
size = 10;
passes = 2;
vibrancy = 0.1696;
};
};
};
};
}

View file

@ -0,0 +1,101 @@
{config, ...}: let
term = config.currentUser.defaultTerminal;
termRunner = config.currentUser.defaultTerminalRunner;
iconTheme = config.currentUser.iconTheme;
explorer = config.currentUser.defaultExplorer;
explorerTerm = config.currentUser.defaultTerminalExplorer;
launcher = "rofi";
kbdBacklightDev = config.currentHost.keyboardBacklightDevice;
kbdBacklightStep = config.currentHost.keyboardBacklightStep;
mainMod = "SUPER";
screenshotPath = "$HOME/Pictures/Screenshots/\"$(%Y-%m-%d_%H-%M-%S.png)\"";
in {
wayland.windowManager.hyprland.settings = {
"$mainMod" = "${mainMod}";
bind = [
"$mainMod, return, exec, ${term}"
"$mainMod, Q, killactive"
''$mainMod SHIFT, F, exec, hyprctl --batch "dispatch togglefloating ; dispatch resizeactive exact 1440 810 ; dispatch centerwindow 1;"''
"$mainMod SHIFT, M, fullscreen"
"$mainMod, W, exec, ${launcher} -show window -icon-theme ${iconTheme} -show-icons"
"$mainMod, V, exec, cliphist list | ${launcher} -dmenu | cliphist decode | wl-copy"
"alt, space, exec, ${launcher} -show drun -icon-theme ${iconTheme} -show-icons"
"$mainMod, E, exec, ${explorer}"
"$mainMod SHIFT, E, exec, ${termRunner} -e ${explorerTerm}"
"$mainMod, P, pseudo"
"$mainMod, X, togglesplit"
"$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 CTRL, H, resizeactive, 10 0"
"$mainMod CTRL, L, resizeactive, -10 0"
"$mainMod CTRL, K, resizeactive, 0 10"
"$mainMod CTRL, J, resizeactive, 0 10"
"$mainMod, s, exec, grimblast copysave active ${screenshotPath}"
"$mainMod SHIFT, s, exec, grimblast copysave area ${screenshotPath}"
"alt, PRINT, exec, grimblast copysave active ${screenshotPath}"
",PRINT, exec, grimblast copysave active ${screenshotPath}"
"$mainMod SHIFT, c, exec, notify-send \"Color: $(hyprpicker)\""
"$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"
"$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"
"$mainMod, GRAVE, togglespecialworkspace, magic"
"$mainMod SHIFT, GRAVE, movetoworkspace, special:magic"
"$mainMod, mouse_down, workspace, e+1"
"$mainMod, mouse_up, workspace, e-1"
];
# m: Mouse: Will work with mouse buttons
bindm = [
"$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow"
];
# l: locked: Will work when an input inhibitor is active (e.g. lock screen)
bindl = [
",XF86AudioNext, exec, playerctl next"
",XF86AudioPrev, exec, playerctl previous"
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioPause, exec, playerctl play-pause"
];
# e: repeat: Will repeat when the key is held down
bindel = [
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86MonBrightnessUp, exec, brightnessctl set +10%"
", XF86MonBrightnessDown, exec, brightnessctl set 10%-"
", XF86KbdBrightnessUp, exec, brightnessctl --device ${kbdBacklightDev} set ${kbdBacklightStep}+"
", XF86KbdBrightnessDown, exec, brightnessctl --device ${kbdBacklightDev} set ${kbdBacklightStep}-"
", XF86Launch4, exec, powerprofiles-next"
", XF86Launch1, exec, ${launcher} -show drun -icon-theme ${iconTheme} -show-icons"
];
gesture = [
"4, horizontal, workspace"
];
};
}

View file

@ -0,0 +1,43 @@
{...}: {
wayland.windowManager.hyprland.settings = {
windowrule = [
# windowrule = match:class mpv, float on, move (monitor_w-20-window_w) (monitor_h-20-window_h), pin on
];
windowrulev2 = [
"suppressevent maximize, class:.*"
# Right Bottom
"float, pin, size 25%, move 73% 73%, title:^([Pp]icture[-\s]?[Ii]n[-\s]?[Pp]icture)(.*)$"
"float, pin, size 25%, move 73% 73%, title:^()(.*)$"
# Right Top
"float, pin, size 25%, move 73% 10%, class:^(org.pulseaudio.pavucontrol)$"
# Right Top + no focus
"noinitialfocus, float, pin, size 25%, move 73% 10%, class:^(org.kde.(dolphin|ark))$, title:^(Extracting|Compressing)(.*)$"
"noinitialfocus, float, pin, size 25%, move 73% 10%, class:^(thunar)$, title:^(File Operation Progress)$"
# Centered
"float, center, size 50%, class:^(com.(telegram|ayugram).desktop)$, title:^(Media viewer)$"
"float, center, size 50%, class:^(io.github.kukuruzka165.materialgram)$, title:^(Media viewer)$"
"float, center, size 50%, class:^(wechat)$, title:^()$"
"float, center, size 50%, class:^(QQ)$, title:^()$"
"float, center, size 50%, class:^(QQ)$, title:^()$"
"float, center, size 50%, class:^(CherryStudio)$, title:^(Cherry Studio Quick Assistant)$"
"float, center, size 50%, class:^(anki)$, title:^(Add)$"
"float, center, title:^(Open File||Select a File||Choose wallpaper|Open Folder|Save As||Library|File Upload)(.*)$"
"float, center, class:^(qt6ct)$"
# no focus
"float, noinitialfocus, center, class:^(gimp)$, title:^(GIMP Startup)$"
"float, noinitialfocus, center, class:^(wechat)$, title:^(wechat)$"
# Pin + Stay focused
"float, pin, stayfocused, class:^(rofi)$"
# Workspace 1 - Master
"workspace 1, class:^(firefox)$"
# Workspace 2 - Project
"workspace 2, class:^(code|dev.zed.Zed|Vitis IDE|Vivado)$"
# Workspace 3 - Info
"workspace 3, class:^(discord|thunderbird|QQ|wechat|com.(telegram|ayugram).desktop|io.github.kukuruzka165.materialgram)$"
# Workspace 9 - Background
"workspace 9, class:^(feishin|Cider)$"
];
};
}