waybar: update widgets

style: add fontawesome as fallback
mail: add tooltip with details
mediaplayer: add tooltip
card: add information about card
This commit is contained in:
Konstantin Koslowski 2021-05-13 23:48:21 +02:00
parent 8708e3f6f5
commit 2765fdd6cf
6 changed files with 84 additions and 27 deletions

16
bin/waybar_card.sh Executable file
View file

@ -0,0 +1,16 @@
#!/bin/bash
CMD="/usr/bin/gpg --card-status"
text=""
tooltip=""
alt="missing"
ret=$($CMD 2> /dev/null)
if [ $? -eq 0 ]; then
tooltip="S/N: $(echo $ret | grep -oE 'Serial number[.:0-9 ]*' | grep -oE '[0-9]*')"
alt="available"
fi
json="{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"card\", \"alt\": \"$alt\"}"
echo $json

View file

@ -4,15 +4,16 @@ MAILDIR=$HOME/.mail
ACCOUNTS=(posteo gmail xkonni)
text=""
tooltip=""
total=0
for acc in ${ACCOUNTS[@]}; do
count=$(notmuch count folder:$acc/Inbox AND tag:unread AND NOT tag:killed)
total=$((total+count))
text+="$count"
[ ! $acc = ${ACCOUNTS[-1]} ] && text+=", "
tooltip+="$acc: $count"
[ ! $acc = ${ACCOUNTS[-1]} ] && tooltip+="\n"
done
alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" )
text="$total ($text)"
json="{\"text\": \"$text\", \"class\": \"mail\", \"alt\": \"$alt\"}"
text="$total"
json="{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"mail\", \"alt\": \"$alt\"}"
echo $json

View file

@ -14,7 +14,13 @@ logger = logging.getLogger(__name__)
def write_output(text, player):
logger.info('Writing output')
m = dict(player.props.metadata)
title = m.get("xesam:title", "unknown")
artist = ",".join(x for x in m.get("xesam:artist"))
album = m.get("xesam:album")
tooltip = f"{artist}\n<b>{title}</b>\n<i>{album}</i>"
output = {'text': text,
'tooltip': tooltip,
'class': 'custom-' + player.props.player_name,
'alt': player.props.player_name}