add hide option

This commit is contained in:
speediegq 2022-08-25 23:15:01 +02:00
parent 48d33ace89
commit dbc9b278d5

76
status
View file

@ -62,6 +62,11 @@ ITEM9_DISPLAY_TITLE="false" # Display title or not (true/false)
ITEM9_DISPLAY_ALBUM="false" # Display album or not (true/false) ITEM9_DISPLAY_ALBUM="false" # Display album or not (true/false)
ITEM9_DISPLAY_GENRE="false" # Display genre or not (true/false) ITEM9_DISPLAY_GENRE="false" # Display genre or not (true/false)
ITEM9_DISPLAY_FILE="true" # Display filename or not. This option will disable everything else. Path and file extension will be cut. (true/false) ITEM9_DISPLAY_FILE="true" # Display filename or not. This option will disable everything else. Path and file extension will be cut. (true/false)
ITEM9_HIDE_EMPTY_ARTIST="true" # Hide empty artist (true/false)
ITEM9_HIDE_EMPTY_TITLE="true" # Hide empty title (true/false)
ITEM9_HIDE_EMPTY_ALBUM="true" # Hide empty album (true/false)
ITEM9_HIDE_EMPTY_GENRE="true" # Hide empty genre (true/false)
ITEM9_HIDE_EMPTY_FILE="true" # Hide empty file (true/false)
ITEM9_PRE_FILE="" # Text to display before the filename ITEM9_PRE_FILE="" # Text to display before the filename
ITEM9_POST_FILE="" # Text to display after the filename ITEM9_POST_FILE="" # Text to display after the filename
ITEM9_PRE_ARTIST="" # Text to display before the artist ITEM9_PRE_ARTIST="" # Text to display before the artist
@ -300,12 +305,16 @@ else
printf "\nITEM9_POST_FILE='$ITEM9_POST_FILE' # Text to display after the filename" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_POST_FILE='$ITEM9_POST_FILE' # Text to display after the filename" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_PRE_ARTIST='$ITEM9_PRE_ARTIST' # Text to display before the artist" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_PRE_ARTIST='$ITEM9_PRE_ARTIST' # Text to display before the artist" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_POST_ARTIST='$ITEM9_POST_ARTIST' # Text to display after the artist" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_POST_ARTIST='$ITEM9_POST_ARTIST' # Text to display after the artist" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_PRE_TITE='$ITEM9_PRE_TITLE' # Text to display before the title" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_PRE_TITLE='$ITEM9_PRE_TITLE' # Text to display before the title" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_POST_TITLE='$ITEM9_POST_TITLE' # Text to display after the title" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_POST_TITLE='$ITEM9_POST_TITLE' # Text to display after the title" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_PRE_ALBUM='$ITEM9_PRE_ALBUM' # Text to display before the album" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_PRE_ALBUM='$ITEM9_PRE_ALBUM' # Text to display before the album" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_POST_ALBUM='$ITEM9_POST_ALBUM' # Text to display after the album" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_POST_ALBUM='$ITEM9_POST_ALBUM' # Text to display after the album" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_PRE_GENRE='$ITEM9_PRE_GENRE' # Text to display before the genre" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_PRE_GENRE='$ITEM9_PRE_GENRE' # Text to display before the genre" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_POST_GENRE='$ITEM9_POST_GENRE' # Text to display after the genre" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_POST_GENRE='$ITEM9_POST_GENRE' # Text to display after the genre" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_HIDE_EMPTY_ARTIST=$ITEM9_HIDE_EMPTY_ARTIST # Hide empty artist (true/false)" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_HIDE_EMPTY_TITLE=$ITEM9_HIDE_EMPTY_ARTIST # Hide empty title (true/false)" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_HIDE_EMPTY_ALBUM=$ITEM9_HIDE_EMPTY_ALBUM # Hide empty album (true/false)" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_HIDE_EMPTY_GENRE=$ITEM9_HIDE_EMPTY_GENRE # Hide empty genre (true/false)" >> $HOME/.config/speedwm-de/status/config
printf "\nITEM9_SEPARATOR='$ITEM9_SEPARATOR' # Separator between ARTIST, TITLE and ALBUM" >> $HOME/.config/speedwm-de/status/config printf "\nITEM9_SEPARATOR='$ITEM9_SEPARATOR' # Separator between ARTIST, TITLE and ALBUM" >> $HOME/.config/speedwm-de/status/config
printf "\n\nHIDE_STATUS_SYSTRAY=$HIDE_STATUS_SYSTRAY # Hide the status when a systray is running (true/false)" >> $HOME/.config/speedwm-de/status/config printf "\n\nHIDE_STATUS_SYSTRAY=$HIDE_STATUS_SYSTRAY # Hide the status when a systray is running (true/false)" >> $HOME/.config/speedwm-de/status/config
printf "\nSYSTRAY=$SYSTRAY # Systray to use (<systray executable>)" >> $HOME/.config/speedwm-de/status/config printf "\nSYSTRAY=$SYSTRAY # Systray to use (<systray executable>)" >> $HOME/.config/speedwm-de/status/config
@ -462,23 +471,44 @@ ITEM9() {
if [ "$ITEM9_BACKEND" = "mocp" ]; then if [ "$ITEM9_BACKEND" = "mocp" ]; then
if [ -e "${BINDIR}mocp" ]; then if [ -e "${BINDIR}mocp" ]; then
if [ "$(echo $(mocp -Q %file))" != "" ]; then if [ "$(echo $(mocp -Q %file))" != "" ]; then
if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then if [ "$ITEM9_DISPLAY_FILE" = "true" ]; then
echo "$SEP $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE" echo "$SEP $ITEM9_ICON $ITEM9_PRE_FILE$(basename "$(mocp -Q %file)" | sed 's|\(.*\)[.].*|\1|')$ITEM9_POST_FILE"
else else
# artist # artist
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
data="$ITEM9_PRE_ARTIST$(printf "$data $(mocp -Q %artist) $ITEM9_SEPARATOR")$ITEM9_POST_ARTIST" if [ "$ITEM9_HIDE_EMPTY_ARTIST" = "true" ]; then
if [ "$(mocp -Q %artist | head -n 1)" != "" ]; then
data="$ITEM9_PRE_ARTIST$(printf "$data $(mocp -Q %artist) $ITEM9_SEPARATOR")$ITEM9_POST_ARTIST"
fi
else
data="$ITEM9_PRE_ARTIST$(printf "$data $(mocp -Q %artist) $ITEM9_SEPARATOR")$ITEM9_POST_ARTIST"
fi
fi fi
# title # title
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
data="$ITEM9_PRE_TITLE$(printf "$data $(mocp -Q %song)")$ITEM9_POST_TITLE" if [ "$ITEM9_HIDE_EMPTY_TITLE" = "true" ]; then
if [ "$(mocp -Q %song | head -n 1)" != "" ]; then
data="$ITEM9_PRE_TITLE$(printf "$data $(mocp -Q %song)")$ITEM9_POST_TITLE"
fi
else
data="$ITEM9_PRE_TITLE$(printf "$data $(mocp -Q %song)")$ITEM9_POST_TITLE"
fi
fi fi
# album # album
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
data="$(printf "$data $ITEM9_PRE_ALBUM$(mocp -Q %album)$ITEM9_POST_ALBUM")" if [ "$ITEM9_HIDE_EMPTY_ALBUM" = "true" ]; then
if [ "$(mocp -Q %album | head -n 1)" != "" ]; then
data="$(printf "$data $ITEM9_PRE_ALBUM$(mocp -Q %album)$ITEM9_POST_ALBUM")"
fi
else
data="$(printf "$data $ITEM9_PRE_ALBUM$(mocp -Q %album)$ITEM9_POST_ALBUM")"
fi
fi fi
# actually print it # actually print it
@ -498,26 +528,54 @@ ITEM9() {
# artist # artist
if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then if [ "$ITEM9_DISPLAY_ARTIST" = "true" ]; then
data="$(printf "$data $ITEM9_PRE_ARTIST$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")$ITEM9_POST_ARTIST $ITEM9_SEPARATOR")" if [ "$ITEM9_HIDE_EMPTY_ARTIST" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag artist")" != "" ]; then
data="$(printf "$data $ITEM9_PRE_ARTIST$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")$ITEM9_POST_ARTIST $ITEM9_SEPARATOR")"
fi
else
data="$(printf "$data $ITEM9_PRE_ARTIST$(cmus-remote -C status | grep "tag artist" | sed "s/tag artist //g")$ITEM9_POST_ARTIST $ITEM9_SEPARATOR")"
fi
fi fi
# title # title
if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then if [ "$ITEM9_DISPLAY_TITLE" = "true" ]; then
data="$(printf "$data $ITEM9_PRE_TITLE$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")$ITEM9_POST_TITLE")" if [ "$ITEM9_HIDE_EMPTY_TITLE" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag title")" != "" ]; then
data="$(printf "$data $ITEM9_PRE_TITLE$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")$ITEM9_POST_TITLE")"
fi
else
data="$(printf "$data $ITEM9_PRE_TITLE$(cmus-remote -C status | grep "tag title" | sed "s/tag title //g")$ITEM9_POST_TITLE")"
fi
fi fi
# album # album
if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then if [ "$ITEM9_DISPLAY_ALBUM" = "true" ]; then
data="$(printf "$data $ITEM9_PRE_ALBUM$(cmus-remote -C status | grep "tag album" | sed "s/tag album //g")$ITEM9_POST_ALBUM")" if [ "$ITEM9_HIDE_EMPTY_ALBUM" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag album")" != "" ]; then
data="$(printf "$data $ITEM9_PRE_ALBUM$(cmus-remote -C status | grep "tag album" | sed "s/tag album //g")$ITEM9_POST_ALBUM")"
fi
else
data="$(printf "$data $ITEM9_PRE_ALBUM$(cmus-remote -C status | grep "tag album" | sed "s/tag album //g")$ITEM9_POST_ALBUM")"
fi
fi fi
# genre # genre
if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then if [ "$ITEM9_DISPLAY_GENRE" = "true" ]; then
data="$(printf "$data $ITEM9_PRE_GENRE$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")$ITEM9_POST_GENRE")" if [ "$ITEM9_HIDE_EMPTY_GENRE" = "true" ]; then
if [ "$(cmus-remote -C status | grep "tag genre")" != "" ]; then
data="$(printf "$data $ITEM9_PRE_GENRE$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")$ITEM9_POST_GENRE")"
fi
else
data="$(printf "$data $ITEM9_PRE_GENRE$(cmus-remote -C status | grep "tag genre" | sed "s/tag genre //g")$ITEM9_POST_GENRE")"
fi
fi fi
# actually print it # actually print it
echo "$SEP $ITEM9_ICON $data" if [ "$data" != "" ]; then
echo "$SEP $ITEM9_ICON $data"
fi
fi fi
fi fi
fi fi