fix ampersand in song

This commit is contained in:
speedie 2022-11-03 15:17:20 +01:00
parent d575bb2098
commit c105593d69
4 changed files with 21 additions and 11 deletions

View file

@ -44,7 +44,7 @@
!! Client options !! Client options
!@ !@
- speedwm.client.allowurgent: 1 ! Allow windows to have the 'urgent' status (0/1) - speedwm.client.allowurgent: 1 ! Allow windows to have the 'urgent' status (0/1)
- speedwm.client.autoresize: 1 ! Allow windows to resize themselves on demand (0/1) - speedwm.client.autoresize: 0 ! Allow windows to resize themselves on demand (0/1)
- speedwm.client.decorhints: 1 ! Respect decoration hints for windows (0/1) - speedwm.client.decorhints: 1 ! Respect decoration hints for windows (0/1)
- speedwm.client.fade.inactive: 1 ! Fade inactive windows (windows that are not focused) (0/1) - speedwm.client.fade.inactive: 1 ! Fade inactive windows (windows that are not focused) (0/1)
- speedwm.client.fade.windows: 1 ! Fade windows (0/1) - speedwm.client.fade.windows: 1 ! Fade windows (0/1)

View file

@ -121,21 +121,22 @@ PRINT() {
# artist # artist
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
if [ "$(mocp -Q %artist | head -n 1)" != "" ]; then if [ "$(mocp -Q %artist | head -n 1)" != "" ]; then
MUSIC_ARTIST="$(mocp -Q %artist)" MUSIC_ARTIST="$(mocp -Q %artist | sed "s|\&|stellar_amp|g")"
fi fi
fi fi
# title # title
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
if [ "$(mocp -Q %song | head -n 1)" != "" ]; then if [ "$(mocp -Q %song | head -n 1)" != "" ]; then
MUSIC_SONG="$(mocp -Q %song)" MUSIC_SONG="$(mocp -Q %song | sed "s|\&|stellar_amp|g")"
fi fi
fi fi
# album # album
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
if [ "$(mocp -Q %album | head -n 1)" != "" ]; then if [ "$(mocp -Q %album | head -n 1)" != "" ]; then
MUSIC_ALBUM="$(mocp -Q %album)" MUSIC_ALBUM="$(mocp -Q %album | sed "s|\&|stellar_amp|g")"
echo "$MUSIC_ARTIST $MUSIC_SONG $MUSIC_ALBUM" | grep -q stellar_amp && EXTRASPACE=true
fi fi
fi fi
@ -153,7 +154,11 @@ PRINT() {
fi fi
fi fi
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")" if [ "$EXTRASPACE" = "true" ]; then
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG |; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
else
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g||; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
fi
# actually print it # actually print it
echo "$SEPARATOR $ITEM9_ICON $data" echo "$SEPARATOR $ITEM9_ICON $data"
@ -173,21 +178,21 @@ PRINT() {
# artist # artist
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag artist")" != "" ]; then if [ "$(cmus-remote -C status | grep "tag artist")" != "" ]; then
MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")" MUSIC_ARTIST="$(cmus-remote -C status | grep "tag artist" | sed "s|\&|stellar_amp|g; s/tag artist //g")"
fi fi
fi fi
# title # title
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag title")" != "" ]; then if [ "$(cmus-remote -C status | grep "tag title")" != "" ]; then
MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")" MUSIC_SONG="$(cmus-remote -C status | grep "tag title" | sed "s|\&|stellar_amp|g; s/tag title //g")"
fi fi
fi fi
# album # album
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag album")" != "" ]; then if [ "$(cmus-remote -C status | grep "tag album")" != "" ]; then
MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s/tag album //g")" MUSIC_ALBUM="$(cmus-remote -C status | grep "tag album" | head -n 1 | sed "s|\&|stellar_amp|g; s/tag album //g")"
fi fi
fi fi
@ -195,6 +200,7 @@ PRINT() {
if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag genre")" != "" ]; then if [ "$(cmus-remote -C status | grep "tag genre")" != "" ]; then
MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")" MUSIC_GENRE="$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")"
echo "$MUSIC_ARTIST $MUSIC_SONG $MUSIC_ALBUM" | grep -q stellar_amp && EXTRASPACE=true
fi fi
fi fi
@ -212,7 +218,11 @@ PRINT() {
fi fi
fi fi
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")" if [ "$EXTRASPACE" = "true" ]; then
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM |; s|@t|${MUSIC_SONG}|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
else
data="$(printf "$ITEM9_FORMAT" | sed "s|@ab|$MUSIC_ALBUM|; s|@t|$MUSIC_SONG|; s|@g|$MUSIC_GENRE|; s|@a|$MUSIC_ARTIST|; s|@tt|$MUSIC_TIMETOTAL|; s|@te|$MUSIC_TIMEELAPSED|; s| ||g")"
fi
# actually print it # actually print it
if [ "$data" != "" ]; then if [ "$data" != "" ]; then

View file

@ -128,7 +128,7 @@ static int centerfloating = 1; /* Center floating windows by
static int startontag = 1; /* Start on a tag or not? */ static int startontag = 1; /* Start on a tag or not? */
static int floatscratchpad = 0; /* Float the scratchpad window on hide (1/0) */ static int floatscratchpad = 0; /* Float the scratchpad window on hide (1/0) */
static int focusspawn = 0; /* Automatically focus the next spawned window. If warp is enabled, this is useless and will be disabled. (1/0) */ static int focusspawn = 0; /* Automatically focus the next spawned window. If warp is enabled, this is useless and will be disabled. (1/0) */
static int autoresize = 1; /* Allow resizing clients automatically when they request it. */ static int autoresize = 0; /* Allow resizing clients automatically when they request it. */
/* Font options /* Font options
* *

View file

@ -162,7 +162,7 @@ setloading() {
# print data # print data
print() { print() {
setstatus "$(printf "$ITEMS_TEXT")" setstatus "$(printf "$ITEMS_TEXT" | sed "s/stellar_amp/\&/g")"
} }
# set status2d compatible colors # set status2d compatible colors