diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-08-11 12:37:59 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:41:34 -0700 |
| commit | 186d05532f1ef30dbb34f3c1e2634bd451f1de80 (patch) | |
| tree | 3177ef40ca6514a088d2e4800b22be25428a6260 | |
| parent | e5240e10ae61fcc877be6d6c8f1b26d2fa21d1fd (diff) | |
Fixed formatting is layout menu
Signed-off-by: Don Williams <don.e.williams@gmail.com>
On branch development
Your branch is up to date with 'origin/development'.
Changes to be committed:
modified: config/hypr/scripts/HyprLayoutModule.sh
| -rwxr-xr-x | config/hypr/scripts/HyprLayoutModule.sh | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/config/hypr/scripts/HyprLayoutModule.sh b/config/hypr/scripts/HyprLayoutModule.sh index 0ca75e3e..bbfb9246 100755 --- a/config/hypr/scripts/HyprLayoutModule.sh +++ b/config/hypr/scripts/HyprLayoutModule.sh @@ -57,6 +57,16 @@ layout_shortcut_live() { shortcuts="$( hyprctl -j binds 2>/dev/null | jq -r --arg target "$target" ' + # Decode integer modmask into modifier string (SUPER+ALT+CTRL+SHIFT). + # Bit values: SHIFT=1, CTRL=4, ALT=8, SUPER=64 + def has_bit(mask; bit): ((mask / bit) | floor) % 2 == 1; + def modmask_str(mask): + [ + if has_bit(mask; 64) then "SUPER" else empty end, + if has_bit(mask; 8) then "ALT" else empty end, + if has_bit(mask; 4) then "CTRL" else empty end, + if has_bit(mask; 1) then "SHIFT" else empty end + ] | join("+"); [ .[]? | select( @@ -76,19 +86,17 @@ layout_shortcut_live() { ) ) | ( - .display_key + # Prefer display_key if present and non-empty (newer Hyprland versions). + (.display_key | if . != null and length > 0 then . else null end) // ( - [ - (.mods // [] | if type == "array" then .[] else empty end), - (.key // empty) - ] + # Fall back to decoding modmask bitmask + key name. + [modmask_str(.modmask // 0), (.key // "")] | map(select(. != null and . != "")) | join("+") ) ) | tostring | gsub("\\s*\\+\\s*"; "+") - | gsub("\\$mainMod"; "SUPER") | select(length > 0) ] | unique @@ -192,7 +200,7 @@ show_menu() { row="${options[i]}" left_text="${row%%|*}" shortcut="${row#*|}" - options[i]="$(printf "%-${left_width}s -----------> %s" "$left_text" "$shortcut")" + options[i]="$(printf "%-${left_width}s %s" "$left_text" "$shortcut")" done if pgrep -x rofi >/dev/null; then |
