waybar: fix mediaplayer, minor formatting changes

This commit is contained in:
Konstantin Koslowski 2021-05-16 13:55:33 +02:00
parent 7bad210a72
commit cdcca4df67
3 changed files with 7 additions and 9 deletions

View file

@ -15,9 +15,9 @@ def write_output(text, player):
logger.info('Writing output') logger.info('Writing output')
m = dict(player.props.metadata) m = dict(player.props.metadata)
title = m.get("xesam:title", "unknown") title = m.get("xesam:title", "None")
artist = ",".join(x for x in m.get("xesam:artist")) artist = ",".join(x for x in m.get("xesam:artist", ["None"]))
album = m.get("xesam:album") album = m.get("xesam:album", "None")
tooltip = f"{artist}\n <b>{title}</b>\n{album}" tooltip = f"{artist}\n <b>{title}</b>\n{album}"
output = {'text': text, output = {'text': text,
'tooltip': tooltip, 'tooltip': tooltip,

View file

@ -105,8 +105,7 @@
"default": "♪ " "default": "♪ "
}, },
"escape": true, "escape": true,
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null", "exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null"
"exec-if": "pgrep plexamp"
}, },
"clock": { "clock": {
"format": "<span foreground='#ebdbb2'> </span>{: %a, %b %d, %H:%M}", "format": "<span foreground='#ebdbb2'> </span>{: %a, %b %d, %H:%M}",
@ -194,7 +193,7 @@
"car": "", "car": "",
"default": ["", "", ""] "default": ["", "", ""]
}, },
"min-length": 14, "min-length": 9,
"max-length": 20, "max-length": 20,
"on-click": "$HOME/.config/sway/bin/sway_volume mute", "on-click": "$HOME/.config/sway/bin/sway_volume mute",
"on-click-middle": "$HOME/.config/sway/bin/sway_volume gui", "on-click-middle": "$HOME/.config/sway/bin/sway_volume gui",

View file

@ -102,8 +102,7 @@
"default": "♪ " "default": "♪ "
}, },
"escape": true, "escape": true,
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null", "exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null"
"exec-if": "pgrep plexamp"
}, },
"clock": { "clock": {
"format": "<span foreground='#ebdbb2'> </span>{: %a, %b %d, %H:%M}", "format": "<span foreground='#ebdbb2'> </span>{: %a, %b %d, %H:%M}",
@ -191,7 +190,7 @@
"car": "", "car": "",
"default": ["", "", ""] "default": ["", "", ""]
}, },
"min-length": 14, "min-length": 9,
"max-length": 20, "max-length": 20,
"on-click": "$HOME/.config/sway/bin/sway_volume mute", "on-click": "$HOME/.config/sway/bin/sway_volume mute",
"on-click-middle": "$HOME/.config/sway/bin/sway_volume gui", "on-click-middle": "$HOME/.config/sway/bin/sway_volume gui",