Add new display widget for the bar

This commit is contained in:
David Heinemeier Hansson
2026-05-17 17:29:52 +02:00
parent cf4935f964
commit 540aaf956d
10 changed files with 471 additions and 13 deletions
+20
View File
@@ -0,0 +1,20 @@
#!/bin/bash
# omarchy:summary=Get Apple Studio Display or XDR Display brightness using asdcontrol.
# omarchy:examples=omarchy brightness display apple get | omarchy-brightness-display-apple-get
device="$(sudo asdcontrol --detect /dev/usb/hiddev* /dev/hiddev* 2>/dev/null | awk -F: '/^\/dev\/(usb\/)?hiddev/{ print $1; exit }')"
if [[ -z $device ]]; then
echo "No Apple Display HID device found" >&2
exit 1
fi
sudo asdcontrol "$device" 2>/dev/null | awk -F= '
/BRIGHTNESS=/ {
print int($2 * 100 / 60000)
found = 1
}
END { exit !found }
'