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)
|
ACCOUNTS=(posteo gmail xkonni)
|
||||||
|
|
||||||
text=""
|
text=""
|
||||||
|
tooltip=""
|
||||||
total=0
|
total=0
|
||||||
for acc in ${ACCOUNTS[@]}; do
|
for acc in ${ACCOUNTS[@]}; do
|
||||||
count=$(notmuch count folder:$acc/Inbox AND tag:unread AND NOT tag:killed)
|
count=$(notmuch count folder:$acc/Inbox AND tag:unread AND NOT tag:killed)
|
||||||
total=$((total+count))
|
total=$((total+count))
|
||||||
text+="$count"
|
tooltip+="$acc: $count"
|
||||||
[ ! $acc = ${ACCOUNTS[-1]} ] && text+=", "
|
[ ! $acc = ${ACCOUNTS[-1]} ] && tooltip+="\n"
|
||||||
done
|
done
|
||||||
|
|
||||||
alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" )
|
alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" )
|
||||||
text="$total ($text)"
|
text="$total"
|
||||||
json="{\"text\": \"$text\", \"class\": \"mail\", \"alt\": \"$alt\"}"
|
json="{\"text\": \"$text\", \"tooltip\": \"$tooltip\", \"class\": \"mail\", \"alt\": \"$alt\"}"
|
||||||
echo $json
|
echo $json
|
|
@ -14,7 +14,13 @@ logger = logging.getLogger(__name__)
|
||||||
def write_output(text, player):
|
def write_output(text, player):
|
||||||
logger.info('Writing output')
|
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,
|
output = {'text': text,
|
||||||
|
'tooltip': tooltip,
|
||||||
'class': 'custom-' + player.props.player_name,
|
'class': 'custom-' + player.props.player_name,
|
||||||
'alt': player.props.player_name}
|
'alt': player.props.player_name}
|
||||||
|
|
||||||
|
|
|
@ -13,10 +13,13 @@
|
||||||
"modules-center": [
|
"modules-center": [
|
||||||
],
|
],
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
|
"custom/separator#right",
|
||||||
|
"custom/card",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"custom/mail",
|
"custom/mail",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"pulseaudio",
|
"pulseaudio",
|
||||||
|
"custom/separator#right",
|
||||||
"custom/media",
|
"custom/media",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"network#wl0",
|
"network#wl0",
|
||||||
|
@ -26,8 +29,6 @@
|
||||||
"cpu",
|
"cpu",
|
||||||
"memory",
|
"memory",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"backlight",
|
|
||||||
"custom/separator#right",
|
|
||||||
"battery",
|
"battery",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"custom/calendar",
|
"custom/calendar",
|
||||||
|
@ -55,29 +56,48 @@
|
||||||
"exec": "$HOME/.config/sway/bin/waybar_khal.py 2> /dev/null",
|
"exec": "$HOME/.config/sway/bin/waybar_khal.py 2> /dev/null",
|
||||||
"on-click": "foot -T float khal interactive"
|
"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": {
|
"custom/mail": {
|
||||||
"format": "{icon} {}",
|
"format": "{icon} {}",
|
||||||
|
"tooltip-format": "{}",
|
||||||
|
"tooltip": true,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"min-length": 15,
|
"min-length": 5,
|
||||||
"max-length": 15,
|
"max-length": 5,
|
||||||
"interval": 30,
|
"interval": 30,
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"unread": " ",
|
"unread": " ",
|
||||||
"read": " "
|
"read": " "
|
||||||
},
|
},
|
||||||
"escape": true,
|
"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": {
|
"custom/media": {
|
||||||
"format": "{icon} {}",
|
"format": "{icon} {}",
|
||||||
|
"tooltip-format": "{}",
|
||||||
|
"tooltip": true,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"min-length": 30,
|
"min-length": 30,
|
||||||
"max-length": 40,
|
"max-length": 40,
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"chromium": " ",
|
"chromium": " ",
|
||||||
"firefox": " ",
|
"firefox": " ",
|
||||||
"Plexamp": " ",
|
"Plexamp": "♫ ",
|
||||||
"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",
|
||||||
|
@ -103,10 +123,6 @@
|
||||||
},
|
},
|
||||||
"on-click": "foot -T float bashtop"
|
"on-click": "foot -T float bashtop"
|
||||||
},
|
},
|
||||||
"backlight": {
|
|
||||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {percent:3}%",
|
|
||||||
"format-icons": [""]
|
|
||||||
},
|
|
||||||
"battery": {
|
"battery": {
|
||||||
"bat": "BAT0",
|
"bat": "BAT0",
|
||||||
"design-capacity": false,
|
"design-capacity": false,
|
||||||
|
|
|
@ -13,10 +13,13 @@
|
||||||
"modules-center": [
|
"modules-center": [
|
||||||
],
|
],
|
||||||
"modules-right": [
|
"modules-right": [
|
||||||
|
"custom/separator#right",
|
||||||
|
"custom/card",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"custom/mail",
|
"custom/mail",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"pulseaudio",
|
"pulseaudio",
|
||||||
|
"custom/separator#right",
|
||||||
"custom/media",
|
"custom/media",
|
||||||
"custom/separator#right",
|
"custom/separator#right",
|
||||||
"network#en0",
|
"network#en0",
|
||||||
|
@ -50,36 +53,55 @@
|
||||||
"exec": "$HOME/.config/sway/bin/waybar_khal.py 2> /dev/null",
|
"exec": "$HOME/.config/sway/bin/waybar_khal.py 2> /dev/null",
|
||||||
"on-click": "foot -T float khal interactive"
|
"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": {
|
"custom/mail": {
|
||||||
"format": "{icon} {}",
|
"format": "{icon} {}",
|
||||||
|
"tooltip-format": "{}",
|
||||||
|
"tooltip": true,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"min-length": 15,
|
"min-length": 5,
|
||||||
"max-length": 15,
|
"max-length": 5,
|
||||||
"interval": 30,
|
"interval": 30,
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"unread": " ",
|
"unread": " ",
|
||||||
"read": " "
|
"read": " "
|
||||||
},
|
},
|
||||||
"escape": true,
|
"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": {
|
"custom/media": {
|
||||||
"format": "{icon} {}",
|
"format": "{icon} {}",
|
||||||
|
"tooltip-format": "{}",
|
||||||
|
"tooltip": true,
|
||||||
"return-type": "json",
|
"return-type": "json",
|
||||||
"min-length": 30,
|
"min-length": 30,
|
||||||
"max-length": 40,
|
"max-length": 40,
|
||||||
"format-icons": {
|
"format-icons": {
|
||||||
"chromium": " ",
|
"chromium": " ",
|
||||||
"firefox": " ",
|
"firefox": " ",
|
||||||
"Plexamp": " ",
|
"Plexamp": "♫ ",
|
||||||
"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"
|
"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}",
|
||||||
"on-click": "foot -T float khal interactive"
|
"on-click": "foot -T float khal interactive"
|
||||||
},
|
},
|
||||||
"cpu": {
|
"cpu": {
|
||||||
|
@ -98,10 +120,6 @@
|
||||||
},
|
},
|
||||||
"on-click": "foot -T float bashtop"
|
"on-click": "foot -T float bashtop"
|
||||||
},
|
},
|
||||||
"backlight": {
|
|
||||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {percent:3}%",
|
|
||||||
"format-icons": [""]
|
|
||||||
},
|
|
||||||
"battery": {
|
"battery": {
|
||||||
"bat": "BAT0",
|
"bat": "BAT0",
|
||||||
"design-capacity": false,
|
"design-capacity": false,
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
* {
|
* {
|
||||||
border: none;
|
border: none;
|
||||||
border-radius: 0;
|
border-radius: 0;
|
||||||
font-family: "Cascadia Code PL Regular";
|
font-family: "Cascadia Code PL", "Font Awesome 5 Free";
|
||||||
font-size: 12px;
|
font-size: 13px;
|
||||||
min-height: 0;
|
min-height: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue