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:
parent
8708e3f6f5
commit
2765fdd6cf
6 changed files with 84 additions and 27 deletions
16
bin/waybar_card.sh
Executable file
16
bin/waybar_card.sh
Executable 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
|
|
@ -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
|
|
@ -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}
|
||||
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
"modules-center": [
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/separator#right",
|
||||
"custom/card",
|
||||
"custom/separator#right",
|
||||
"custom/mail",
|
||||
"custom/separator#right",
|
||||
"pulseaudio",
|
||||
"custom/separator#right",
|
||||
"custom/media",
|
||||
"custom/separator#right",
|
||||
"network#wl0",
|
||||
|
@ -26,8 +29,6 @@
|
|||
"cpu",
|
||||
"memory",
|
||||
"custom/separator#right",
|
||||
"backlight",
|
||||
"custom/separator#right",
|
||||
"battery",
|
||||
"custom/separator#right",
|
||||
"custom/calendar",
|
||||
|
@ -55,29 +56,48 @@
|
|||
"exec": "$HOME/.config/sway/bin/waybar_khal.py 2> /dev/null",
|
||||
"on-click": "foot -T float khal interactive"
|
||||
},
|
||||
"custom/card": {
|
||||
"format": "{icon} {}",
|
||||
"tooltip-format": "{}",
|
||||
"tooltip": true,
|
||||
"return-type": "json",
|
||||
"min-length": 3,
|
||||
"max-length": 3,
|
||||
"interval": 10,
|
||||
"format-icons": {
|
||||
"available": "",
|
||||
"missing": ""
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/waybar_card.sh 2> /dev/null"
|
||||
},
|
||||
"custom/mail": {
|
||||
"format": "{icon} {}",
|
||||
"tooltip-format": "{}",
|
||||
"tooltip": true,
|
||||
"return-type": "json",
|
||||
"min-length": 15,
|
||||
"max-length": 15,
|
||||
"min-length": 5,
|
||||
"max-length": 5,
|
||||
"interval": 30,
|
||||
"format-icons": {
|
||||
"unread": " ",
|
||||
"read": " "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/waybar_mail 2> /dev/null"
|
||||
"exec": "$HOME/.config/sway/bin/waybar_mail.sh 2> /dev/null"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"tooltip-format": "{}",
|
||||
"tooltip": true,
|
||||
"return-type": "json",
|
||||
"min-length": 30,
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"chromium": " ",
|
||||
"firefox": " ",
|
||||
"Plexamp": " ",
|
||||
"default": "♫ "
|
||||
"Plexamp": "♫ ",
|
||||
"default": "♪ "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null",
|
||||
|
@ -103,10 +123,6 @@
|
|||
},
|
||||
"on-click": "foot -T float bashtop"
|
||||
},
|
||||
"backlight": {
|
||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {percent:3}%",
|
||||
"format-icons": [""]
|
||||
},
|
||||
"battery": {
|
||||
"bat": "BAT0",
|
||||
"design-capacity": false,
|
||||
|
|
|
@ -13,10 +13,13 @@
|
|||
"modules-center": [
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/separator#right",
|
||||
"custom/card",
|
||||
"custom/separator#right",
|
||||
"custom/mail",
|
||||
"custom/separator#right",
|
||||
"pulseaudio",
|
||||
"custom/separator#right",
|
||||
"custom/media",
|
||||
"custom/separator#right",
|
||||
"network#en0",
|
||||
|
@ -50,36 +53,55 @@
|
|||
"exec": "$HOME/.config/sway/bin/waybar_khal.py 2> /dev/null",
|
||||
"on-click": "foot -T float khal interactive"
|
||||
},
|
||||
"custom/card": {
|
||||
"format": "{icon} {}",
|
||||
"tooltip-format": "{}",
|
||||
"tooltip": true,
|
||||
"return-type": "json",
|
||||
"min-length": 3,
|
||||
"max-length": 3,
|
||||
"interval": 10,
|
||||
"format-icons": {
|
||||
"available": "",
|
||||
"missing": ""
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/waybar_card.sh 2> /dev/null"
|
||||
},
|
||||
"custom/mail": {
|
||||
"format": "{icon} {}",
|
||||
"tooltip-format": "{}",
|
||||
"tooltip": true,
|
||||
"return-type": "json",
|
||||
"min-length": 15,
|
||||
"max-length": 15,
|
||||
"min-length": 5,
|
||||
"max-length": 5,
|
||||
"interval": 30,
|
||||
"format-icons": {
|
||||
"unread": " ",
|
||||
"read": " "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/waybar_mail 2> /dev/null"
|
||||
"exec": "$HOME/.config/sway/bin/waybar_mail.sh 2> /dev/null"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"tooltip-format": "{}",
|
||||
"tooltip": true,
|
||||
"return-type": "json",
|
||||
"min-length": 30,
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"chromium": " ",
|
||||
"firefox": " ",
|
||||
"Plexamp": " ",
|
||||
"default": "♫ "
|
||||
"Plexamp": "♫ ",
|
||||
"default": "♪ "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/waybar_mediaplayer.py 2> /dev/null",
|
||||
"exec-if": "pgrep plexamp"
|
||||
},
|
||||
"clock": {
|
||||
"format": "<span foreground='#ebdbb2'> </span>{: %a, %b %d, %H:%M}",
|
||||
"format": "<span foreground='#ebdbb2'> </span>{: %a, %b %d, %H:%M}",
|
||||
"on-click": "foot -T float khal interactive"
|
||||
},
|
||||
"cpu": {
|
||||
|
@ -98,10 +120,6 @@
|
|||
},
|
||||
"on-click": "foot -T float bashtop"
|
||||
},
|
||||
"backlight": {
|
||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {percent:3}%",
|
||||
"format-icons": [""]
|
||||
},
|
||||
"battery": {
|
||||
"bat": "BAT0",
|
||||
"design-capacity": false,
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
* {
|
||||
border: none;
|
||||
border-radius: 0;
|
||||
font-family: "Cascadia Code PL Regular";
|
||||
font-size: 12px;
|
||||
font-family: "Cascadia Code PL", "Font Awesome 5 Free";
|
||||
font-size: 13px;
|
||||
min-height: 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue