mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-28 12:30:01 +02:00
rofi-mediaplayer: switch to a module script
This commit is contained in:
parent
cab4f6b8fd
commit
bfd6735c3d
1 changed files with 33 additions and 21 deletions
|
@ -2,13 +2,30 @@
|
||||||
|
|
||||||
# Media player menu with rofi
|
# Media player menu with rofi
|
||||||
|
|
||||||
mediaplayer=$1
|
if [ -z "${ROFI_OUTSIDE}" ]; then
|
||||||
choice=$(
|
export mediaplayer=$1
|
||||||
{
|
exec rofi -show-icons -no-custom -modi m:$0 -show m \
|
||||||
|
-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
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $ROFI_RETV in
|
||||||
|
0)
|
||||||
|
# Prompt
|
||||||
|
printf "\00prompt\x1fmedia player\n"
|
||||||
|
printf "\00message\x1f$...\n"
|
||||||
|
|
||||||
# Available actions
|
# Available actions
|
||||||
|
i=0
|
||||||
while read icon description
|
while read icon description
|
||||||
do
|
do
|
||||||
printf "$description\00icon\37$icon\n"
|
i=$((i+1))
|
||||||
|
printf "$description\00icon\x1f$icon\x1finfo\x1f$i\n"
|
||||||
done <<EOF
|
done <<EOF
|
||||||
go-previous Previous track
|
go-previous Previous track
|
||||||
media-playback-start Play
|
media-playback-start Play
|
||||||
|
@ -29,16 +46,9 @@ EOF
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
printf "\00message\x1f${status}\n"
|
printf "\00message\x1f${status}\n"
|
||||||
} | rofi -dmenu -show-icons -no-custom -i -p "media player action" -format d -async-pre-read 0 -mesg "..." \
|
;;
|
||||||
-kb-select-1 Super+z \
|
1)
|
||||||
-kb-select-2 Super+x \
|
case $ROFI_INFO in
|
||||||
-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
|
|
||||||
)
|
|
||||||
case $choice in
|
|
||||||
1) xdotool key --clearmodifiers XF86AudioPrev ;;
|
1) xdotool key --clearmodifiers XF86AudioPrev ;;
|
||||||
2) xdotool key --clearmodifiers XF86AudioPlay ;;
|
2) xdotool key --clearmodifiers XF86AudioPlay ;;
|
||||||
3) xdotool key --clearmodifiers XF86AudioPause ;;
|
3) xdotool key --clearmodifiers XF86AudioPause ;;
|
||||||
|
@ -46,4 +56,6 @@ case $choice in
|
||||||
5) xdotool key --clearmodifiers XF86AudioNext ;;
|
5) xdotool key --clearmodifiers XF86AudioNext ;;
|
||||||
6) i3-msg '[class="Pavucontrol"] focus' || i3-msg exec exec pavucontrol ;;
|
6) i3-msg '[class="Pavucontrol"] focus' || i3-msg exec exec pavucontrol ;;
|
||||||
7) i3-msg '[class="'${mediaplayer^}'"] focus' || i3-msg exec exec spotify ;;
|
7) i3-msg '[class="'${mediaplayer^}'"] focus' || i3-msg exec exec spotify ;;
|
||||||
|
esac >&2
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue