Created
October 10, 2025 18:16
-
-
Save ajbonner/375ccfa90e9bf398614ef58aec235035 to your computer and use it in GitHub Desktop.
On Omarchy Linux control the keyboard backlight and send status to swayosd
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| ### Hypr bindings | |
| # bindeld = ,XF86KbdBrightnessUp, Keyboard brightness up, exec, /usr/local/bin/backlightctl up | |
| # bindeld = ,XF86KbdBrightnessDown, Keyboard brightness down, exec, /usr/local/bin/backlightctl down | |
| ### | |
| if [ $# -lt 1 ]; then | |
| ACTION="up" | |
| else | |
| ACTION=$1 | |
| fi | |
| if [ "$ACTION" == "up" ]; then | |
| BRIGHT_STATUS_RAW=$(brightnessctl -d smc::kbd_backlight -m s +5%) | |
| else | |
| BRIGHT_STATUS_RAW=$(brightnessctl -d smc::kbd_backlight -m s 5%-) | |
| fi | |
| BRIGHT_VAL_ABS=$(echo "${BRIGHT_STATUS_RAW}" | awk -F, '{ print $3 }') | |
| STATUS_PERCENT=$(echo "scale=0; (((${BRIGHT_VAL_ABS} * 100 / 255)) / 5) * 5" | bc) | |
| STATUS_DECIMAL=$(awk "BEGIN {printf \"%.2f\", ${STATUS_PERCENT} / 100}") | |
| swayosd-client --custom-icon keyboard-brightness-symbolic --custom-progress="${STATUS_DECIMAL}" --custom-progress-text="${STATUS_PERCENT}%" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment