Update hyprland config (gestures and other stuff)

This commit is contained in:
Pedro Rey Anca 2025-12-05 17:56:38 +01:00
parent 28cc7d2d25
commit 18cc25b3b8
Signed by: peprolinbot
GPG key ID: 053EA6E00116533A
3 changed files with 298 additions and 300 deletions

View file

@ -1,10 +1,10 @@
{ {
pkgs,
lib, lib,
config, config,
... ...
}: { }:
imports = [./regreet.nix]; {
imports = [ ./regreet.nix ];
options = { options = {
programs.hyprland.autoLogin.username = lib.mkOption { programs.hyprland.autoLogin.username = lib.mkOption {
@ -21,19 +21,10 @@
withUWSM = true; withUWSM = true;
}; };
xdg.portal = { services.greetd.settings.initial_session =
enable = true; let
wlr.enable = true; username = config.programs.hyprland.autoLogin.username;
xdgOpenUsePortal = true; in
extraPortals = [
pkgs.xdg-desktop-portal-hyprland
pkgs.xdg-desktop-portal-gtk
];
};
services.greetd.settings.initial_session = let
username = config.programs.hyprland.autoLogin.username;
in
lib.mkIf (!isNull username) { lib.mkIf (!isNull username) {
command = "uwsm start hyprland-uwsm.desktop"; command = "uwsm start hyprland-uwsm.desktop";
user = username; user = username;

View file

@ -1,4 +1,5 @@
{pkgs, ...}: { { pkgs, ... }:
{
wayland.windowManager.hyprland = { wayland.windowManager.hyprland = {
enable = true; enable = true;
xwayland = { xwayland = {
@ -10,119 +11,120 @@
pkgs.hyprlandPlugins.hyprgrass pkgs.hyprlandPlugins.hyprgrass
]; ];
settings = let settings =
app_menu = "${pkgs.fuzzel}/bin/fuzzel"; let
in { app_menu = "${pkgs.fuzzel}/bin/fuzzel";
# Autostart in
exec-once = [ {
"uwsm app -- nm-applet" # Autostart
"uwsm app -- ${pkgs.wl-clip-persist}/bin/persist --clipboard regular" exec-once = [
"uwsm app -- bash -c 'if [ ! -f ~/.config/hypr/wallpaper.png ]; then wall-change ~/.config/hypr/default_wallpaper.png; fi'" "uwsm app -- nm-applet"
"uwsm app -- ${pkgs.swaybg}/bin/swaybg -m fill -i ~/.config/hypr/wallpaper.png &" "uwsm app -- ${pkgs.wl-clip-persist}/bin/persist --clipboard regular"
"uwsm app -- ${pkgs.poweralertd}/bin/poweralertd" "uwsm app -- bash -c 'if [ ! -f ~/.config/hypr/wallpaper.png ]; then wall-change ~/.config/hypr/default_wallpaper.png; fi'"
"uwsm app -- waybar" "uwsm app -- ${pkgs.swaybg}/bin/swaybg -m fill -i ~/.config/hypr/wallpaper.png &"
"uwsm app -- element-desktop --hidden" "uwsm app -- ${pkgs.poweralertd}/bin/poweralertd"
]; "uwsm app -- waybar"
"uwsm app -- element-desktop --hidden"
input = {
kb_layout = "es,us";
kb_options = "grp:alt_caps_toggle";
numlock_by_default = true;
follow_mouse = 1;
sensitivity = 0;
touchpad = {
natural_scroll = true;
};
};
general = {
"$mainMod" = "SUPER";
layout = "dwindle";
gaps_in = 0;
gaps_out = 0;
border_size = 2;
no_border_on_floating = false;
};
misc = {
disable_autoreload = true;
disable_hyprland_logo = true;
always_follow_on_dnd = true;
layers_hog_keyboard_focus = true;
animate_manual_resizes = false;
enable_swallow = true;
focus_on_activate = true;
};
dwindle = {
force_split = 0;
special_scale_factor = 1.0;
split_width_multiplier = 1.0;
use_active_for_splits = true;
pseudotile = true;
preserve_split = true;
};
master = {
new_status = "master";
special_scale_factor = 1;
};
decoration = {
rounding = 0;
blur = {
enabled = true;
size = 1;
passes = 1;
brightness = 1;
contrast = 1.400;
ignore_opacity = true;
noise = 0;
new_optimizations = true;
xray = false;
};
shadow = {
enabled = true;
ignore_window = true;
offset = "0 2";
range = 20;
render_power = 3;
};
};
animations = {
enabled = true;
bezier = [
"fluent_decel, 0, 0.2, 0.4, 1"
"easeOutCirc, 0, 0.55, 0.45, 1"
"easeOutCubic, 0.33, 1, 0.68, 1"
"easeinoutsine, 0.37, 0, 0.63, 1"
]; ];
animation = [ input = {
# Windows kb_layout = "es,us";
"windowsIn, 1, 3, easeOutCubic, popin 30%" # window open kb_options = "grp:alt_caps_toggle";
"windowsOut, 1, 3, fluent_decel, popin 70%" # window close. numlock_by_default = true;
"windowsMove, 1, 2, easeinoutsine, slide" # everything in between, moving, dragging, resizing. follow_mouse = 1;
sensitivity = 0;
touchpad = {
natural_scroll = true;
};
};
# Fade general = {
"fadeIn, 1, 3, easeOutCubic" # fade in (open) -> layers and windows "$mainMod" = "SUPER";
"fadeOut, 1, 2, easeOutCubic" # fade out (close) -> layers and windows layout = "dwindle";
"fadeSwitch, 0, 1, easeOutCirc" # fade on changing activewindow and its opacity gaps_in = 0;
"fadeShadow, 1, 10, easeOutCirc" # fade on changing activewindow for shadows gaps_out = 0;
"fadeDim, 1, 4, fluent_decel" # the easing of the dimming of inactive windows border_size = 2;
"border, 1, 2.7, easeOutCirc" # for animating the border's color switch speed no_border_on_floating = false;
"borderangle, 1, 30, fluent_decel, once" # for animating the border's gradient angle - styles: once (default), loop };
"workspaces, 1, 4, easeOutCubic, fade" # styles: slide, slidevert, fade, slidefade, slidefadevert
];
};
bind = misc = {
[ disable_autoreload = true;
disable_hyprland_logo = true;
always_follow_on_dnd = true;
layers_hog_keyboard_focus = true;
animate_manual_resizes = false;
enable_swallow = true;
focus_on_activate = true;
};
dwindle = {
force_split = 0;
special_scale_factor = 1.0;
split_width_multiplier = 1.0;
use_active_for_splits = true;
pseudotile = true;
preserve_split = true;
};
master = {
new_status = "master";
special_scale_factor = 1;
};
decoration = {
rounding = 0;
blur = {
enabled = true;
size = 1;
passes = 1;
brightness = 1;
contrast = 1.400;
ignore_opacity = true;
noise = 0;
new_optimizations = true;
xray = false;
};
shadow = {
enabled = true;
ignore_window = true;
offset = "0 2";
range = 20;
render_power = 3;
};
};
animations = {
enabled = true;
bezier = [
"fluent_decel, 0, 0.2, 0.4, 1"
"easeOutCirc, 0, 0.55, 0.45, 1"
"easeOutCubic, 0.33, 1, 0.68, 1"
"easeinoutsine, 0.37, 0, 0.63, 1"
];
animation = [
# Windows
"windowsIn, 1, 3, easeOutCubic, popin 30%" # window open
"windowsOut, 1, 3, fluent_decel, popin 70%" # window close.
"windowsMove, 1, 2, easeinoutsine, slide" # everything in between, moving, dragging, resizing.
# Fade
"fadeIn, 1, 3, easeOutCubic" # fade in (open) -> layers and windows
"fadeOut, 1, 2, easeOutCubic" # fade out (close) -> layers and windows
"fadeSwitch, 0, 1, easeOutCirc" # fade on changing activewindow and its opacity
"fadeShadow, 1, 10, easeOutCirc" # fade on changing activewindow for shadows
"fadeDim, 1, 4, fluent_decel" # the easing of the dimming of inactive windows
"border, 1, 2.7, easeOutCirc" # for animating the border's color switch speed
"borderangle, 1, 30, fluent_decel, once" # for animating the border's gradient angle - styles: once (default), loop
"workspaces, 1, 4, easeOutCubic, fade" # styles: slide, slidevert, fade, slidefade, slidefadevert
];
};
bind = [
# show keybinds list # show keybinds list
"$mainMod, F1, exec, show-keybinds" "$mainMod, F1, exec, show-keybinds"
@ -160,17 +162,19 @@
# binds $mod + [shift +] {1..10} to [move to] workspace {1..10} # binds $mod + [shift +] {1..10} to [move to] workspace {1..10}
builtins.concatLists ( builtins.concatLists (
builtins.genList ( builtins.genList (
x: let x:
ws = let let
c = (x + 1) / 10; ws =
in let
c = (x + 1) / 10;
in
builtins.toString (x + 1 - (c * 10)); builtins.toString (x + 1 - (c * 10));
in [ in
[
"$mainMod, ${ws}, workspace, ${toString (x + 1)}" "$mainMod, ${ws}, workspace, ${toString (x + 1)}"
"$mainMod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}" "$mainMod SHIFT, ${ws}, movetoworkspacesilent, ${toString (x + 1)}"
] ]
) ) 10
10
) )
) )
++ [ ++ [
@ -184,24 +188,40 @@
# Window focus, movement and control # Window focus, movement and control
builtins.concatLists ( builtins.concatLists (
let let
keys = ["H" "L" "K" "J"]; keys = [
directions = ["l" "r" "u" "d"]; "H"
"L"
"K"
"J"
];
directions = [
"l"
"r"
"u"
"d"
];
resize = toString 80; # Change this to change how much a window resizes each keypress resize = toString 80; # Change this to change how much a window resizes each keypress
resize_list = ["-${resize} 0" "${resize} 0" "0 -${resize}" "0 ${resize}"]; resize_list = [
"-${resize} 0"
"${resize} 0"
"0 -${resize}"
"0 ${resize}"
];
in in
builtins.genList ( builtins.genList (
x: let x:
k = builtins.elemAt keys x; let
d = builtins.elemAt directions x; k = builtins.elemAt keys x;
r = builtins.elemAt resize_list x; d = builtins.elemAt directions x;
in [ r = builtins.elemAt resize_list x;
"$mainMod, ${k}, movefocus, ${d}" in
"$mainMod SHIFT, ${k}, movewindow, ${d}" [
"$mainMod CTRL, ${k}, resizeactive, ${r}" "$mainMod, ${k}, movefocus, ${d}"
"$mainMod ALT, ${k}, moveactive, ${r}" "$mainMod SHIFT, ${k}, movewindow, ${d}"
] "$mainMod CTRL, ${k}, resizeactive, ${r}"
) "$mainMod ALT, ${k}, moveactive, ${r}"
4 ]
) 4
) )
) )
++ [ ++ [
@ -218,172 +238,167 @@
"$mainMod, V, exec, cliphist list | fuzzel --dmenu --prompt '📋 ' | cliphist decode | wl-copy" "$mainMod, V, exec, cliphist list | fuzzel --dmenu --prompt '📋 ' | cliphist decode | wl-copy"
]; ];
# Bindings that work when locked # Bindings that work when locked
bindl = [ bindl = [
# media and volume controls # media and volume controls
",XF86AudioRaiseVolume,exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+ && wp-vol" ",XF86AudioRaiseVolume,exec, wpctl set-volume -l 1.0 @DEFAULT_AUDIO_SINK@ 5%+ && wp-vol"
",XF86AudioLowerVolume,exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- && wp-vol" ",XF86AudioLowerVolume,exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- && wp-vol"
",XF86AudioMute,exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" ",XF86AudioMute,exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
",XF86AudioPlay,exec, playerctl play-pause" ",XF86AudioPlay,exec, playerctl play-pause"
",XF86AudioNext,exec, playerctl next" ",XF86AudioNext,exec, playerctl next"
",XF86AudioPrev,exec, playerctl previous" ",XF86AudioPrev,exec, playerctl previous"
",XF86AudioStop, exec, playerctl stop" ",XF86AudioStop, exec, playerctl stop"
]; ];
# mouse binding # mouse binding
bindm = [ bindm = [
"$mainMod, mouse:272, movewindow" "$mainMod, mouse:272, movewindow"
"$mainMod, mouse:273, resizewindow" "$mainMod, mouse:273, resizewindow"
]; ];
# windowrule gesture = [
windowrule = [ "3, horizontal, workspace"
"float,class:vimiv" ];
"center,class:vimiv"
"float,class:mpv"
"center,class:mpv"
"size 1200 725,class:mpv"
"float,title:^(float_kitty)$"
"center,title:^(float_kitty)$"
"size 950 600,title:^(float_kitty)$"
"tile, class:neovide"
"idleinhibit focus,class:mpv"
"float,class:udiskie"
"float,title:^(Volume Control)$"
"float,title:^(Firefox Sharing Indicator)$"
"move 0 0,title:^(Firefox Sharing Indicator)$"
"size 700 450,title:^(Volume Control)$"
"move 40 55%,title:^(Volume Control)$"
"float, title:^(Picture-in-Picture)$"
"opacity 1.0 override 1.0 override, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
"opacity 1.0 override 1.0 override, class:(Aseprite)"
"opacity 1.0 override 1.0 override, class:(Unity)"
"idleinhibit focus, class:^(mpv)$"
"idleinhibit fullscreen, class:^(firefox)$"
"float,class:^(zenity)$"
"center,class:^(zenity)$"
"size 850 500,class:^(zenity)$"
"float,class:^(pavucontrol)$"
"float,class:^(.sameboy-wrapped)$"
"float,class:^(file_progress)$"
"float,class:^(confirm)$"
"float,class:^(dialog)$"
"float,class:^(download)$"
"float,class:^(notification)$"
"float,class:^(error)$"
"float,class:^(confirmreset)$"
"float,title:^(Open File)$"
"float,title:^(branchdialog)$"
"float,title:^(Confirm to replace files)$"
"float,title:^(File Operation Progress)$"
"opacity 0.0 override,class:^(xwaylandvideobridge)$" # windowrule
"noanim,class:^(xwaylandvideobridge)$" windowrule = [
"noinitialfocus,class:^(xwaylandvideobridge)$" "float,class:vimiv"
"maxsize 1 1,class:^(xwaylandvideobridge)$" "center,class:vimiv"
"noblur,class:^(xwaylandvideobridge)$" "float,class:mpv"
]; "center,class:mpv"
"size 1200 725,class:mpv"
"float,title:^(float_kitty)$"
"center,title:^(float_kitty)$"
"size 950 600,title:^(float_kitty)$"
"tile, class:neovide"
"idleinhibit focus,class:mpv"
"float,class:udiskie"
"float,title:^(Volume Control)$"
"float,title:^(Firefox Sharing Indicator)$"
"move 0 0,title:^(Firefox Sharing Indicator)$"
"size 700 450,title:^(Volume Control)$"
"move 40 55%,title:^(Volume Control)$"
"float, title:^(Picture-in-Picture)$"
"opacity 1.0 override 1.0 override, title:^(Picture-in-Picture)$"
"pin, title:^(Picture-in-Picture)$"
"opacity 1.0 override 1.0 override, class:(Aseprite)"
"opacity 1.0 override 1.0 override, class:(Unity)"
"idleinhibit focus, class:^(mpv)$"
"idleinhibit fullscreen, class:^(firefox)$"
"float,class:^(zenity)$"
"center,class:^(zenity)$"
"size 850 500,class:^(zenity)$"
"float,class:^(pavucontrol)$"
"float,class:^(.sameboy-wrapped)$"
"float,class:^(file_progress)$"
"float,class:^(confirm)$"
"float,class:^(dialog)$"
"float,class:^(download)$"
"float,class:^(notification)$"
"float,class:^(error)$"
"float,class:^(confirmreset)$"
"float,title:^(Open File)$"
"float,title:^(branchdialog)$"
"float,title:^(Confirm to replace files)$"
"float,title:^(File Operation Progress)$"
monitor = [ "opacity 0.0 override,class:^(xwaylandvideobridge)$"
",preferred,auto,1" "noanim,class:^(xwaylandvideobridge)$"
]; "noinitialfocus,class:^(xwaylandvideobridge)$"
"maxsize 1 1,class:^(xwaylandvideobridge)$"
"noblur,class:^(xwaylandvideobridge)$"
];
xwayland = { monitor = [
force_zero_scaling = true; ",preferred,auto,1"
}; ];
gestures = { xwayland = {
workspace_swipe = true; force_zero_scaling = true;
workspace_swipe_direction_lock = false; };
};
ecosystem = {
no_update_news = true;
no_donation_nag = true;
};
plugin = {
touch_gestures = {
# The default sensitivity is probably too low on tablet screens,
# I recommend turning it up to 4.0
sensitivity = 5.0;
# must be >= 3 ecosystem = {
workspace_swipe_fingers = 3; no_update_news = true;
no_donation_nag = true;
};
# switching workspaces by swiping from an edge, this is separate from workspace_swipe_fingers plugin = {
# and can be used at the same time touch_gestures = {
# possible values: l, r, u, or d # The default sensitivity is probably too low on tablet screens,
# to disable it set it to anything else # I recommend turning it up to 4.0
workspace_swipe_edge = "no"; sensitivity = 5.0;
# in milliseconds # must be >= 3
long_press_delay = 400; workspace_swipe_fingers = 3;
# resize windows by long-pressing on window borders and gaps. # switching workspaces by swiping from an edge, this is separate from workspace_swipe_fingers
# If general:resize_on_border is enabled, general:extend_border_grab_area is used for floating # and can be used at the same time
# windows # possible values: l, r, u, or d
resize_on_border_long_press = true; # to disable it set it to anything else
workspace_swipe_edge = "no";
# in pixels, the distance from the edge that is considered an edge # in milliseconds
edge_margin = 20; long_press_delay = 400;
# emulates touchpad swipes when swiping in a direction that does not trigger workspace swipe. # resize windows by long-pressing on window borders and gaps.
# ONLY triggers when finger count is equal to workspace_swipe_fingers # If general:resize_on_border is enabled, general:extend_border_grab_area is used for floating
# # windows
# might be removed in the future in favor of event hooks resize_on_border_long_press = true;
emulate_touchpad_swipe = false;
hyprgrass-bind = [ # in pixels, the distance from the edge that is considered an edge
# swipe left from right edge edge_margin = 20;
", edge:r:l, exec, playerctl next"
# swipe right from left edge # emulates touchpad swipes when swiping in a direction that does not trigger workspace swipe.
", edge:l:r, exec, playerctl previous" # ONLY triggers when finger count is equal to workspace_swipe_fingers
#
# might be removed in the future in favor of event hooks
emulate_touchpad_swipe = false;
# swipe up from bottom edge hyprgrass-bind = [
", edge:d:u, exec, pkill -SIGUSR2 wvkbd" # Show wvkbd # swipe left from right edge
", edge:r:l, exec, playerctl next"
# swipe down to bottom edge # swipe right from left edge
", edge:u:d, exec, pkill -SIGUSR1 wvkbd" # Hide wvkbd ", edge:l:r, exec, playerctl previous"
# tap with 3 fingers # swipe up from bottom edge
", tap:4, exec, pkill -SIGRTMIN wvkbd" # Toggles wvkbd ", edge:d:u, exec, pkill -SIGUSR2 wvkbd" # Show wvkbd
# swipe up from left edge # swipe down to bottom edge
", edge:l:u, exec, pamixer -i 4" ", edge:u:d, exec, pkill -SIGUSR1 wvkbd" # Hide wvkbd
# swipe down from left edge # tap with 3 fingers
", edge:l:d, exec, pamixer -d 4" ", tap:4, exec, pkill -SIGRTMIN wvkbd" # Toggles wvkbd
# swipe up with 3 fingers # swipe up from left edge
", swipe:3:u, exec, ${pkgs.nwg-drawer}/bin/nwg-drawer" ", edge:l:u, exec, pamixer -i 4"
# swipe down with 3 fingers # swipe down from left edge
", swipe:3:d, killactive" ", edge:l:d, exec, pamixer -d 4"
# swipe diagonally left and down with 3 fingers # swipe up with 3 fingers
", swipe:3:ld, exec, uwsm app -- librewolf" ", swipe:3:u, exec, ${pkgs.nwg-drawer}/bin/nwg-drawer"
# swipe diagonally right and down with 3 fingers # swipe down with 3 fingers
", swipe:3:rd, exec, uwsm app -- xournalpp" ", swipe:3:d, killactive"
# tap with 3 fingers # swipe diagonally left and down with 3 fingers
", tap:3, exec, playerctl play-pause" ", swipe:3:ld, exec, uwsm app -- librewolf"
];
# longpress can trigger mouse binds: # swipe diagonally right and down with 3 fingers
hyprgrass-bindm = [ ", swipe:3:rd, exec, uwsm app -- xournalpp"
", longpress:2, movewindow"
", longpress:3, resizewindow"
];
experimental = { # tap with 3 fingers
# send proper cancel events to windows instead of hacky touch_up events, ", tap:3, exec, playerctl play-pause"
# NOT recommended as it crashed a few times, once it's stabilized I'll make it the default ];
send_cancel = 0;
# longpress can trigger mouse binds:
hyprgrass-bindm = [
", longpress:2, movewindow"
", longpress:3, resizewindow"
];
}; };
}; };
}; };
};
}; };
} }

View file

@ -1,15 +1,9 @@
{lib, ...}: let { lib, ... }:
let
variables = { variables = {
NIXOS_OZONE_WL = 1; NIXOS_OZONE_WL = 1;
ELECTRON_OZONE_PLATFORM_HINT = "auto"; ELECTRON_OZONE_PLATFORM_HINT = "auto";
__GL_GSYNC_ALLOWED = 0;
__GL_VRR_ALLOWED = 0;
_JAVA_AWT_WM_NONEREPARENTING = 1;
DISABLE_QT5_COMPAT = 0;
GDK_BACKEND = "wayland,x11,*"; GDK_BACKEND = "wayland,x11,*";
ANKI_WAYLAND = 1;
DIRENV_LOG_FORMAT = "";
WLR_DRM_NO_ATOMIC = 1;
QT_AUTO_SCREEN_SCALE_FACTOR = 1; QT_AUTO_SCREEN_SCALE_FACTOR = 1;
QT_WAYLAND_DISABLE_WINDOWDECORATION = 1; QT_WAYLAND_DISABLE_WINDOWDECORATION = 1;
QT_QPA_PLATFORM = "wayland;xcb"; QT_QPA_PLATFORM = "wayland;xcb";
@ -19,13 +13,11 @@
SDL_VIDEODRIVER = "wayland"; SDL_VIDEODRIVER = "wayland";
CLUTTER_BACKEND = "wayland"; CLUTTER_BACKEND = "wayland";
}; };
in { in
{
home.sessionVariables = variables; home.sessionVariables = variables;
xdg.configFile."uwsm/env".text = builtins.concatStringsSep "\n" ( xdg.configFile."uwsm/env".text = builtins.concatStringsSep "\n" (
lib.attrsets.mapAttrsToList ( lib.attrsets.mapAttrsToList (name: value: "export ${name}=\"${builtins.toString value}\"") variables
name: value: "export ${name}=\"${builtins.toString value}\""
)
variables
); );
} }