inital commit
This commit is contained in:
55
mscplyr
Executable file
55
mscplyr
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
|
||||
filter() {
|
||||
sed "/^volume:/d" | tac | sed -e "s/\\&/&/g;s/\\[paused\\].*/<span color=\"gray\" font_style=\"italic\">/g;s/\\[playing\\].*/<span>/g" | tr -d '\n' |sed -e "s/$/<\/span>\n/g"
|
||||
}
|
||||
player=""
|
||||
|
||||
[ -z $BLOCK_INSTANCE ] || player="--player=$BLOCK_INSTANCE"
|
||||
|
||||
case $BLOCK_INSTANCE in
|
||||
"mpd") playprog="$TERMINAL -e ncmpcpp" ;;
|
||||
"spotify") playprog="$TERMINAL -e spt" ;;
|
||||
"cmus") playprog="$TERMINAL -e cmus" ;;
|
||||
"vlc" ) playprog="vlc" ;;
|
||||
*) playprog="" ;;
|
||||
esac
|
||||
|
||||
if [ "$BLOCK_INSTANCE" == "mpd" ]; then
|
||||
status() { mpc status | filter ;}
|
||||
toggle() { mpc toggle | filter ;}
|
||||
next() { mpc next | filter ;}
|
||||
prev() { mpc prev | filter ;}
|
||||
else
|
||||
status() {
|
||||
playerctl metadata $player -f '{{artist}} - {{title}}
|
||||
[{{lc(status)}}]' | filter
|
||||
}
|
||||
|
||||
toggle() {
|
||||
playerctl play-pause $player
|
||||
status
|
||||
}
|
||||
|
||||
next() {
|
||||
playerctl next $player
|
||||
status
|
||||
}
|
||||
prev() {
|
||||
playerctl previous $player
|
||||
status
|
||||
}
|
||||
fi
|
||||
|
||||
case $BLOCK_BUTTON in
|
||||
1) status && setsid $playprog & ;;
|
||||
2) toggle ;;
|
||||
3) status && notify-send "🎵 Music module" "\- Shows playing song.
|
||||
- Italic when paused.
|
||||
- Left click opens player.
|
||||
- Middle click pauses.
|
||||
- Scroll changes tracks.:" ;;
|
||||
4) prev ;;
|
||||
5) next ;;
|
||||
*) status ;;
|
||||
esac; exit
|
||||
Reference in New Issue
Block a user