From 1788691d242abe607add69d211478e306a154cc6 Mon Sep 17 00:00:00 2001 From: Don Williams Date: Fri, 7 Nov 2025 12:26:05 -0500 Subject: 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 --- config/hypr/scripts/KeybindsLayoutInit.sh | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'config/hypr/scripts/KeybindsLayoutInit.sh') 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 ;; *) -- cgit v1.2.3