added check for empty string and object
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
)
|
||||
)
|
||||
|
||||
; icons used can be found on https://www.nerdfonts.com/cheat-sheet
|
||||
(defvar playerIcons `{
|
||||
"spotify": "",
|
||||
"mpv": "",
|
||||
@@ -21,7 +22,9 @@
|
||||
: matches(playerctl.player, 'spotify|firefox|mpv|chromium')
|
||||
? 'music--' + playerctl.player
|
||||
: 'music--on' }
|
||||
{ matches(playerctl.player, 'spotify|firefox|mpv|chromium')
|
||||
{ playerctl == '' || objectlength(playerctl) == 0
|
||||
? ''
|
||||
: matches(playerctl.player, 'spotify|firefox|mpv|chromium')
|
||||
? "${playerIcons[playerctl.player]} ${substring(playerctl.artist, 0, ellipsisArtist)}${strlength(playerctl.artist) >= ellipsisArtist ? '…' : ''} | ${substring(playerctl.title, 0, ellipsisTitle)}${strlength(playerctl.title) >= ellipsisTitle ? '…' : ''}"
|
||||
: "${playerctl.player} - ${substring(playerctl.artist, 0, ellipsisArtist)}${strlength(playerctl.artist) >= ellipsisArtist ? '…' : ''} | ${substring(playerctl.title, 0, ellipsisTitle)}${strlength(playerctl.title) >= ellipsisTitle ? '…' : ''}" }
|
||||
)
|
||||
|
Reference in New Issue
Block a user