fixed more stuff with waybar
This commit is contained in:
@@ -15,8 +15,16 @@ def get_playerctl_metadata(field):
|
||||
return None
|
||||
|
||||
|
||||
def abbreviate(text, max_length=30):
|
||||
if len(text) > max_length:
|
||||
return text[: max_length - 3] + "..."
|
||||
return text
|
||||
|
||||
|
||||
artist = get_playerctl_metadata("artist")
|
||||
title = get_playerctl_metadata("title")
|
||||
|
||||
if artist and title:
|
||||
print(f" {artist} - {title}")
|
||||
display_text = f"{artist} - {title}"
|
||||
display_text = abbreviate(display_text, 40) # Adjust the max_length as needed
|
||||
print(f" {display_text}")
|
||||
|
||||
Reference in New Issue
Block a user