summaryrefslogtreecommitdiff
path: root/polybar
diff options
context:
space:
mode:
authorShubham Saini <pryr@pryr.xyz>2022-11-21 03:08:10 +0000
committerShubham Saini <pryr@pryr.xyz>2022-11-21 03:08:10 +0000
commitbce233a4370cd8a1d5f50dc36aa47b220df89c16 (patch)
tree3e04c364a2eca72f5f690784770c5f3413226bb5 /polybar
parentef89f8f0b05e4285d2439fb5fdd00820f9cedb68 (diff)
bt script: added connect
Diffstat (limited to 'polybar')
-rwxr-xr-xpolybar/.config/polybar/bt.sh13
-rwxr-xr-xpolybar/.config/polybar/config3
2 files changed, 14 insertions, 2 deletions
diff --git a/polybar/.config/polybar/bt.sh b/polybar/.config/polybar/bt.sh
index 177932b..3f3b6ec 100755
--- a/polybar/.config/polybar/bt.sh
+++ b/polybar/.config/polybar/bt.sh
@@ -3,7 +3,6 @@
3bluetooth_print() { 3bluetooth_print() {
4 bluetoothctl | while read -r; do 4 bluetoothctl | while read -r; do
5 if [ "$(systemctl is-active "bluetooth.service")" = "active" ]; then 5 if [ "$(systemctl is-active "bluetooth.service")" = "active" ]; then
6 # printf 'on'
7 6
8 devices_paired=$(bluetoothctl devices | grep Device | cut -d ' ' -f 2) 7 devices_paired=$(bluetoothctl devices | grep Device | cut -d ' ' -f 2)
9 counter=0 8 counter=0
@@ -54,10 +53,22 @@ bluetooth_toggle() {
54 fi 53 fi
55} 54}
56 55
56bluetooth_connect() {
57 if bluetoothctl show | grep -q "Powered: yes"; then
58 devices_paired=$(bluetoothctl devices | grep Device | cut -d ' ' -f 2)
59 echo "$devices_paired" | while read -r line; do
60 bluetoothctl connect "$line" >> /dev/null
61 done
62 fi
63}
64
57case "$1" in 65case "$1" in
58 --toggle) 66 --toggle)
59 bluetooth_toggle 67 bluetooth_toggle
60 ;; 68 ;;
69 --connect)
70 bluetooth_connect
71 ;;
61 *) 72 *)
62 bluetooth_print 73 bluetooth_print
63 ;; 74 ;;
diff --git a/polybar/.config/polybar/config b/polybar/.config/polybar/config
index 425e225..72e4c65 100755
--- a/polybar/.config/polybar/config
+++ b/polybar/.config/polybar/config
@@ -187,7 +187,8 @@ bar-progress-empty = ─
187type = custom/script 187type = custom/script
188exec = ~/.config/polybar/bt.sh 188exec = ~/.config/polybar/bt.sh
189tail = true 189tail = true
190click-left = ~/.config/polybar/bt.sh --toggle & 190click-left = ~/.config/polybar/bt.sh --connect &
191click-right = ~/.config/polybar/bt.sh --toggle &
191format = tooth <label> 192format = tooth <label>
192label = %output% 193label = %output%
193label-foreground = #EEFFFF 194label-foreground = #EEFFFF