]> Freerunner's - dotfiles.git/commitdiff
hypr: add submap for gaps
authorAndre Ramnitz <tux.rising@gmail.com>
Sat, 17 May 2025 21:57:20 +0000 (23:57 +0200)
committerAndre Ramnitz <tux.rising@gmail.com>
Sat, 17 May 2025 21:57:20 +0000 (23:57 +0200)
dot-config/hypr/fragments/keybinds.conf
dot-config/hypr/hyprland.conf
dot-config/hypr/scripts/gaps.sh [new file with mode: 0755]

index 4d66bdabe6d6a7bacae43c5b4e4c1f02fe06aee3..a9c6a229b60171aea9e717a97a65a452ecd4dd9c 100644 (file)
@@ -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
index cd77b90bd60e0ee0dec4491b8ec11ccb410ee76d..39994e9a1c79b7bfa8ebd6eb62039e94a06ba02a 100644 (file)
@@ -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 (executable)
index 0000000..15a35ed
--- /dev/null
@@ -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
+