Polybar: switched to pulseaudio module; bluetooth and temperature modules are loaded only when the respective devices are available

master
Meliurwen 2 years ago
parent 2affd69042
commit c275ec857d
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 11
      polybar/.config/polybar/config
  2. 17
      polybar/.config/polybar/launch.sh

@ -52,7 +52,7 @@ font-3 = "Material Wifi Signal Enhanced:style=Regular:weight=bold:size=10"
#modules-left = i3 clementine mpv
modules-left = i3 mpv
modules-center = date
modules-right = temperature bluetooth wireless-network wired-network alsa battery
modules-right = ${env:POLY_MODR}
separator = " "
spacing = 0
@ -114,18 +114,17 @@ ramp-capacity-2 =
ramp-capacity-3 =
ramp-capacity-4 =
[module/alsa]
type = internal/alsa
[module/pulseaudio]
type = internal/pulseaudio
use-ui-max = false
interval = 5
format-volume = <ramp-volume>
format-muted = <label-muted>
label-muted =
label-muted-foreground = ${color.grey}
; You cannot customize click actions on official modules? Really?!? >:(
;click-right = exec pavucontrol
click-right = exec pavucontrol
; Only applies if <ramp-volume> is used
ramp-volume-0 =
ramp-volume-1 =
ramp-volume-2 =

@ -20,6 +20,8 @@ do
done
unset cycle
POLY_MODR="wireless-network wired-network pulseaudio battery"
NET_IFACES="$(ip link show | awk '/^[0-9]+:/ {sub(/:/,"",$2); print $2}')"
for NET_IFACE in $NET_IFACES ; do
case $NET_IFACE in
@ -34,13 +36,24 @@ if [ -d "$HWMON_MODULE" ]; then
HWMON_BASEDIR="$(find "$HWMON_MODULE" -maxdepth 1 -type d -name 'hwmon*' | tail -n +2 | head -1)"
POLY_HWMON="$HWMON_BASEDIR"/temp1_input
unset HWMON_BASEDIR
POLY_MODR="temperature $POLY_MODR"
fi
unset HWMON_MODULE
# Skip if the folder doesn't exist (kernel module not loaded) or it's empty
if [ ! -d /sys/class/bluetooth ]; then
:
elif [ -z "$(ls -A /sys/class/bluetooth)" ]; then
:
else
POLY_MODR="bluetooth $POLY_MODR"
fi
if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
POLY_WLP=$POLY_WLP POLY_ENP=$POLY_ENP POLY_HWMON=$POLY_HWMON MONITOR=$m polybar main -c "$HOME/.config/polybar/config" &
POLY_WLP=$POLY_WLP POLY_ENP=$POLY_ENP POLY_HWMON=$POLY_HWMON POLY_MODR="$POLY_MODR" MONITOR=$m \
polybar main -c "$HOME/.config/polybar/config" &
done
fi
unset POLY_WLP POLY_ENP POLY_HWMON
unset POLY_WLP POLY_ENP POLY_HWMON POLY_MODR

Loading…
Cancel
Save