improved bluetooth phones detecting

This commit is contained in:
bvn13 2020-12-15 13:13:03 +03:00
parent 550e68bfff
commit 4c6da81c7f
3 changed files with 16 additions and 5 deletions

11
check-bt.sh Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
if [[ $(pactl list short | grep 'bluez_sink.2C_4D_79_47_42_9F') ]]; then
if [[ $(pactl list short | grep 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]') ]]; then
echo $(pactl list short | grep -e 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' | awk '{print "ZOOM:"$NF}');
else
echo 'MUSIC';
fi
else
echo 'OFF';
fi

4
config
View File

@ -12,13 +12,15 @@ set $mod Mod4
# is used in the bar {} block below. # is used in the bar {} block below.
#font pango:monospace 8 #font pango:monospace 8
#font pango:Iosevka Medium 8 #font pango:Iosevka Medium 8
font pango:Liberation Mono:style=Regular 8
#font pango:Cantarell:style=Regular 10
# This font is widely installed, provides lots of unicode glyphs, right-to-left # This font is widely installed, provides lots of unicode glyphs, right-to-left
# text rendering and scalability on retina/hidpi displays (thanks to pango). # text rendering and scalability on retina/hidpi displays (thanks to pango).
#font pango:DejaVu Sans Mono 8 #font pango:DejaVu Sans Mono 8
# Before i3 v4.8, we used to recommend this one as the default: # Before i3 v4.8, we used to recommend this one as the default:
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1 #font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
# The font above is very space-efficient, that is, it looks good, sharp and # The font above is very space-efficient, that is, it looks good, sharp and
# clear in small sizes. However, its unicode glyph coverage is limited, the old # clear in small sizes. However, its unicode glyph coverage is limited, the old
# X core fonts rendering does not support right-to-left and this being a bitmap # X core fonts rendering does not support right-to-left and this being a bitmap

View File

@ -397,12 +397,10 @@ menu-2-1-exec = menu-open-0
[module/zoom-audio] [module/zoom-audio]
type = custom/script type = custom/script
;exec = pactl list short | grep -e 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' | awk '{print $NF}' || 'NORMAL'
label = 🎧 %output% label = 🎧 %output%
interval = 0.5 interval = 0.5
exec = pactl list short | grep -q 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' && echo $(pactl list short | grep -e 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' | awk '{print "ZOOM:"$NF}') || echo 'MUSIC' ;exec = pactl list short | grep -q 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' && (echo $(pactl list short | grep -e 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' | awk '{print "ZOOM:"$NF}') || echo 'MUSIC') || echo 'OFF'
;click-left = pactl set-card-profile bluez_card.2C_4D_79_47_42_9F headset_head_unit exec = $HOME/.config/i3/check-bt.sh
;click-right = pactl set-card-profile bluez_card.2C_4D_79_47_42_9F a2dp_sink
click-left = pactl list short | grep -q 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' && pactl set-card-profile bluez_card.2C_4D_79_47_42_9F a2dp_sink || pactl set-card-profile bluez_card.2C_4D_79_47_42_9F headset_head_unit click-left = pactl list short | grep -q 'bluez_sink.2C_4D_79_47_42_9F.headset_head_unit[^.]' && pactl set-card-profile bluez_card.2C_4D_79_47_42_9F a2dp_sink || pactl set-card-profile bluez_card.2C_4D_79_47_42_9F headset_head_unit
click-right = $HOME/.config/i3/rofi-btooth click-right = $HOME/.config/i3/rofi-btooth