mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-23 01:52:46 +00:00
feat: a50 dock service
This commit is contained in:
13
modules/nixos/hardware/astro-a50-dock.sh
Normal file
13
modules/nixos/hardware/astro-a50-dock.sh
Normal file
@@ -0,0 +1,13 @@
|
||||
stdbuf -oL hexdump -v -e '32/2 "%x " "\n"' "$HID_DEVICE" | while read -r line; do
|
||||
echo "$line"
|
||||
if [[ $line =~ ^c02[[:space:]]4[[:space:]]13[[:space:]]([0-9a-f]+) ]]; then
|
||||
power_state=${BASH_REMATCH[1]}
|
||||
if [[ $power_state == "0" ]]; then
|
||||
echo "power=on"
|
||||
wpctl set-default "$(pw-cli info "$HEADSET_NAME" | head -n 1 | awk '{print $2}')"
|
||||
else
|
||||
echo "power=off"
|
||||
wpctl set-default "$(pw-cli info "$SPEAKERS_NAME" | head -n 1 | awk '{print $2}')"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user