From: Andre Ramnitz Date: Sat, 17 May 2025 21:57:20 +0000 (+0200) Subject: hypr: add submap for gaps X-Git-Url: https://git.ramnitz.eu/?a=commitdiff_plain;h=97b4053946d65a52cc9a48fd4eb6a240297d44df;p=dotfiles.git hypr: add submap for gaps --- diff --git a/dot-config/hypr/fragments/keybinds.conf b/dot-config/hypr/fragments/keybinds.conf index 4d66bdab..a9c6a229 100644 --- a/dot-config/hypr/fragments/keybinds.conf +++ b/dot-config/hypr/fragments/keybinds.conf @@ -166,7 +166,7 @@ bind = $mainmod, mouse_up, workspace, e-1 # submaps # ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── # will switch to a submap called resize -bind = $mainmod, R, submap, resize +bind = $mainmod, R, submap, resize # will start a submap called "resize" submap = resize @@ -188,6 +188,28 @@ bind = , catchall, submap, reset submap = reset +# ─────────────────────────────────────────────────────────── +# will switch to a submap called gaps +bind = $mainmod ALT, G, submap, gaps + +# will start a submap called "gaps" +submap = gaps + +# sets repeatable binds for resizing the active window +binde = , l, exec, ~/.config/hypr/scripts/gaps.sh --inc_gaps_in +binde = , h, exec, ~/.config/hypr/scripts/gaps.sh --dec_gaps_in +binde = , j, exec, ~/.config/hypr/scripts/gaps.sh --inc_gaps_out +binde = , k, exec, ~/.config/hypr/scripts/gaps.sh --dec_gaps_out +binde = , i, exec, ~/.config/hypr/scripts/gaps.sh --reset_gaps_in +binde = , o, exec, ~/.config/hypr/scripts/gaps.sh --reset_gaps_out + +# use reset to go back to the global submap +bind = , catchall, submap, reset + +# will reset the submap, which will return to the global submap +submap = reset + + # mouse binds # ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── # Move/resize windows with mainMod + LMB/RMB and dragging diff --git a/dot-config/hypr/hyprland.conf b/dot-config/hypr/hyprland.conf index cd77b90b..39994e9a 100644 --- a/dot-config/hypr/hyprland.conf +++ b/dot-config/hypr/hyprland.conf @@ -58,8 +58,8 @@ general { # col.nogroup_border_active = 0xffff00ff # col.nogroup_border = 0xffffaaff border_size = 2 - gaps_in = 4 - gaps_out = 8 + gaps_in = 5 + gaps_out = 10 col.active_border = 0xee$base0D col.inactive_border = 0xee$base02 col.nogroup_border_active = 0xff$base0E diff --git a/dot-config/hypr/scripts/gaps.sh b/dot-config/hypr/scripts/gaps.sh new file mode 100755 index 00000000..15a35ed0 --- /dev/null +++ b/dot-config/hypr/scripts/gaps.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +gaps_in=$(hyprctl -j getoption general:gaps_in | jq '.custom' | awk '{print $2}') +gaps_out=$(hyprctl -j getoption general:gaps_out | jq '.custom' | awk '{print $2}') + +function inc_gaps_in () { + hyprctl keyword general:gaps_in $((gaps_in+5)) +} + +function dec_gaps_in () { + hyprctl keyword general:gaps_in $((gaps_in-5)) +} + +function reset_gaps_in () { + hyprctl keyword general:gaps_in 5 +} + +function zero_gaps_in () { + hyprctl keyword general:gaps_in 0 +} + +function inc_gaps_out () { + hyprctl keyword general:gaps_out $((gaps_out+5)) +} + +function dec_gaps_out () { + hyprctl keyword general:gaps_out $((gaps_out-5)) +} + +function reset_gaps_out () { + hyprctl keyword general:gaps_out 10 +} + +function zero_gaps_out () { + hyprctl keyword general:gaps_out 0 +} + +while [[ $# -gt 0 ]]; do + case $1 in + --inc_gaps_in) inc_gaps_in; shift ;; + --dec_gaps_in) dec_gaps_in; shift ;; + --reset_gaps_in) reset_gaps_in; shift ;; + --zero_gaps_in) zero_gaps_in; shift ;; + --inc_gaps_out) inc_gaps_out; shift ;; + --dec_gaps_out) dec_gaps_out; shift ;; + --reset_gaps_out) reset_gaps_out; shift ;; + --zero_gaps_out) zero_gaps_out; shift ;; + *) printf "Error: Unknown option %s" "$1"; exit 1 ;; + esac +done +