polybar: Add simple mail display script module
The module will pick up the current state of the systemd mbsync.timer and display an according icon (sleepy bell if auto-sync is off, mail icon if auto-sync is on). It will use notmuch counters to show only unread mails in the inbox, which generally constitute the 'new' mails one wants to know about. It will not display anything if it did not find 'new' mails. Lastly, right-clicking allows starting the auto-sync timer and left clicking allows to stop it. FIXME: The icon will only update on the next update interval of the module itself (which is set at 300 seconds). That means, after clicking the icon to start or stop the auto-sync, the actual state will not be reflected by the icon for a couple of minutes.
This commit is contained in:
parent
7bee413323
commit
b29570327b
1 changed files with 10 additions and 1 deletions
|
@ -59,7 +59,7 @@ module-margin-left = 2
|
|||
|
||||
modules-left = workspaces sxhkdmode pomo
|
||||
modules-center = music date papersdue
|
||||
modules-right = networkspeed weather archupdates cpu temp backlight volume battery
|
||||
modules-right = networkspeed mail weather archupdates cpu temp backlight volume battery
|
||||
; do not use offsets for the bar, would only work with override-redirect
|
||||
; and will mess up tray https://github.com/polybar/polybar/issues/1355
|
||||
tray-position = right
|
||||
|
@ -250,6 +250,15 @@ format-prefix = " "
|
|||
interval = 120
|
||||
format-underline = ${colors.primary}
|
||||
|
||||
[module/mail]
|
||||
type = custom/script
|
||||
exec = echo "$( [ $(systemctl --user --property=ActiveState show mbsync.timer) = 'ActiveState=active' ] && echo "" || echo "" ) $(notmuch count tag:inbox and tag:unread)"
|
||||
exec-if = [ "$(notmuch count tag:inbox and tag:unread)" -gt 0 ]
|
||||
click-right = systemctl --user start mbsync.timer
|
||||
click-left = systemctl --user stop mbsync.timer
|
||||
interval = 300.0
|
||||
format-underline = ${colors.primary}
|
||||
|
||||
[module/weather]
|
||||
type = custom/script
|
||||
exec = $XDG_CONFIG_HOME/polybar/scripts/poly-weather '?format=%t+%C+(%p)'
|
||||
|
|
Loading…
Reference in a new issue