mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-06-27 03:58:51 +02:00
rofi-mediaplayer: display current track when playing
This commit is contained in:
parent
7f7bfd20ec
commit
24a07e8165
2 changed files with 14 additions and 5 deletions
|
@ -1,12 +1,21 @@
|
||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# Media player menu with rofi
|
# Media player menu with rofi
|
||||||
|
|
||||||
|
mediaplayer=$1
|
||||||
|
status=$(playerctl -p $mediaplayer status)
|
||||||
|
case $status in
|
||||||
|
Playing|Paused)
|
||||||
|
title="$(playerctl -p $mediaplayer metadata xesam:title)"
|
||||||
|
artist="$(playerctl -p $mediaplayer metadata xesam:artist)"
|
||||||
|
status="$status <span weight='light'><i>${title} (${artist})</i></span>"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
choice=$(
|
choice=$(
|
||||||
while read icon description
|
while read icon description
|
||||||
do
|
do
|
||||||
printf "$description\00icon\37$icon\n"
|
printf "$description\00icon\37$icon\n"
|
||||||
done <<EOF | rofi -dmenu -show-icons -no-custom -i -p "media player action" \
|
done <<EOF | rofi -dmenu -show-icons -no-custom -i -p "media player action" -mesg "$status" \
|
||||||
-kb-select-1 Super+z \
|
-kb-select-1 Super+z \
|
||||||
-kb-select-2 Super+x \
|
-kb-select-2 Super+x \
|
||||||
-kb-select-3 Super+c \
|
-kb-select-3 Super+c \
|
||||||
|
@ -20,7 +29,7 @@ media-playback-pause Pause
|
||||||
media-playback-stop Stop
|
media-playback-stop Stop
|
||||||
go-next Next track
|
go-next Next track
|
||||||
multimedia-volume-control Open mixer panel
|
multimedia-volume-control Open mixer panel
|
||||||
com.spotify.Client Open Spotify
|
com.spotify.Client Open ${mediaplayer^}
|
||||||
EOF
|
EOF
|
||||||
)
|
)
|
||||||
case $choice in
|
case $choice in
|
||||||
|
@ -30,5 +39,5 @@ case $choice in
|
||||||
Pause) xdotool key --clearmodifiers XF86AudioPause ;;
|
Pause) xdotool key --clearmodifiers XF86AudioPause ;;
|
||||||
Stop) xdotool key --clearmodifiers XF86AudioStop ;;
|
Stop) xdotool key --clearmodifiers XF86AudioStop ;;
|
||||||
*mixer*) i3-msg '[class="Pavucontrol"] focus' || i3-msg exec exec pavucontrol ;;
|
*mixer*) i3-msg '[class="Pavucontrol"] focus' || i3-msg exec exec pavucontrol ;;
|
||||||
*Spotify*) i3-msg '[class="Spotify"] focus' || i3-msg exec exec spotify ;;
|
*Spotify*) i3-msg '[class="'${mediaplayer^}'"] focus' || i3-msg exec exec spotify ;;
|
||||||
esac
|
esac
|
||||||
|
|
2
config
2
config
|
@ -31,7 +31,7 @@ bindsym XF86AudioPause exec --no-startup-id exec playerctl -p $mediaplayer
|
||||||
bindsym XF86AudioStop exec --no-startup-id exec playerctl -p $mediaplayer stop
|
bindsym XF86AudioStop exec --no-startup-id exec playerctl -p $mediaplayer stop
|
||||||
bindsym XF86AudioNext exec --no-startup-id exec playerctl -p $mediaplayer next
|
bindsym XF86AudioNext exec --no-startup-id exec playerctl -p $mediaplayer next
|
||||||
bindsym XF86AudioPrev exec --no-startup-id exec playerctl -p $mediaplayer previous
|
bindsym XF86AudioPrev exec --no-startup-id exec playerctl -p $mediaplayer previous
|
||||||
bindsym $mod+s exec --no-startup-id exec ~/.config/i3/bin/rofi-mediaplayer
|
bindsym $mod+s exec --no-startup-id exec ~/.config/i3/bin/rofi-mediaplayer $mediaplayer
|
||||||
|
|
||||||
# Brightness
|
# Brightness
|
||||||
bindsym XF86MonBrightnessUp exec --no-startup-id exec brightnessctl set +5%
|
bindsym XF86MonBrightnessUp exec --no-startup-id exec brightnessctl set +5%
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue