mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2025-06-29 20:20:41 +00:00
Add lemonbar implementation for bspwm
This commit is contained in:
parent
a916b15d11
commit
2ef59a7720
7 changed files with 472 additions and 0 deletions
38
home/.config/lemonbar/applet-pulse
Executable file
38
home/.config/lemonbar/applet-pulse
Executable file
|
@ -0,0 +1,38 @@
|
|||
#!/usr/bin/env zsh
|
||||
|
||||
PANEL_FIFO="$1"
|
||||
PREFIX="$2"
|
||||
ICONS=($(echo "$3" | tr ";" "\n"))
|
||||
|
||||
exec 5>"$PANEL_FIFO"
|
||||
|
||||
main() {
|
||||
local cmd=( $(amixer -M get Master) )
|
||||
local playback_level="${cmd[-2][2,-3]}"
|
||||
local icon=""
|
||||
|
||||
if [[ "${cmd[-1]}" == "[off]" ]]; then
|
||||
icon="${ICONS[1]}"
|
||||
else
|
||||
if [[ "$playback_level" -eq 0 ]]; then
|
||||
icon="${ICONS[2]}"
|
||||
elif [[ "$playback_level" -lt 30 ]]; then
|
||||
icon="${ICONS[3]}"
|
||||
elif [[ "$playback_level" -lt 60 ]]; then
|
||||
icon="${ICONS[4]}"
|
||||
elif [[ "$playback_level" -lt 100 ]]; then
|
||||
icon="${ICONS[5]}"
|
||||
else
|
||||
icon="${ICONS[6]}"
|
||||
fi
|
||||
fi
|
||||
|
||||
REPLY="$icon $playback_level%"
|
||||
}
|
||||
|
||||
{print init; stdbuf -oL alsactl monitor pulse} | while read line; do
|
||||
case ${line} in
|
||||
*Master\ Playback*|init ) main; print "$PREFIX $REPLY" >&5 ;;
|
||||
* ) continue ;;
|
||||
esac
|
||||
done
|
Loading…
Add table
Add a link
Reference in a new issue