aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Odersky <jakob@driver.xyz>2018-06-29 17:56:06 -0700
committerJakob Odersky <jakob@odersky.com>2018-07-02 20:15:43 -0700
commite457afccd30530153d075d0bbb41078fcecef669 (patch)
tree50fbc184d99784f56c0054f8c10d34deab3040ef
parent6b30112b0980addd8de949fdac26e684d8c3919c (diff)
downloaddotfiles-e457afccd30530153d075d0bbb41078fcecef669.tar.gz
dotfiles-e457afccd30530153d075d0bbb41078fcecef669.tar.bz2
dotfiles-e457afccd30530153d075d0bbb41078fcecef669.zip
Toggle bluetooth on click
-rwxr-xr-xhome/.config/i3/status/bluetooth17
1 files changed, 15 insertions, 2 deletions
diff --git a/home/.config/i3/status/bluetooth b/home/.config/i3/status/bluetooth
index 3c2f9f1..d0c84be 100755
--- a/home/.config/i3/status/bluetooth
+++ b/home/.config/i3/status/bluetooth
@@ -1,6 +1,19 @@
#!/bin/bash
-if (/usr/sbin/rfkill list bluetooth --output SOFT,HARD --noheadings \
- | grep -w blocked --quiet); then
+
+is_blocked() {
+ /usr/sbin/rfkill list bluetooth --output SOFT,HARD --noheadings \
+ | grep -w blocked --quiet
+}
+
+if [[ -n $BLOCK_BUTTON ]]; then
+ if is_blocked; then
+ /usr/sbin/rfkill unblock bluetooth
+ else
+ /usr/sbin/rfkill block bluetooth
+ fi
+fi
+
+if is_blocked; then
echo "OFF"
echo "blocked"
else