desktop/hyprland: refactor

Signed-off-by: unexplrd <unexplrd@linerds.us>
This commit is contained in:
2025-05-29 14:39:05 +03:00
parent 920c75e997
commit 08deff70bc
9 changed files with 1574 additions and 1162 deletions

View File

@ -0,0 +1,458 @@
{
config,
osConfig,
perSystem,
launcher,
lockscreen,
# pkgs,
# lib,
...
}: let
inherit (config.lib.stylix) colors;
# inherit (lib) mkIf;
hostname = osConfig.networking.hostName;
cursorSize = config.stylix.cursor.size;
fontName = config.stylix.fonts.sansSerif.name;
keyboard =
if hostname == "eldrid"
then "chromeos"
else "platform";
xdgPictures =
config.xdg.userDirs.pictures;
# ifLaptop = mkIf (hostname != "dunamis");
in {
enable = true;
systemd = {
enable = true;
variables = [
"--all"
];
};
package = perSystem.hyprland.hyprland;
portalPackage = perSystem.hyprland.xdg-desktop-portal-hyprland;
# plugins = with pkgs.hyprlandPlugins; [
# hyprspace
# hy3
# hyprscroller
# ];
settings = {
input = {
kb_layout = "us,ua";
resolve_binds_by_sym =
if hostname == "dunamis"
then 0
else 1;
repeat_rate = 50;
repeat_delay = 300;
# mouse
accel_profile = "flat";
sensitivity = 0;
};
device = [
{
name = "ite-tech.-inc.-ite-device(8910)-keyboard";
kb_variant = "colemak_dh,";
}
{
name = "at-translated-set-2-keyboard";
kb_variant = "colemak_dh,";
}
{
name = "keyd-virtual-keyboard";
kb_variant = "colemak_dh,";
}
];
xwayland.force_zero_scaling = true;
monitor = [
", preferred, auto, 1"
"desc:AOC 27V2G5 0x0000026C, addreserved, 0, 300, 0, 0"
"desc:Samsung Electric Company S24R65x H4TMA03291, preferred, 0x0, 1, bitdepth, 10, vrr, 1"
"desc:Philips Consumer Electronics Company 27M2N5500 UK02418033254, 2560x1440@180.00Hz, 0x0, 1.3333333, bitdepth, 10, vrr, 1"
"desc:BOE 0x08E8, preferred, 1920x0, 1.2, bitdepth, 10"
"desc:LG Display 0x068B, preferred, 1920x0, 1.2, bitdepth, 10"
"desc:Chimei Innolux Corporation 0x1406, preferred, 1920x0, 1.2"
"desc:KDC 0x0000, preferred, 1920x0, 1.25"
];
env = [
"ELECTRON_OZONE_PLATFORM_HINT,auto"
"QT_QPA_PLATFORM,wayland"
"QT_QPA_PLATFORMTHEME,gtk3"
"XCURSORSIZE,${toString cursorSize}"
"GSK_RENDERER,ngl"
];
decoration = {
shadow.enabled = false;
# drop_shadow = false;
blur = {
size = 8;
passes = 3;
};
# shadow_offset = "0 5";
# "col.shadow" = "rgba(00000099)";
rounding = 12;
};
misc = {
font_family = fontName;
disable_splash_rendering = true;
disable_hyprland_logo = true;
# vfr = true;
};
bezier = [
"easeOutQuad, 0.25, 0.46, 0.45, 0.94"
"easeOutExpo, 0.19, 1, 0.22, 1"
];
animation = [
"workspaces, 1, 3, easeOutExpo, slidefade 20%"
"windows, 1, 3, easeOutExpo, popin 80%"
"layers, 1, 2, easeOutExpo, fade"
];
plugin = [
{
overview = {
gapsIn = 12;
gapsOut = 24;
exitOnClick = true;
centerAligned = true;
showNewWorkspace = false;
showEmptyWorkspace = false;
affectStrut = false;
};
hyprexpo = {
columns = 3;
gap_size = 8;
#bg_col = "rgb(111111)";
workspace_method = "first 1"; # [center/first] [workspace] e.g. first 1 or center m+1
enable_gesture = true; # laptop touchpad
gesture_fingers = 3; # 3 or 4
gesture_distance = 400; # how far is the "max"
gesture_positive = false; # positive = swipe down. Negative = swipe up.;
};
}
{
hy3 = {
autotile = true;
tab_first_window = false;
tabs = {
render_text = true;
height = 24;
padding = 8;
rounding = 8;
text_height = 14;
text_center = true;
text_font = fontName;
"col.active" = "0xff${colors.base00}";
"col.inactive" = "0xff${colors.base00}";
"col.urgent" = "0xff${colors.base00}";
"col.active.text" = "0xff${colors.base0D}";
"col.inactive.text" = "0xff${colors.base05}";
"col.urgent.text" = "0xff${colors.base09}";
"col.active.border" = "0xff${colors.base00}";
"col.inactive.border" = "0xff${colors.base00}";
"col.urgent.border" = "0xff${colors.base00}";
};
};
}
{
scroller = {
column_widths = "onethird onehalf twothirds one";
window_heights = "onethird onehalf twothirds one";
gesture_scroll_fingers = 3;
gesture_overview_fingers = 3;
jump_labels_font = fontName;
jump_labels_color = "0xff${colors.base0A}";
};
}
];
dwindle = {
force_split = 2;
default_split_ratio = 1.2;
};
master = {
mfact = 0.6;
};
"$mod" = "SUPER";
"$modShift" = "$mod SHIFT";
"$modCtrl" = "$mod CTRL";
"$modShiftCtrl" = "$mod SHIFT CTRL";
"$left" = "N";
"$down" = "E";
"$up" = "I";
"$right" = "O";
"$terminal" = "ghostty";
"$launcher" = launcher;
"$screenLocker" = lockscreen;
"$webBrowser" = "io.github.zen_browser.zen";
"$clipboardManager" = "copyq menu";
general = {
"col.active_border" = "0xff${colors.base0D}";
"col.inactive_border" = "0xff${colors.base03}";
gaps_in = 4;
gaps_out = 8;
border_size = 3;
allow_tearing = true;
layout = "dwindle";
};
group = {
"col.border_active" = "0xff${colors.base0D}";
"col.border_inactive" = "0xff${colors.base03}";
"col.border_locked_active" = "0xff${colors.base0A}";
"col.border_locked_inactive" = "0xff${colors.base0F}";
groupbar = {
height = 16;
rounding = 0;
indicator_height = 0;
gradient_rounding = 4;
font_size = 14;
gradients = true;
font_family = fontName;
"text_color" = "0xff${colors.base00}";
"col.active" = "0xff${colors.base0D}";
"col.inactive" = "0xff${colors.base03}";
};
};
binds.scroll_event_delay = 0;
cursor.persistent_warps = true;
bind = [
"$mod, Return, exec, $terminal"
"$mod, Space, exec, $launcher"
# "$modShift, Space, exec, $launcher"
"$modCtrl, Q, killactive"
"$modCtrl, M, fullscreen"
"$modCtrl, G, togglefloating"
"$mod, G, pin"
"$mod, T, togglegroup"
"$mod, period, changegroupactive, f"
"$mod, comma, changegroupactive, b"
"$modCtrl, period, movewindoworgroup, r"
"$modCtrl, comma, movewindoworgroup, l"
"$mod, Tab, cyclenext,"
"$modShift, Tab, cyclenext, prev"
"$mod, Tab, bringactivetotop,"
"$modShift, U, focusurgentorlast"
"$modCtrl, L, exec, $screenLocker"
"$modCtrl, B, exec, $webBrowser"
"$modCtrl, V, exec, $clipboardManager"
"$modCtrl, K, focuswindow, title:(Meet:.*)"
# ", Print, exec, ${pkgs.grim}/bin/grim -g \"$(${pkgs.slurp}/bin/slurp -o -r -c '\#\#00000000')\" -t ppm - | ${pkgs.satty}/bin/satty --filename - --fullscreen --output-filename ${xdgPictures}/screenshots/satty-$(date '+%Y%m%d-%H:%M:%S').png"
", Print, exec, hyprshot -z -m region -o ${xdgPictures}/screenshots -f screenshot-$(date '+%Y%m%d-%H:%M:%S').png"
"CTRL, Print, exec, hyprshot -z -m window -o ${xdgPictures}/screenshots -f screenshot-$(date '+%Y%m%d-%H:%M:%S').png"
"SHIFT, Print, exec, hyprshot -z -m output -o ${xdgPictures}/screenshots -f screenshot-$(date '+%Y%m%d-%H:%M:%S').png"
## navigation
"$mod, $left, movefocus, l"
"$mod, $down, movefocus, d"
"$mod, $up, movefocus, u"
"$mod, $right, movefocus, r"
"$modShift, $left, workspace, e-1"
"$modShift, $right, workspace, e+1"
"$mod, left, movefocus, l"
"$mod, up, movefocus, u"
"$mod, down, movefocus, d"
"$mod, right, movefocus, r"
"$modShift, W, focuscurrentorlast"
"$mod, mouse_down, workspace, e-1"
"$mod, mouse_up, workspace, e+1"
"$modShift, left, workspace, e-1"
"$modShift, right, workspace, e+1"
"$modCtrl, $left, movewindow, l"
"$modCtrl, $down, movewindow, d"
"$modCtrl, $up, movewindow, u"
"$modCtrl, $right, movewindow, r"
"$modCtrl, left, movewindow, l"
"$modCtrl, up, movewindow, u"
"$modCtrl, down, movewindow, d"
"$modCtrl, right, movewindow, r"
# 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, togglespecialworkspace"
"$modShiftCtrl, 1, movetoworkspace, 1"
"$modShiftCtrl, 2, movetoworkspace, 2"
"$modShiftCtrl, 3, movetoworkspace, 3"
"$modShiftCtrl, 4, movetoworkspace, 4"
"$modShiftCtrl, 5, movetoworkspace, 5"
"$modShiftCtrl, 6, movetoworkspace, 6"
"$modShiftCtrl, 7, movetoworkspace, 7"
"$modShiftCtrl, 8, movetoworkspace, 8"
"$modShiftCtrl, 9, movetoworkspace, 9"
"$modShiftCtrl, 0, movetoworkspace, special"
"$mod, Q, workspace, 1"
"$mod, W, workspace, 2"
"$mod, F, workspace, 3"
"$mod, P, workspace, 4"
"$mod, B, workspace, 5"
"$mod, J, workspace, 6"
"$mod, L, workspace, 7"
"$mod, U, workspace, 8"
"$mod, Y, workspace, 9"
"$mod, apostrophe, togglespecialworkspace"
"$modShiftCtrl, Q, movetoworkspace, 1"
"$modShiftCtrl, W, movetoworkspace, 2"
"$modShiftCtrl, F, movetoworkspace, 3"
"$modShiftCtrl, P, movetoworkspace, 4"
"$modShiftCtrl, B, movetoworkspace, 5"
"$modShiftCtrl, J, movetoworkspace, 6"
"$modShiftCtrl, L, movetoworkspace, 7"
"$modShiftCtrl, U, movetoworkspace, 8"
"$modShiftCtrl, Y, movetoworkspace, 9"
"$modShiftCtrl, apostrophe, movetoworkspace, special"
"$modShiftCtrl, $left, movetoworkspace, e-1"
"$modShiftCtrl, $right, movetoworkspace, e+1"
"$modShiftCtrl, left, movetoworkspace, e-1"
"$modShiftCtrl, right, movetoworkspace, e+1"
''$mod ALT, mouse_down, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | awk 'NR==1 {factor = $2; if (factor < 1) {factor = 1}; print factor * 1.25}')"''
''$mod ALT, mouse_up, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | awk 'NR==1 {factor = $2; if (factor < 1) {factor = 1}; print factor / 1.25}')"''
"$mod ALT, mouse:274, exec, hyprctl keyword cursor:zoom_factor 1" # middle wheel click
];
# binde = [
# "$mod, comma, resizeactive, -10 0"
# "$mod, period, resizeactive, 10 0"
# "$modShift, comma, resizeactive, 0 -10"
# "$modShift, period, resizeactive, 0 10"
# ];
bindl = [
"$mod, Escape, exec, hyprctl switchxkblayout all next"
", switch:on:Lid Switch, exec, hyprctl keyword monitor 'eDP-1, disable'"
", switch:off:Lid Switch, exec, hyprctl keyword monitor 'eDP-1, preferred, 1920x0, 1.2'"
", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioNext, exec, playerctl next"
"$modShiftCtrl ALT, Q, exit"
];
binde = [
", XF86MonBrightnessUp, exec, brightnessctl s 5%+"
", XF86MonBrightnessDown, exec, brightnessctl s 5%-"
"ALT, XF86MonBrightnessUp, exec, brightnessctl s 5%+ -d ${keyboard}::kbd_backlight"
"ALT, XF86MonBrightnessDown, exec, brightnessctl s 5%- -d ${keyboard}::kbd_backlight"
", XF86KbdBrightnessUp, exec, brightnessctl s 5%+ -d ${keyboard}::kbd_backlight"
", XF86KbdBrightnessDown, exec, brightnessctl s 5%- -d ${keyboard}::kbd_backlight"
", XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
];
bindm = [
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];
gestures = {
workspace_swipe = true;
workspace_swipe_fingers = 3;
workspace_swipe_distance = 300;
};
workspace = [
"1, defaultName:general"
"2, defaultName:web"
"3, defaultName:chat"
"4, defaultName:code"
"5, defaultName:uni"
"6, defaultName:games"
"7, defaultName:system"
"8, defaultName:media"
"9, defaultName:tray"
# "10, defaultName:"
];
windowrulev2 = [
## tray/misc utilities
# file picker
"float, class:xdg-desktop-portal-gtk"
"size <50% <90%, class:xdg-desktop-portal-gtk"
"center 1, class:xdg-desktop-portal-gtk"
# xdp-hyprland stream picker
"float, initialTitle:MainPicker"
# general apps
"float, class:(com.saivert.pwvucontrol)"
"float, class:(re.sonny.Junction)"
"float, class:(com.github.hluk.copyq)"
"float, class:(nm-connection-editor)"
"float, class:(.blueman-manager-wrapped)"
# telegram
"maximize, initialTitle:Медіапереглядач"
"noborder, title:TelegramDesktop"
"keepaspectratio, title:TelegramDesktop"
"noblur, title:TelegramDesktop"
"float, title:TelegramDesktop"
"pin, title:TelegramDesktop"
# any chromium-based
"noborder, title:Картинка в картинці"
"keepaspectratio, title:Картинка в картинці"
"noblur, title:Картинка в картинці"
"float, title:Картинка в картинці"
"pin, title:Картинка в картинці"
# and firefox
"noborder, title:Picture-in-Picture"
"keepaspectratio, title:Picture-in-Picture"
"noblur, title:Picture-in-Picture"
"float, title:Picture-in-Picture"
"pin, title:Picture-in-Picture"
# screenshot editor
"noanim, class:com.gabm.satty"
"float, class:com.gabm.satty"
"rounding 0, class:com.gabm.satty"
"size 100% 100%, class:com.gabm.satty"
"move 0 0, class:com.gabm.satty"
"pin, class:com.gabm.satty"
## games
"float, class:(com.mojang.minecraft.java-edition)"
"immediate, class:(com.mojang.minecraft.java-edition)"
# cs2
"immediate, class:(cs2)"
# deadlock
# "float, class:(steam_app_1422450)"
"fullscreen, class:(steam_app_1422450)"
"immediate, class:(steam_app_1422450)"
"immediate, initialTitle:(Ghostrunner)"
# dead by daylight
"immediate, class:deadbydaylight-egs-shipping.exe"
## workspace assignments
"workspace name:chat, class:org.telegram.desktop"
"workspace name:chat, class:org.signal.Signal"
"workspace name:chat, class:im.riot.Riot"
"workspace name:chat, class:WebCord"
"workspace name:games, class:com.heroicgameslauncher.hgl"
"workspace name:games, class:net.lutris.Lutris"
"workspace name:games, class:steam"
# "workspace name:game, class:"
];
};
extraConfig = ''
bind = $modShift, R, submap, resize
submap = resize
binde = , right, resizeactive, 10 0
binde = , left, resizeactive, -10 0
binde = , up, resizeactive, 0 -10
binde = , down, resizeactive, 0 10
binde = , $right, resizeactive, 10 0
binde = , $left, resizeactive, -10 0
binde = , $up, resizeactive, 0 -10
binde = , $down, resizeactive, 0 10
bind = , escape, submap, reset
submap = reset
'';
}