vincentbernat.i3wm-configur.../bin/rofi-mediaplayer

35 lines
1.2 KiB
Text
Raw Normal View History

2021-07-20 22:27:49 +02:00
#!/bin/sh
# Media player menu with rofi
choice=$(
while read icon description
do
printf "$description\00icon\37$icon\n"
done <<EOF | rofi -dmenu -show-icons -no-custom -i -p "media player action" \
2021-07-20 22:27:49 +02:00
-kb-select-1 Super+z \
-kb-select-2 Super+x \
-kb-select-3 Super+c \
-kb-select-4 Super+v \
-kb-select-5 Super+b \
-kb-select-6 Super+m \
-kb-select-7 Super+s
go-previous Previous track
media-playback-start Play
media-playback-pause Pause
media-playback-stop Stop
go-next Next track
multimedia-volume-control Open mixer panel
com.spotify.Client Open Spotify
EOF
2021-07-20 22:27:49 +02:00
)
case $choice in
Previous*) xdotool key --clearmodifiers XF86AudioPrev ;;
Next*) xdotool key --clearmodifiers XF86AudioNext ;;
Play) xdotool key --clearmodifiers XF86AudioPlay ;;
Pause) xdotool key --clearmodifiers XF86AudioPause ;;
Stop) xdotool key --clearmodifiers XF86AudioStop ;;
*mixer*) i3-msg '[class="Pavucontrol"] focus' || i3-msg exec exec pavucontrol ;;
2021-07-20 22:27:49 +02:00
*Spotify*) i3-msg '[class="Spotify"] focus' || i3-msg exec exec spotify ;;
esac