added waybar config for laptop
This commit is contained in:
18
.config/waybar/scripts/bt_toggle.sh
Executable file
18
.config/waybar/scripts/bt_toggle.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
status() { bluetoothctl show 2>/dev/null | awk '/Powered:/ {print tolower($2); exit}'; } # yes/no
|
||||
print() {
|
||||
s="$(status)"; s="${s:-no}"
|
||||
if [ "$s" = "yes" ]; then
|
||||
echo '{"text":"","class":"on","tooltip":"Bluetooth: on (click to toggle)"}'
|
||||
else
|
||||
echo '{"text":"","class":"off","tooltip":"Bluetooth: off (click to toggle)"}'
|
||||
fi
|
||||
}
|
||||
case "${1:---print}" in
|
||||
--toggle) [ "$(status)" = "yes" ] && bluetoothctl power off || bluetoothctl power on ;;
|
||||
--print) : ;;
|
||||
*) echo "Usage: $0 [--toggle|--print]"; exit 1 ;;
|
||||
esac
|
||||
print
|
||||
|
Reference in New Issue
Block a user