mirror of
https://github.com/LukeHagar/omarchy.git
synced 2025-12-06 04:20:23 +00:00
15 lines
635 B
Bash
Executable File
15 lines
635 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
echo "Adjust Apple Display Brightness by passing +5000 or -5000 (or any range from 0-60000)"
|
|
else
|
|
DEVICE="$(sudo asdcontrol --detect /dev/usb/hiddev* | grep ^/dev/usb/hiddev | cut -d: -f1)"
|
|
sudo asdcontrol "$DEVICE" -- "$1" >/dev/null
|
|
VALUE="$(sudo asdcontrol "$DEVICE" | awk -F= '/BRIGHTNESS=/{print $2+0}')"
|
|
swayosd-client \
|
|
--monitor "$(hyprctl monitors -j | jq -r '.[]|select(.focused==true).name')" \
|
|
--custom-icon display-brightness \
|
|
--custom-progress "$(awk -v v="$VALUE" 'BEGIN{printf "%.2f", v/60000}')" \
|
|
--custom-progress-text "$(( VALUE * 100 / 60000 ))%"
|
|
fi
|