Media Playing Module with Buttons
- Replace clicks and scroll actions with dedicated buttons for media playing module - Add media-playing-change module to display current media source and left-click to change - Add media-playing-prev/next to play previous or next track - Add media-playing-play-pause to display pause button when media is playing and play button when media is paused - Update media-playing to use Zscroll to scroll through artist and title text when over limit - Add some extra helper scripts
This commit is contained in:
19
polybar/scripts/get-media-info.sh
Executable file
19
polybar/scripts/get-media-info.sh
Executable file
@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
echo " N/A"
|
||||
else
|
||||
artist=$(playerctl --player=playerctld metadata --format '{{ artist }}')
|
||||
title=$(playerctl --player=playerctld metadata --format '{{ title }}')
|
||||
|
||||
if [[ $artist == "" ]]; then
|
||||
artist="N/A"
|
||||
fi
|
||||
|
||||
if [[ $title == "" ]]; then
|
||||
title="N/A"
|
||||
fi
|
||||
|
||||
echo "$title - $artist"
|
||||
fi
|
@ -2,17 +2,10 @@
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
echo " N/A"
|
||||
echo "N/A"
|
||||
else
|
||||
artist=$(playerctl --player=playerctld metadata --format '{{ artist }}')
|
||||
title=$(playerctl --player=playerctld metadata --format '{{ title }}')
|
||||
status=$(playerctl --player=playerctld metadata --format '{{ status }}')
|
||||
|
||||
if [[ $status == "Paused" ]]; then
|
||||
status_icon=" "
|
||||
elif [[ $status == "Playing" ]]; then
|
||||
status_icon=" "
|
||||
fi
|
||||
|
||||
if [[ $artist == "" ]]; then
|
||||
artist="N/A"
|
||||
@ -22,5 +15,5 @@ else
|
||||
title="N/A"
|
||||
fi
|
||||
|
||||
echo "$status_icon $title - $artist"
|
||||
echo "ﱘ $title | ﴁ $artist"
|
||||
fi
|
||||
|
18
polybar/scripts/get-media-source-icon.sh
Executable file
18
polybar/scripts/get-media-source-icon.sh
Executable file
@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
echo "ﱙ"
|
||||
else
|
||||
trackid=$(playerctl --player=playerctld metadata --format '{{ mpris:trackid }}')
|
||||
|
||||
if grep -q -i "chromium" <<< "$trackid"; then
|
||||
echo ""
|
||||
elif grep -q -i "vlc" <<< "$trackid"; then
|
||||
echo "嗢"
|
||||
elif grep -q -i "spotify" <<< "$trackid"; then
|
||||
echo ""
|
||||
else
|
||||
echo "﴾"
|
||||
fi
|
||||
fi
|
14
polybar/scripts/get-media-status-icon.sh
Executable file
14
polybar/scripts/get-media-status-icon.sh
Executable file
@ -0,0 +1,14 @@
|
||||
#!/bin/bash
|
||||
mediaStatus=$(/home/sravan/.config/dwm-flexipatch/polybar/scripts/get-media-status.sh)
|
||||
|
||||
if [[ "$mediaStatus" == "N/A" ]]; then
|
||||
echo "懶"
|
||||
else
|
||||
if [[ "$mediaStatus" == "Playing" ]]; then
|
||||
echo ""
|
||||
elif [[ "$mediaStatus" == "Paused" ]]; then
|
||||
echo "契"
|
||||
fi
|
||||
|
||||
echo $status
|
||||
fi
|
10
polybar/scripts/get-media-status.sh
Executable file
10
polybar/scripts/get-media-status.sh
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
mediaStatus=$(playerctl --player=playerctld metadata 2>&1)
|
||||
|
||||
if [[ "$mediaStatus" == "No player could handle this command" ]]; then
|
||||
echo "N/A"
|
||||
else
|
||||
status=$(playerctl --player=playerctld metadata --format '{{ status }}')
|
||||
|
||||
echo $status
|
||||
fi
|
11
polybar/scripts/scroll-media-playing.sh
Executable file
11
polybar/scripts/scroll-media-playing.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/bin/bash
|
||||
zscroll \
|
||||
--length $(xrdb -get polybar.maxlen) \
|
||||
--delay 0.2 \
|
||||
--scroll-padding " | " \
|
||||
--match-command "`dirname $0`/get-media-status.sh" \
|
||||
--match-text "Playing" "--scroll 1" \
|
||||
--match-text "Paused" "--scroll 0" \
|
||||
--update-check true "`dirname $0`/get-media-playing.sh" &
|
||||
|
||||
wait
|
Reference in New Issue
Block a user