diff options
| author | brockar <martinnguzman.mg@gmail.com> | 2025-11-13 20:28:51 -0300 |
|---|---|---|
| committer | brockar <martinnguzman.mg@gmail.com> | 2025-11-13 20:28:51 -0300 |
| commit | 0dfd893ea1f310714c3ec2c79a17692b52ff4c43 (patch) | |
| tree | 36a4f436ed174f209f0c00d09b62818f276ec239 /config/hypr/scripts/KeybindsLayoutInit.sh | |
| parent | 8fa285acf93e1f95080a60a03b00f57bac827a63 (diff) | |
| parent | 872b09fa88825ec5631ba3cdc21e0e717ec241ee (diff) | |
Merge remote-tracking branch 'origin/development' into br-userconfigs
Diffstat (limited to 'config/hypr/scripts/KeybindsLayoutInit.sh')
| -rwxr-xr-x | config/hypr/scripts/KeybindsLayoutInit.sh | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/config/hypr/scripts/KeybindsLayoutInit.sh b/config/hypr/scripts/KeybindsLayoutInit.sh new file mode 100755 index 00000000..fd34f90e --- /dev/null +++ b/config/hypr/scripts/KeybindsLayoutInit.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# Initialize J/K keybinds to match the current default layout at startup + +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) + # Ensure master layout-style binds + hyprctl keyword unbind SUPER,J + hyprctl keyword unbind SUPER,K + hyprctl keyword unbind SUPER,O + hyprctl keyword bind SUPER,J,layoutmsg,cyclenext + hyprctl keyword bind SUPER,K,layoutmsg,cycleprev + ;; + dwindle) + # Ensure dwindle layout-style binds + hyprctl keyword unbind SUPER,J + 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,O,togglesplit + ;; + *) + # Do nothing for unexpected values + : + ;; + esac |
