From e457afccd30530153d075d0bbb41078fcecef669 Mon Sep 17 00:00:00 2001 From: Jakob Odersky Date: Fri, 29 Jun 2018 17:56:06 -0700 Subject: Toggle bluetooth on click --- home/.config/i3/status/bluetooth | 17 +++++++++++++++-- 1 file 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 -- cgit v1.2.3