Files
arthur-os/bin/omarchy-swayosd-brightness
9d7474095f Keep brightness OSD popup width uniform across all percentages (#5806)
Pad the percent text to 3 chars with printf so "  5%", " 50%", and
"100%" render at identical width in the JetBrainsMono monospace label.
Previously the popup container resized between events because the
label string varied between 2 and 4 characters, which caused the
popup to visibly jump in width on consecutive brightness key presses.

Builds on #5525, which made the percent values themselves step
uniformly; this completes the loop by making the rendered popup match.

Co-authored-by: Mateus Pegorim <14262063+Pegorim@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-14 12:35:36 +02:00

16 lines
516 B
Bash
Executable File

#!/bin/bash
# omarchy:summary=Display brightness level using SwayOSD on the current monitor.
# omarchy:args=<0-100>
# omarchy:examples=omarchy swayosd brightness 0 | omarchy swayosd brightness 50 | omarchy swayosd brightness 100
percent="$1"
progress="$(awk -v p="$percent" 'BEGIN{printf "%.2f", p/100}')"
[[ $progress == "0.00" ]] && progress="0.01"
omarchy-swayosd-client \
--custom-icon display-brightness-symbolic \
--custom-progress "$progress" \
--custom-progress-text "$(printf '%3d%%' "$percent")"