diff options
| author | srdusr <trevorgray@srdusr.com> | 2024-01-28 19:57:55 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2024-01-28 19:57:55 +0200 |
| commit | e34fef54cfb036fbb84ce5c05b0f980868530c2e (patch) | |
| tree | 8c8a38a89f83dd2ce650491d7ab0b27fe46a8747 /assets | |
| parent | 63f3e4bcc721bf19ae525b6ad7d2bece17228393 (diff) | |
| download | dotfiles-e34fef54cfb036fbb84ce5c05b0f980868530c2e.tar.gz dotfiles-e34fef54cfb036fbb84ce5c05b0f980868530c2e.zip | |
Add assets/panel
Diffstat (limited to 'assets')
| -rwxr-xr-x | assets/panel | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/assets/panel b/assets/panel new file mode 100755 index 0000000..2464756 --- /dev/null +++ b/assets/panel @@ -0,0 +1,87 @@ +#!/bin/sh +# +# Lemonbar script +# + +PANEL_FIFO=/tmp/panel-fifo + +#PANEL_FONT_FAMILY="ProFont:size=8" +PANEL_FONT_FAMILY="cure:size=8" +ICON_FONT="Stlarch:size=14" + + +if [ $(pgrep -cx panel) -gt 1 ] ; then + printf "%s\n" "The panel is already running." >&2 + exit 1 +fi + +trap 'trap - TERM; kill 0' INT TERM QUIT EXIT + +[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO" +mkfifo "$PANEL_FIFO" + +TOP_PADDING=$((PANEL_HEIGHT + 20)) +#bspc config top_padding $PANEL_HEIGHT +bspc config top_padding $TOP_PADDING +bspc control --subscribe > "$PANEL_FIFO" & + +# title +xtitle -sf 'T%s' > "$PANEL_FIFO" & + +# clock +while true; + do + echo 'C' $(date +"%H:%M") ; + sleep 5; +done > "$PANEL_FIFO" & + +# date +while true; + do + echo 'D' $(date +'%b %d'); + sleep 5; +done > $PANEL_FIFO & + +# alsa volume +while true; +do + ALSA_VOLUME=$(amixer -D pulse get Master | grep -o '...%' | head -n 1 | sed 's/\[//' | sed 's/%//' | sed 's/ //' ) + if [ $ALSA_VOLUME -ge 70 ] + then + echo V'' $ALSA_VOLUME + fi + if [ $ALSA_VOLUME -gt 0 -a $ALSA_VOLUME -lt 70 ] + then + echo V'' $ALSA_VOLUME + fi + if [ $ALSA_VOLUME -eq 0 ] + then + echo V'' $ALSA_VOLUME + fi + + sleep 0.1 +done > $PANEL_FIFO & + +# music +while true; +do + SONG_NAME=$(mpc current) + if [[ -n $(mpc status | grep paused) ]] + then + echo "R%{A:mpc prev:}%{A} %{A:mpc play:}%{A} %{A:mpc next:}%{A} $PADDING$PADDING $SONG_NAME" + else + echo "R%{A:mpc prev:}%{A} %{A:mpc pause:}%{A} %{A:mpc next:}%{A} $PADDING$PADDING $SONG_NAME" + fi + sleep 1 +done > $PANEL_FIFO & + +# power +echo P'' > $PANEL_FIFO & + +. panel_colors + + + +cat "$PANEL_FIFO" | panel_bar | lemonbar -g 1850x$PANEL_HEIGHT+35+13 -f "$PANEL_FONT_FAMILY" -f "$ICON_FONT" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -u 1 | sh & + +wait |
