From 55ba702c7fa610fe47c9442a6f027950847ae672 Mon Sep 17 00:00:00 2001 From: Niklas Date: Sat, 16 Jan 2021 23:32:46 +0100 Subject: [PATCH] better song info polybar module --- .config/dunst/dunstrc | 5 ----- .config/dunst/polybar-hook.sh | 3 --- .config/polybar/config | 13 +++++++------ .config/polybar/playerctl-meta.sh | 3 +++ .config/polybar/spotifyd-meta.sh | 16 ---------------- 5 files changed, 10 insertions(+), 30 deletions(-) delete mode 100755 .config/dunst/polybar-hook.sh create mode 100755 .config/polybar/playerctl-meta.sh delete mode 100755 .config/polybar/spotifyd-meta.sh diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc index 3225c0c..84fad51 100644 --- a/.config/dunst/dunstrc +++ b/.config/dunst/dunstrc @@ -364,11 +364,6 @@ # msg_urgency = critical # fullscreen = show -[spotify-polybar] - appname = Spotify - skip_display = yes - script = ~/.config/dunst/polybar-hook.sh - [notification-sound] appname = * script = ~/.config/dunst/play-notification-sound.sh diff --git a/.config/dunst/polybar-hook.sh b/.config/dunst/polybar-hook.sh deleted file mode 100755 index a5f6d91..0000000 --- a/.config/dunst/polybar-hook.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env sh - -polybar-msg hook spotifyd 1 diff --git a/.config/polybar/config b/.config/polybar/config index 6607066..40003c6 100755 --- a/.config/polybar/config +++ b/.config/polybar/config @@ -44,7 +44,7 @@ font-1 = "Hack Nerd Font:style=Regular:pixelsize=10;2" modules-left = i3 modules-center = -modules-right = spotifyd pulseaudio memory cpu wlan wireguard-status battery date +modules-right = playerctl pulseaudio memory cpu wlan wireguard-status battery date tray-position = right tray-padding = 2 @@ -197,15 +197,16 @@ format-full-foreground = ${colors.text} format-full-prefix-foreground = ${colors.foreground} format-full-underline = ${self.format-charging-underline} -[module/spotifyd] -type = custom/ipc +[module/playerctl] +type = custom/script + +exec = $XDG_CONFIG_HOME/polybar/playerctl-meta.sh + +tail = true format-foreground = ${colors.text} format-underline = ${colors.spotify-ul} -hook-0 = $HOME/.config/polybar/spotifyd-meta.sh -initial = 1 - [module/wireguard-status] type = custom/ipc diff --git a/.config/polybar/playerctl-meta.sh b/.config/polybar/playerctl-meta.sh new file mode 100755 index 0000000..15e596a --- /dev/null +++ b/.config/polybar/playerctl-meta.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env sh + +playerctl --player=spotify,%any -f "{{title}} - {{artist}}" metadata -F 2>/dev/null diff --git a/.config/polybar/spotifyd-meta.sh b/.config/polybar/spotifyd-meta.sh deleted file mode 100755 index 634cf4e..0000000 --- a/.config/polybar/spotifyd-meta.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env sh - -meta(){ - metadata=$(playerctl --player=spotify,%any -f "{{title}} - {{artist}}" metadata 2>/dev/null ) && echo $metadata -} - -i=0 - -until meta || [ $i -gt 10 ]; -do - sleep 1 - let i=i+1 -done - -exit $? -