aboutsummaryrefslogtreecommitdiffstats
path: root/config/hypr/scripts
diff options
context:
space:
mode:
authorDon Williams <don.e.williams@gmail.com>2025-11-07 12:26:05 -0500
committerDon Williams <don.e.williams@gmail.com>2025-11-07 12:26:05 -0500
commit1788691d242abe607add69d211478e306a154cc6 (patch)
treede3d5af6066840f61b7938f67e5f70c774c828df /config/hypr/scripts
parent206f51d28f8f0cb17289c573991eea5eedae2eec (diff)
Fixing Super J/K cycle next/prev for auto layout
Cycle next/prev is different for dwindle vs. master Oringinal code only worked in master. This script detects which and rebunds SUPER J/K accordingly On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: config/hypr/scripts/KeybindsLayoutInit.sh
Diffstat (limited to 'config/hypr/scripts')
-rwxr-xr-xconfig/hypr/scripts/KeybindsLayoutInit.sh15
1 files changed, 11 insertions, 4 deletions
diff --git a/config/hypr/scripts/KeybindsLayoutInit.sh b/config/hypr/scripts/KeybindsLayoutInit.sh
index af81f62e..fd34f90e 100755
--- a/config/hypr/scripts/KeybindsLayoutInit.sh
+++ b/config/hypr/scripts/KeybindsLayoutInit.sh
@@ -2,8 +2,15 @@
# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ##
# Initialize J/K keybinds to match the current default layout at startup
-# Query current layout (master|dwindle)
-LAYOUT=$(hyprctl -j getoption general:layout | jq -r '.str')
+set -euo pipefail
+
+# Determine current layout (master|dwindle); be robust to null at startup
+LAYOUT=$(hyprctl -j getoption general:layout | jq -r '.str // empty' 2>/dev/null || true)
+if [ -z "${LAYOUT:-}" ]; then
+ # Fallback: parse non-JSON output (e.g., "str: dwindle")
+ LAYOUT=$(hyprctl getoption general:layout 2>/dev/null | awk -F'str:' 'NF>1 {gsub(/^ +| +$/,"",$2); print $2}')
+fi
+[ -z "${LAYOUT:-}" ] && exit 0
case "$LAYOUT" in
master)
@@ -20,8 +27,8 @@ case "$LAYOUT" in
hyprctl keyword unbind SUPER,K
hyprctl keyword unbind SUPER,O
hyprctl keyword bind SUPER,J,cyclenext
-hyprctl keyword bind SUPER,K,cyclenext,prev
-# ensure SUPER+O togglesplit is available on dwindle
+ hyprctl keyword bind SUPER,K,cyclenext,prev
+ # ensure SUPER+O togglesplit is available on dwindle
hyprctl keyword bind SUPER,O,togglesplit
;;
*)
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage