#!/bin/sh -x checkstate() { if [ "$(bluetoothctl show | grep "Powered: yes")" ]; then echo "󰂯 ON" else echo "󰂲 OFF" fi } switchstate() { case "$(checkstate | fuzzel -d)" in "󰂯 ON") bluetoothctl power off notify-send "Bluetooth" "Bluetooth is disabled" ;; "󰂲 OFF") echo "Bluetooth is enabled" bluetoothctl power on notify-send "Bluetooth" "Bluetooth is enabled" ;; *) exit ;; esac } checkstate() { if [ "$(bluetoothctl show | grep "Powered: yes")" ]; then echo "󰂯 ON" else echo "󰂲 OFF" fi } switchstate() { case "$(checkstate | fuzzel -d)" in "󰂯 ON") bluetoothctl power off notify-send "Bluetooth" "Bluetooth is disabled" ;; "󰂲 OFF") echo "Bluetooth is enabled" bluetoothctl power on notify-send "Bluetooth" "Bluetooth is enabled" ;; *) exit ;; esac } case $(printf "%s\n" "󰂯 Connect Device" "󰂳 Change State" | fuzzel -d) in "󰂯 Connect Device") echo menu ;; "󰂳 Change State") switchstate ;; *) exit ;; esac