From 82669efb95bef49a545fa030e5c1fadffe4d1ad3 Mon Sep 17 00:00:00 2001 From: Wiktor Zykubek Date: Mon, 21 Dec 2020 12:51:42 +0100 Subject: [PATCH] Modify music player scripts to use spotifyd --- .config/sxhkd/sxhkdrc | 8 ++++---- .local/bin/scripts/dwmbar/music | 22 +++++++++++++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/.config/sxhkd/sxhkdrc b/.config/sxhkd/sxhkdrc index 65479e5..dd4378c 100644 --- a/.config/sxhkd/sxhkdrc +++ b/.config/sxhkd/sxhkdrc @@ -1,7 +1,7 @@ super + Return $($TERMINAL) super + {_,ctrl,alt +} b - {search,firefox,tor-browser} + {search,chromium,tor-browser} super + {_,shift +} d rofi -show {run,drun} super + shift + s @@ -54,15 +54,15 @@ XF86Audio{Raise,Lower}Volume amixer sset Master 5%{+,-} && refbar # songs control XF86Audio{Next,Prev} - mpc {next,prev} && refbar + playerctl {next,previous} && refbar ctrl + XF86Audio{Next,Prev} mpc seek {+,-}4 # pause/play {XF86AudioPlay,super + slash} - mpc toggle && refbar + playerctl play-pause && refbar # stop XF86AudioStop - mpc stop && refbar + playerctl stop && refbar ctrl + alt + {Left,Up,Down,Right} rotscreen {left,normal,inverted,right} diff --git a/.local/bin/scripts/dwmbar/music b/.local/bin/scripts/dwmbar/music index 276a776..dfcc2b9 100755 --- a/.local/bin/scripts/dwmbar/music +++ b/.local/bin/scripts/dwmbar/music @@ -1,11 +1,23 @@ #!/bin/sh -echo "" -if mpc status | grep -q "playing"; then - mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[playing\\].*//g" -elif mpc status | grep -q "paused"; then +if playerctl metadata --format={{playerName}} | grep -q "spotifyd"; then + echo "" +else + echo "" +fi + +# if mpc status | grep -q "playing"; then +# mpc | sed "/^volume:/d;s/\\&/&/g;s/\\[playing\\].*//g" +# elif mpc status | grep -q "paused"; then +# echo "" +# else +# echo "" +# fi + +if playerctl --player=spotifyd status | grep -q "Playing"; then + playerctl metadata --format "{{ artist }} - {{ title }}" +elif playerctl --player=spotifyd status | grep -q "Paused"; then echo "" else echo "" fi -