summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/player_mpris_zscroll_module
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-25 21:52:30 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-25 21:52:30 -0700
commit9d44898fb3c2dbac189f5fa7b9b1d789937f348c (patch)
tree466b238e00d16c12f50ccac4a21d693eb1961fd9 /.local/bin/statusbar/player_mpris_zscroll_module
parent01aae48c384f4b07c2f204bff81ba2398cbd3065 (diff)
Better "now playing" module
Diffstat (limited to '.local/bin/statusbar/player_mpris_zscroll_module')
-rwxr-xr-x.local/bin/statusbar/player_mpris_zscroll_module60
1 files changed, 60 insertions, 0 deletions
diff --git a/.local/bin/statusbar/player_mpris_zscroll_module b/.local/bin/statusbar/player_mpris_zscroll_module
new file mode 100755
index 0000000..5930182
--- /dev/null
+++ b/.local/bin/statusbar/player_mpris_zscroll_module
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+# This is a static status module, for a dynamic one, there is the option
+# with zscroll.
+
+icon=" "
+length=50
+delay=0.1
+b_padding=$icon
+a_padding=""
+p_padding="  |  "
+
+show_panel (){
+ zscroll -d $delay -l $length \
+ -M "pctl_status status" \
+ -m "Playing" "--scroll-padding '$p_padding' --scroll 1" \
+ -m "Paused" "--scroll 0" \
+ -m "Stopped" "--scroll 0" \
+ -m "NRP" "--scroll 0" \
+ -u true "pctl_status text" &
+
+ wait
+}
+
+send_notification (){
+ player_status=$(playerctl status 2> /dev/null)
+ if [ "$player_status" = "Playing" ]; then
+ artist="$(playerctl metadata artist)"
+ album="$(playerctl metadata album)"
+ title="$(playerctl metadata title)"
+
+ if [ $album = "\n"]; then
+ notify-send "$icon $artist - $album" "$title"
+ else
+ notify-send "$icon $artist" "$title"
+ fi
+ elif [ "$player_status" = "Paused" ]; then
+ artist="$(playerctl metadata artist)"
+ album="$(playerctl metadata album)"
+ title="$(playerctl metadata title)"
+
+ if [ $album = "\n"]; then
+ notify-send "$icon (Paused) $artist - $album" "$title"
+ else
+ notify-send "$icon (Paused) $artist" "$title"
+ fi
+ else
+ notify-send "$icon Nothing playing"
+ fi
+
+}
+
+case $1 in
+ show)
+ show_panel
+ ;;
+ notify)
+ send_notification
+ ;;
+esac