mirror of
https://github.com/alrayyes/dotfiles/
synced 2023-11-14 15:56:30 +00:00
Desktop polybar audio widget now uses pulseaudio, as does the volume script
This commit is contained in:
parent
da371ab7aa
commit
2b18e4aa9d
@ -1,32 +1,35 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This is a very hacky way of doing this. Default sink for desktop is 0 and for laptop is 3. Kies de eerste de beste die werkt
|
||||
if pamixer --list-sinks | grep -q "^0"; then
|
||||
sink=0
|
||||
elif pamixer --list-sinks | grep -q "^3"; then
|
||||
sink=3
|
||||
fi
|
||||
|
||||
if [ "$1" == "inc" ]; then
|
||||
amixer -q sset Master 5%+
|
||||
pactl -- set-sink-volume "$sink" +5%
|
||||
fi
|
||||
|
||||
if [ "$1" == "dec" ]; then
|
||||
amixer -q sset Master 5%-
|
||||
pactl -- set-sink-volume "$sink" -5%
|
||||
fi
|
||||
|
||||
if [ "$1" == "mute" ]; then
|
||||
amixer -q sset Master toggle
|
||||
pactl -- set-sink-mute "$sink" toggle
|
||||
fi
|
||||
|
||||
|
||||
AMIXER=$(amixer sget Master)
|
||||
VOLUME=$(echo "$AMIXER" | grep 'Mono\|Front Right:' | awk -F'[][]' '{ print $2 }' | tr -d "%")
|
||||
MUTE=$(echo "$AMIXER" | grep -o '\[off\]' | tail -n 1)
|
||||
if [ "$MUTE" == "[off]" ]; then
|
||||
ICON=audio-volume-muted
|
||||
VOLUME=$(pamixer --sink "$sink" --get-volume)
|
||||
if [ "$(pamixer --sink "$sink" --get-mute)" == "true" ]; then
|
||||
ICON=audio-volume-muted
|
||||
elif [ "$VOLUME" -le 20 ]; then
|
||||
ICON=audio-volume-low
|
||||
ICON=audio-volume-low
|
||||
elif [ "$VOLUME" -le 60 ]; then
|
||||
ICON=audio-volume-medium
|
||||
else
|
||||
ICON=audio-volume-high
|
||||
fi
|
||||
|
||||
ICON=audio-volume-medium
|
||||
else
|
||||
ICON=audio-volume-high
|
||||
fi
|
||||
|
||||
notify-send.py "Volume" "$VOLUME/100" \
|
||||
--hint string:image-path:$ICON boolean:transient:true \
|
||||
--replaces-process "volume-popup"
|
||||
--hint string:image-path:$ICON boolean:transient:true \
|
||||
--replaces-process "volume-popup" &
|
||||
|
@ -14,6 +14,7 @@ foreground-alt = ${xrdb:color7:#222}
|
||||
primary = ${xrdb:color1:#222}
|
||||
secondary = ${xrdb:color2:#222}
|
||||
alert = ${xrdb:color3:#222}
|
||||
disabled = #666
|
||||
|
||||
[bar/base]
|
||||
background = ${colors.background}
|
||||
@ -246,36 +247,15 @@ label = %date% %time%
|
||||
label-padding-right=1
|
||||
|
||||
[module/volume]
|
||||
type = internal/alsa
|
||||
type = internal/pulseaudio
|
||||
|
||||
sink = alsa_output.pci-0000_00_1b.0.iec958-stereo
|
||||
|
||||
format-volume = <label-volume>
|
||||
label-volume = 蓼 %percentage%%
|
||||
label-volume-foreground = ${root.foreground}
|
||||
|
||||
format-muted-prefix =
|
||||
format-muted-foreground = ${colors.foreground-alt}
|
||||
label-muted = "遼"
|
||||
label-muted-foreground = ${colors.disabled}
|
||||
|
||||
bar-volume-width = 10
|
||||
bar-volume-foreground-0 = #55aa55
|
||||
bar-volume-foreground-1 = #55aa55
|
||||
bar-volume-foreground-2 = #55aa55
|
||||
bar-volume-foreground-3 = #55aa55
|
||||
bar-volume-foreground-4 = #55aa55
|
||||
bar-volume-foreground-5 = #f5a70a
|
||||
bar-volume-foreground-6 = #ff5555
|
||||
bar-volume-gradient = false
|
||||
bar-volume-indicator = |
|
||||
bar-volume-indicator-font = 2
|
||||
bar-volume-fill = ─
|
||||
bar-volume-fill-font = 2
|
||||
bar-volume-empty = ─
|
||||
bar-volume-empty-font = 2
|
||||
bar-volume-empty-foreground = ${colors.foreground-alt}
|
||||
|
||||
ramp-volume-0 =
|
||||
ramp-volume-1 =
|
||||
ramp-volume-2 =
|
||||
click-right = pavucontrol &
|
||||
|
||||
[module/volume-laptop]
|
||||
type = internal/pulseaudio
|
||||
@ -284,7 +264,7 @@ sink = alsa_output.pci-0000_00_1f.3.analog-stereo
|
||||
|
||||
label-volume = 蓼 %percentage%%
|
||||
label-muted = "遼"
|
||||
label-muted-foreground = #666
|
||||
label-muted-foreground = ${colors.disabled}
|
||||
|
||||
click-right = pavucontrol &
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user