diff options
| author | Don Williams <don.e.williams@gmail.com> | 2026-08-11 13:05:02 -0400 |
|---|---|---|
| committer | Pinapelz <yukais@pinapelz.com> | 2026-08-29 21:41:34 -0700 |
| commit | 3cbf1626b834eab6edf0e3f4003dba5f933b425d (patch) | |
| tree | b537793c930dbef6cb6c89838fb940b8c2cce7e8 /config | |
| parent | 8155b93a644bc484de10763b7d45956607656771 (diff) | |
Redid alignment code wasn't working
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
Diffstat (limited to 'config')
| -rwxr-xr-x | config/hypr/scripts/HyprLayoutModule.sh | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/config/hypr/scripts/HyprLayoutModule.sh b/config/hypr/scripts/HyprLayoutModule.sh index fad77617..7232e28c 100755 --- a/config/hypr/scripts/HyprLayoutModule.sh +++ b/config/hypr/scripts/HyprLayoutModule.sh @@ -34,16 +34,6 @@ layout_name() { esac } -# Returns the display (terminal column) width of a string, accounting for wide Unicode chars. -# Falls back to character count if python3 is unavailable. -display_width() { - python3 -c " -import unicodedata, sys -s = sys.argv[1] -print(sum(2 if unicodedata.east_asian_width(c) in ('W', 'F') else 1 for c in s)) -" "$1" 2>/dev/null || echo "${#1}" -} - # Fallback shortcut labels used when live Hyprland bind data is unavailable. layout_shortcut_fallback() { case "$1" in @@ -201,21 +191,16 @@ show_menu() { shortcut="$(layout_shortcut "$layout")" left_text="$(printf '%s%s %s' "$prefix" "$(layout_icon "$layout")" "$(layout_name "$layout")")" - local dw - dw="$(display_width "$left_text")" - (( dw > left_width )) && left_width=$dw + (( ${#left_text} > left_width )) && left_width=${#left_text} options+=("$left_text|$shortcut") done - # Second pass: align right-side shortcut column using true display width. + # Second pass: pad left column to uniform char width, then append shortcut. for i in "${!options[@]}"; do row="${options[i]}" left_text="${row%%|*}" shortcut="${row#*|}" - local dw pad - dw="$(display_width "$left_text")" - pad=$(( left_width - dw + ${#left_text} )) - options[i]="$(printf "%-${pad}s %s" "$left_text" "$shortcut")" + options[i]="$(printf "%-${left_width}s %s" "$left_text" "$shortcut")" done if pgrep -x rofi >/dev/null; then |
