diff options
author | Shubham Saini <pryr@pryr.xyz> | 2022-11-21 03:08:10 +0000 |
---|---|---|
committer | Shubham Saini <pryr@pryr.xyz> | 2022-11-21 03:08:10 +0000 |
commit | bce233a4370cd8a1d5f50dc36aa47b220df89c16 (patch) | |
tree | 3e04c364a2eca72f5f690784770c5f3413226bb5 /polybar | |
parent | ef89f8f0b05e4285d2439fb5fdd00820f9cedb68 (diff) |
bt script: added connect
Diffstat (limited to 'polybar')
-rwxr-xr-x | polybar/.config/polybar/bt.sh | 13 | ||||
-rwxr-xr-x | polybar/.config/polybar/config | 3 |
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 @@ | |||
3 | bluetooth_print() { | 3 | bluetooth_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 | ||
56 | bluetooth_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 | |||
57 | case "$1" in | 65 | case "$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 = ─ | |||
187 | type = custom/script | 187 | type = custom/script |
188 | exec = ~/.config/polybar/bt.sh | 188 | exec = ~/.config/polybar/bt.sh |
189 | tail = true | 189 | tail = true |
190 | click-left = ~/.config/polybar/bt.sh --toggle & | 190 | click-left = ~/.config/polybar/bt.sh --connect & |
191 | click-right = ~/.config/polybar/bt.sh --toggle & | ||
191 | format = tooth <label> | 192 | format = tooth <label> |
192 | label = %output% | 193 | label = %output% |
193 | label-foreground = #EEFFFF | 194 | label-foreground = #EEFFFF |