waybar: use default config for most hosts, add mail status
This commit is contained in:
parent
4939e65708
commit
b4b0adf131
6 changed files with 52 additions and 286 deletions
18
bin/mail
Executable file
18
bin/mail
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/bash
|
||||
|
||||
MAILDIR=$HOME/.mail
|
||||
ACCOUNTS=(posteo gmail xkonni)
|
||||
|
||||
text=""
|
||||
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+=", "
|
||||
done
|
||||
|
||||
alt=$( [ $total -gt 0 ] && echo "unread" || echo "read" )
|
||||
text="$total ($text)"
|
||||
json="{\"text\": \"$text\", \"class\": \"mail\", \"alt\": \"$alt\"}"
|
||||
echo $json
|
|
@ -1,7 +1,11 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
CONFIG_DIR=$HOME/.config/sway/waybar.d
|
||||
CONFIG=$CONFIG_DIR/$(hostname).conf
|
||||
CONFIG=$CONFIG_DIR/config
|
||||
CONFIG_HOST=$CONFIG_DIR/config_$(hostname)
|
||||
if [ -f $CONFIG_HOST ]; then
|
||||
CONFIG=$CONFIG_HOST
|
||||
fi
|
||||
STYLE=$CONFIG_DIR/style.css
|
||||
|
||||
# Terminate already running bar instances
|
||||
|
|
|
@ -1,139 +0,0 @@
|
|||
// vi: ft=jsonc
|
||||
{
|
||||
"layer": "top",
|
||||
"height": 25,
|
||||
"modules-left": [
|
||||
"sway/workspaces"
|
||||
],
|
||||
"modules-center": [
|
||||
"sway/window"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/separator",
|
||||
"pulseaudio",
|
||||
"custom/media",
|
||||
"custom/separator",
|
||||
"network#en0",
|
||||
"network#vpn0",
|
||||
"custom/separator",
|
||||
"cpu",
|
||||
"memory",
|
||||
"custom/separator",
|
||||
"backlight",
|
||||
"custom/separator",
|
||||
"clock",
|
||||
"tray"
|
||||
],
|
||||
"custom/separator": {
|
||||
"format": "<span foreground='#268bd2'>❮</span>"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"chromium": " ",
|
||||
"firefox": " ",
|
||||
"Plexamp": "",
|
||||
"default": " "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/mediaplayer.py 2> /dev/null",
|
||||
"exec-if": "pgrep plexamp"
|
||||
},
|
||||
"clock": {
|
||||
"format": "<span foreground='#ebdbb2'> </span>{:%a, %d %b <span foreground='#ebdbb2'> </span>%H:%M}",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||
},
|
||||
"cpu": {
|
||||
"format": "<span foreground='#ebdbb2'></span> {usage}%",
|
||||
"states": {
|
||||
"warning": 70,
|
||||
"critical": 90
|
||||
}
|
||||
},
|
||||
"memory": {
|
||||
"format": "<span foreground='#ebdbb2'></span> {}%",
|
||||
"states": {
|
||||
"warning": 70,
|
||||
"critical": 90
|
||||
}
|
||||
},
|
||||
"backlight": {
|
||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {percent}%",
|
||||
"format-icons": [""]
|
||||
},
|
||||
"battery": {
|
||||
"bat": "BAT0",
|
||||
"design-capacity": true,
|
||||
"states": {
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {capacity}%",
|
||||
"format-charging": "<span foreground='#fb4934'></span> {capacity}%",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"network#wl0": {
|
||||
"interval": 2,
|
||||
"interface": "wl0",
|
||||
"format": "{ifname}",
|
||||
"format-wifi": "<span foreground='#ebdbb2'> </span>{ifname} {essid} ({signalStrength}%)",
|
||||
"format-ethernet": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||
"format-linked": "<span foreground='#606060'> </span>{ifname}",
|
||||
"format-disconnected": "<span foreground='#fb4934'> </span>{ifname} ",
|
||||
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||
"tooltip-format-linked": "{ifname} linked",
|
||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||
"on-click": "foot -T float nmtui"
|
||||
},
|
||||
"network#en0": {
|
||||
"interval": 2,
|
||||
"interface": "en0",
|
||||
"format": "{ifname}",
|
||||
"format-wifi": "<span foreground='#ebdbb2'> </span> {essid} ({signalStrength}%)",
|
||||
"format-ethernet": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||
"format-linked": "<span foreground='#606060'> </span>{ifname}",
|
||||
"format-disconnected": "<span foreground='#fb4934'> </span>{ifname}",
|
||||
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||
"tooltip-format-linked": "{ifname} linked",
|
||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||
"on-click": "foot -T float nmtui"
|
||||
},
|
||||
"network#vpn0": {
|
||||
"interval": 2,
|
||||
"interface": "vpn0",
|
||||
"format": "{ifname}",
|
||||
"format-wifi": "<span foreground='#ebdbb2'> </span> {essid} ({signalStrength}%)",
|
||||
"format-ethernet": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||
"format-linked": "<span foreground='#606060'> </span>{ifname}",
|
||||
"format-disconnected": "<span foreground='#fb4934'> </span> {ifname}",
|
||||
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||
"tooltip-format-linked": "{ifname} linked",
|
||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||
"on-click": "foot -T float nmtui"
|
||||
},
|
||||
"pulseaudio": {
|
||||
"format": "<span foreground='#ebdbb2'>{icon} </span>{volume}% {format_source}",
|
||||
"format-bluetooth": "<span foreground='#ebdbb2'>{icon} </span>{volume}% {format_source}",
|
||||
"format-bluetooth-muted": "<span foreground='#fb4934'> {icon} </span>{format_source}",
|
||||
"format-muted": "<span foreground='#fb4934'> </span>{format_source}",
|
||||
"format-source": "<span foreground='#ebdbb2'> </span>{volume}%",
|
||||
"format-source-muted": "<span foreground='#fb4934'> </span>",
|
||||
"format-icons": {
|
||||
"headphone": "🎧",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pkill -x pavucontrol || pavucontrol"
|
||||
},
|
||||
"tray": {
|
||||
"padding": 10,
|
||||
"spacing": 10
|
||||
}
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
"sway/window"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/separator",
|
||||
"custom/mail",
|
||||
"custom/separator",
|
||||
"pulseaudio",
|
||||
"custom/media",
|
||||
|
@ -30,6 +32,18 @@
|
|||
"custom/separator": {
|
||||
"format": " <span foreground='#268bd2'>❮</span> "
|
||||
},
|
||||
"custom/mail": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 15,
|
||||
"interval": 30,
|
||||
"format-icons": {
|
||||
"unread": " ",
|
||||
"read": " "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/mail 2> /dev/null"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
|
@ -9,11 +9,12 @@
|
|||
"sway/window"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/separator",
|
||||
"custom/mail",
|
||||
"custom/separator",
|
||||
"pulseaudio",
|
||||
"custom/media",
|
||||
"custom/separator",
|
||||
"network#wl0",
|
||||
"network#en0",
|
||||
"network#vpn0",
|
||||
"custom/separator",
|
||||
|
@ -22,14 +23,24 @@
|
|||
"custom/separator",
|
||||
"backlight",
|
||||
"custom/separator",
|
||||
"battery",
|
||||
"custom/separator",
|
||||
"clock",
|
||||
"tray"
|
||||
],
|
||||
"custom/separator": {
|
||||
"format": "<span foreground='#268bd2'>❮</span>"
|
||||
},
|
||||
"custom/mail": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 15,
|
||||
"interval": 30,
|
||||
"format-icons": {
|
||||
"unread": " ",
|
||||
"read": " "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/mail 2> /dev/null"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
|
@ -1,142 +0,0 @@
|
|||
// vi: ft=jsonc
|
||||
{
|
||||
"layer": "top",
|
||||
"height": 25,
|
||||
"modules-left": [
|
||||
"sway/workspaces"
|
||||
],
|
||||
"modules-center": [
|
||||
"sway/window"
|
||||
],
|
||||
"modules-right": [
|
||||
"custom/separator",
|
||||
"pulseaudio",
|
||||
"custom/media",
|
||||
"custom/separator",
|
||||
"network#wl0",
|
||||
"network#en0",
|
||||
"network#vpn0",
|
||||
"custom/separator",
|
||||
"cpu",
|
||||
"memory",
|
||||
"custom/separator",
|
||||
"backlight",
|
||||
"custom/separator",
|
||||
"battery",
|
||||
"custom/separator",
|
||||
"clock",
|
||||
"tray"
|
||||
],
|
||||
"custom/separator": {
|
||||
"format": "<span foreground='#268bd2'>❮</span>"
|
||||
},
|
||||
"custom/media": {
|
||||
"format": "{icon} {}",
|
||||
"return-type": "json",
|
||||
"max-length": 40,
|
||||
"format-icons": {
|
||||
"chromium": " ",
|
||||
"firefox": " ",
|
||||
"Plexamp": "",
|
||||
"default": " "
|
||||
},
|
||||
"escape": true,
|
||||
"exec": "$HOME/.config/sway/bin/mediaplayer.py 2> /dev/null",
|
||||
"exec-if": "pgrep plexamp"
|
||||
},
|
||||
"clock": {
|
||||
"format": "<span foreground='#ebdbb2'> </span>{:%a, %d %b <span foreground='#ebdbb2'> </span>%H:%M}",
|
||||
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
|
||||
},
|
||||
"cpu": {
|
||||
"format": "<span foreground='#ebdbb2'></span> {usage}%",
|
||||
"states": {
|
||||
"warning": 70,
|
||||
"critical": 90
|
||||
}
|
||||
},
|
||||
"memory": {
|
||||
"format": "<span foreground='#ebdbb2'></span> {}%",
|
||||
"states": {
|
||||
"warning": 70,
|
||||
"critical": 90
|
||||
}
|
||||
},
|
||||
"backlight": {
|
||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {percent}%",
|
||||
"format-icons": [""]
|
||||
},
|
||||
"battery": {
|
||||
"bat": "BAT0",
|
||||
"design-capacity": true,
|
||||
"states": {
|
||||
"warning": 30,
|
||||
"critical": 15
|
||||
},
|
||||
"format": "<span foreground='#ebdbb2'>{icon}</span> {capacity}%",
|
||||
"format-charging": "<span foreground='#fb4934'></span> {capacity}%",
|
||||
"format-icons": ["", "", "", "", ""]
|
||||
},
|
||||
"network#wl0": {
|
||||
"interval": 2,
|
||||
"interface": "wl0",
|
||||
"format": "{ifname}",
|
||||
"format-wifi": "<span foreground='#ebdbb2'> </span>{ifname} {essid} ({signalStrength}%)",
|
||||
"format-ethernet": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||
"format-linked": "<span foreground='#606060'> </span>{ifname}",
|
||||
"format-disconnected": "<span foreground='#fb4934'> </span>{ifname} ",
|
||||
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||
"tooltip-format-linked": "{ifname} linked",
|
||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||
"on-click": "foot -T float nmtui"
|
||||
},
|
||||
"network#en0": {
|
||||
"interval": 2,
|
||||
"interface": "en0",
|
||||
"format": "{ifname}",
|
||||
"format-wifi": "<span foreground='#ebdbb2'> </span> {essid} ({signalStrength}%)",
|
||||
"format-ethernet": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||
"format-linked": "<span foreground='#606060'> </span>{ifname}",
|
||||
"format-disconnected": "<span foreground='#fb4934'> </span>{ifname}",
|
||||
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||
"tooltip-format-linked": "{ifname} linked",
|
||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||
"on-click": "foot -T float nmtui"
|
||||
},
|
||||
"network#vpn0": {
|
||||
"interval": 2,
|
||||
"interface": "vpn0",
|
||||
"format": "{ifname}",
|
||||
"format-wifi": "<span foreground='#ebdbb2'> </span> {essid} ({signalStrength}%)",
|
||||
"format-ethernet": "<span foreground='#ebdbb2'> </span>{ifname}",
|
||||
"format-linked": "<span foreground='#606060'> </span>{ifname}",
|
||||
"format-disconnected": "<span foreground='#fb4934'> </span> {ifname}",
|
||||
"tooltip-format": "{ifname}\n\t{ipaddr}/{cidr}\n \t{bandwidthDownBits}\n \t{bandwidthUpBits}",
|
||||
"tooltip-format-linked": "{ifname} linked",
|
||||
"tooltip-format-disconnected": "{ifname} disconnected",
|
||||
"on-click": "foot -T float nmtui"
|
||||
},
|
||||
"pulseaudio": {
|
||||
"format": "<span foreground='#ebdbb2'>{icon} </span>{volume}% {format_source}",
|
||||
"format-bluetooth": "<span foreground='#ebdbb2'>{icon} </span>{volume}% {format_source}",
|
||||
"format-bluetooth-muted": "<span foreground='#fb4934'> {icon} </span>{format_source}",
|
||||
"format-muted": "<span foreground='#fb4934'> </span>{format_source}",
|
||||
"format-source": "<span foreground='#ebdbb2'> </span>{volume}%",
|
||||
"format-source-muted": "<span foreground='#fb4934'> </span>",
|
||||
"format-icons": {
|
||||
"headphone": "🎧",
|
||||
"hands-free": "",
|
||||
"headset": "",
|
||||
"phone": "",
|
||||
"portable": "",
|
||||
"car": "",
|
||||
"default": ["", "", ""]
|
||||
},
|
||||
"on-click": "pkill -x pavucontrol || pavucontrol"
|
||||
},
|
||||
"tray": {
|
||||
"padding": 10,
|
||||
"spacing": 10
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in a new issue