diff --git a/bin/mail b/bin/mail new file mode 100755 index 0000000..f616df3 --- /dev/null +++ b/bin/mail @@ -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 diff --git a/bin/waybar b/bin/waybar index 1f5ec79..550a0ee 100755 --- a/bin/waybar +++ b/bin/waybar @@ -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 diff --git a/waybar.d/annoyance.conf b/waybar.d/annoyance.conf deleted file mode 100644 index 7102e29..0000000 --- a/waybar.d/annoyance.conf +++ /dev/null @@ -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": "" - }, - "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": "{:%a, %d %b %H:%M}", - "tooltip-format": "{:%Y %B}\n{calendar}" - }, - "cpu": { - "format": " {usage}%", - "states": { - "warning": 70, - "critical": 90 - } - }, - "memory": { - "format": " {}%", - "states": { - "warning": 70, - "critical": 90 - } - }, - "backlight": { - "format": "{icon} {percent}%", - "format-icons": [""] - }, - "battery": { - "bat": "BAT0", - "design-capacity": true, - "states": { - "warning": 30, - "critical": 15 - }, - "format": "{icon} {capacity}%", - "format-charging": " {capacity}%", - "format-icons": ["", "", "", "", ""] - }, - "network#wl0": { - "interval": 2, - "interface": "wl0", - "format": "{ifname}", - "format-wifi": "{ifname} {essid} ({signalStrength}%)", - "format-ethernet": "{ifname}", - "format-linked": "{ifname}", - "format-disconnected": "{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": " {essid} ({signalStrength}%)", - "format-ethernet": "{ifname}", - "format-linked": "{ifname}", - "format-disconnected": "{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": " {essid} ({signalStrength}%)", - "format-ethernet": "{ifname}", - "format-linked": "{ifname}", - "format-disconnected": " {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": "{icon} {volume}% {format_source}", - "format-bluetooth": "{icon} {volume}% {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": "{format_source}", - "format-source": "{volume}%", - "format-source-muted": "", - "format-icons": { - "headphone": "🎧", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["", "", ""] - }, - "on-click": "pkill -x pavucontrol || pavucontrol" - }, - "tray": { - "padding": 10, - "spacing": 10 - } -} - diff --git a/waybar.d/90PKL63.conf b/waybar.d/config similarity index 92% rename from waybar.d/90PKL63.conf rename to waybar.d/config index 3f1c090..0e63f4a 100644 --- a/waybar.d/90PKL63.conf +++ b/waybar.d/config @@ -9,6 +9,8 @@ "sway/window" ], "modules-right": [ + "custom/separator", + "custom/mail", "custom/separator", "pulseaudio", "custom/media", @@ -28,7 +30,19 @@ "tray" ], "custom/separator": { - "format": "" + "format": " " + }, + "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} {}", diff --git a/waybar.d/7DPQTN2.conf b/waybar.d/config_annoyance similarity index 94% rename from waybar.d/7DPQTN2.conf rename to waybar.d/config_annoyance index 3f1c090..89e22b6 100644 --- a/waybar.d/7DPQTN2.conf +++ b/waybar.d/config_annoyance @@ -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": "" }, + "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", diff --git a/waybar.d/silence.conf b/waybar.d/silence.conf deleted file mode 100644 index 3f1c090..0000000 --- a/waybar.d/silence.conf +++ /dev/null @@ -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": "" - }, - "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": "{:%a, %d %b %H:%M}", - "tooltip-format": "{:%Y %B}\n{calendar}" - }, - "cpu": { - "format": " {usage}%", - "states": { - "warning": 70, - "critical": 90 - } - }, - "memory": { - "format": " {}%", - "states": { - "warning": 70, - "critical": 90 - } - }, - "backlight": { - "format": "{icon} {percent}%", - "format-icons": [""] - }, - "battery": { - "bat": "BAT0", - "design-capacity": true, - "states": { - "warning": 30, - "critical": 15 - }, - "format": "{icon} {capacity}%", - "format-charging": " {capacity}%", - "format-icons": ["", "", "", "", ""] - }, - "network#wl0": { - "interval": 2, - "interface": "wl0", - "format": "{ifname}", - "format-wifi": "{ifname} {essid} ({signalStrength}%)", - "format-ethernet": "{ifname}", - "format-linked": "{ifname}", - "format-disconnected": "{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": " {essid} ({signalStrength}%)", - "format-ethernet": "{ifname}", - "format-linked": "{ifname}", - "format-disconnected": "{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": " {essid} ({signalStrength}%)", - "format-ethernet": "{ifname}", - "format-linked": "{ifname}", - "format-disconnected": " {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": "{icon} {volume}% {format_source}", - "format-bluetooth": "{icon} {volume}% {format_source}", - "format-bluetooth-muted": " {icon} {format_source}", - "format-muted": "{format_source}", - "format-source": "{volume}%", - "format-source-muted": "", - "format-icons": { - "headphone": "🎧", - "hands-free": "", - "headset": "", - "phone": "", - "portable": "", - "car": "", - "default": ["", "", ""] - }, - "on-click": "pkill -x pavucontrol || pavucontrol" - }, - "tray": { - "padding": 10, - "spacing": 10 - } -} -