Polybar Mic button and cleaning up code

This commit is contained in:
Michał Gdula 2022-04-26 23:20:46 +01:00
parent 3b2fca577a
commit 54b578567c
7 changed files with 44 additions and 9 deletions

View file

@ -59,7 +59,7 @@ font-3 = Material:size=13;2
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
modules-left = dateL date dateR space timeL time timeR modules-left = dateL date dateR space timeL time timeR
modules-center = spotifyL spotify spotifyR modules-center = spotifyL spotify spotifyR
modules-right = sysiconL dnd updates network bluetooth sysiconR space1 volumeL volume volumeR space2 powerL power powerR modules-right = sysiconL dnd updates network bluetooth sysiconR space1 volumeL mic volume volumeR space2 powerL power powerR
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-

View file

@ -1,4 +1,5 @@
#!/bin/sh #!/bin/sh
if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ] if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]
then then
echo "%{F#666}" echo "%{F#666}"

9
polybar/scripts/mic.sh Executable file
View file

@ -0,0 +1,9 @@
#!/bin/sh
value=$(amixer get Capture | grep '\[off\]')
if [ "$value" == "" ]; then
echo " ";
else
echo "%{F#666} ";
fi

View file

@ -1,5 +1,8 @@
#!/bin/sh #!/bin/sh
if [ $(bluetoothctl show | grep "Powered: yes" | wc -c) -eq 0 ]
value=$(bluetoothctl show | grep "Powered: yes" | wc -c)
if [ "$value" == 0 ]
then then
bluetoothctl power on bluetoothctl power on
else else

View file

@ -2,8 +2,7 @@
value=$(gsettings get org.gnome.desktop.notifications show-banners) value=$(gsettings get org.gnome.desktop.notifications show-banners)
if [ $value == "true" ] if [ "$value" == "true" ]; then
then
gsettings set org.gnome.desktop.notifications show-banners false gsettings set org.gnome.desktop.notifications show-banners false
else else
gsettings set org.gnome.desktop.notifications show-banners true gsettings set org.gnome.desktop.notifications show-banners true

View file

@ -1,8 +1,8 @@
#!/bin/sh #!/bin/sh
b=$(pacman -Qu | wc -l) value=$(pacman -Qu | wc -l)
if [ "$b" != "0" ]; then if [ "$value" != "0" ]; then
echo " "; echo " ";
else else
echo ""; echo "";

View file

@ -26,6 +26,16 @@ label = "%time%"
format-background = ${colors.modback} format-background = ${colors.modback}
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; WEATHER
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
[module/weather]
type = custom/script
exec = ~/.config/polybar/scripts/weather-plugin.sh
tail = false
interval = 960
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; SPOTIFY ;; SPOTIFY
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
@ -54,7 +64,7 @@ format-background = ${colors.modback}
;format-padding = 1 ;format-padding = 1
exec = bash ~/.config/polybar/scripts/dnd.sh exec = bash ~/.config/polybar/scripts/dnd.sh
click-left = exec bash ~/.config/polybar/scripts/toggle_dnd.sh click-left = bash ~/.config/polybar/scripts/toggle_dnd.sh
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
@ -70,7 +80,7 @@ format-background = ${colors.modback}
format = <label> format = <label>
label = %output% label = %output%
exec = sh ~/.config/polybar/scripts/update_check.sh exec = bash ~/.config/polybar/scripts/update_check.sh
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
@ -103,9 +113,21 @@ format-background = ${colors.modback}
;format-padding = 1 ;format-padding = 1
exec = ~/.config/polybar/scripts/bluetooth.sh exec = ~/.config/polybar/scripts/bluetooth.sh
click-left = exec ~/.config/polybar/scripts/toggle_bluetooth.sh click-left = bash ~/.config/polybar/scripts/toggle_bluetooth.sh
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; MIC
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
[module/mic]
type = custom/script
interval = 1
format-background = ${colors.modback}
exec = ~/.config/polybar/scripts/mic.sh
click-left = amixer set Capture toggle &
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
;; VOLUME ;; VOLUME
;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_- ;;_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
@ -131,4 +153,5 @@ type = custom/script
exec = echo " " exec = echo " "
format-background = ${colors.modback} format-background = ${colors.modback}
format-prefix = " ☰" format-prefix = " ☰"
;format-prefix = " "
click-left = bash ~/.config/polybar/scripts/powermenu.sh & click-left = bash ~/.config/polybar/scripts/powermenu.sh &