fixed more stuff with waybar

This commit is contained in:
opal
2024-06-03 23:17:19 -07:00
parent f5cbaf2c30
commit c8d671eaff
4 changed files with 34 additions and 19 deletions
+9 -1
View File
@@ -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}")