diff options
author | Jakob Odersky <jakob@driver.xyz> | 2018-06-29 17:56:06 -0700 |
---|---|---|
committer | Jakob Odersky <jakob@odersky.com> | 2018-07-02 20:15:43 -0700 |
commit | e457afccd30530153d075d0bbb41078fcecef669 (patch) | |
tree | 50fbc184d99784f56c0054f8c10d34deab3040ef /home/.config | |
parent | 6b30112b0980addd8de949fdac26e684d8c3919c (diff) | |
download | dotfiles-e457afccd30530153d075d0bbb41078fcecef669.tar.gz dotfiles-e457afccd30530153d075d0bbb41078fcecef669.tar.bz2 dotfiles-e457afccd30530153d075d0bbb41078fcecef669.zip |
Toggle bluetooth on click
Diffstat (limited to 'home/.config')
-rwxr-xr-x | home/.config/i3/status/bluetooth | 17 |
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 |