Created
October 28, 2020 01:33
-
-
Save Vresod/c2fea668b20708c63f8fef6f7eec38b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
updatesonglist() { | |
IFS=" | |
" | |
songlist="" | |
for i in $(mpc listall|sed "s/ /@/g"); do songlist="$(echo "$i"|awk -F '....$' '{print $1}')\n$songlist"; done | |
IFS="" | |
songlist=$(echo $songlist|sed "s/@/ /g"|sort) | |
} | |
action=$(printf "toggle\nplay\npause\nnext\nprev\nsong\nrestart"|rofi -dmenu -p mpd -mesg "playing $(mpc status|head -n 1) $([ $(mpc status|awk -F '[][]' '{print $2}'|tail -n 2|head -n 1) = 'paused' ] && echo '(paused)')") || exit 1 | |
[ $action = "song" ] && (updatesonglist && toplay=$(echo $songlist|rofi -dmenu -p play -no-custom) && mpc searchplay $toplay) && exit | |
[ $action = "restart" ] && mpc prev && mpc next && exit | |
mpc $action |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment