diff options
-rw-r--r-- | .config/eww/eww.scss | 4 | ||||
-rw-r--r-- | .config/eww/eww.yuck | 101 | ||||
-rwxr-xr-x | .config/eww/scripts/email-listener | 14 |
3 files changed, 104 insertions, 15 deletions
diff --git a/.config/eww/eww.scss b/.config/eww/eww.scss index c181194..078434b 100644 --- a/.config/eww/eww.scss +++ b/.config/eww/eww.scss @@ -23,6 +23,10 @@ label:last-child { margin-right: 12px; } + + box label:last-child { + margin-left: 12px; + } } .workspaces button { diff --git a/.config/eww/eww.yuck b/.config/eww/eww.yuck index b1b02ca..e599a52 100644 --- a/.config/eww/eww.yuck +++ b/.config/eww/eww.yuck @@ -1,3 +1,11 @@ +(defvar battery_rev false) +(defvar brightness_rev false) +(defvar emails_rev false) +(defvar keymap_rev false) +(defvar user_rev false) +(defvar volume_rev false) +(defvar wireless_rev false) + ;; Listeners (deflisten active-workspace `stdbuf -oL scripts/active-workspace-listener`) @@ -17,7 +25,7 @@ (deflisten keymap `stdbuf -oL scripts/keymap-listener`) -(deflisten emails +(deflisten emails :initial '{"icon":"","text":""}' `stdbuf -oL scripts/email-listener`) ;; Pollers @@ -82,25 +90,102 @@ datetime) (defwidget wireless [] - (pair :icon "" :text wireless)) + (eventbox + :onhover "eww update wireless_rev=true" + :onhoverlost "eww update wireless_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text "") + (revealer :transition "slideright" + :reveal wireless_rev + :duration "350ms" + (label :text wireless))))) (defwidget keymap [] - (pair :icon "" :text keymap)) + (eventbox + :onhover "eww update keymap_rev=true" + :onhoverlost "eww update keymap_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text "") + (revealer :transition "slideright" + :reveal keymap_rev + :duration "350ms" + (label :text keymap))))) (defwidget brightness [] - (pair :icon "" :text brightness)) + (eventbox + :onhover "eww update brightness_rev=true" + :onhoverlost "eww update brightness_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text "") + (revealer :transition "slideright" + :reveal brightness_rev + :duration "350ms" + (label :text brightness))))) (defwidget volume [] - (pair :icon {volume.icon} :text {volume.percentage})) + (eventbox + :onhover "eww update volume_rev=true" + :onhoverlost "eww update volume_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text {volume.icon}) + (revealer :transition "slideright" + :reveal volume_rev + :duration "350ms" + (label :text {volume.percentage}))))) (defwidget battery [] - (pair :icon {battery.icon} :text {battery.percentage})) + (eventbox + :onhover "eww update battery_rev=true" + :onhoverlost "eww update battery_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text {battery.icon}) + (revealer :transition "slideright" + :reveal battery_rev + :duration "350ms" + (label :text {battery.percentage}))))) (defwidget emails [] - (pair :icon "" :text emails)) + (eventbox + :onhover "eww update emails_rev=true" + :onhoverlost "eww update emails_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text {emails.icon}) + (revealer :transition "slideright" + :reveal emails_rev + :duration "350ms" + (label :text {emails.text}))))) (defwidget user [] - (pair :icon "" :text user)) + (eventbox + :onhover "eww update user_rev=true" + :onhoverlost "eww update user_rev=false" + (box :vexpand false + :hexpand false + :space-evenly false + :width 30 + (label :text "") + (revealer :transition "slideright" + :reveal user_rev + :duration "350ms" + (label :text user))))) (defwidget pair [icon text] (box :width 70 diff --git a/.config/eww/scripts/email-listener b/.config/eww/scripts/email-listener index a5444c8..41693f3 100755 --- a/.config/eww/scripts/email-listener +++ b/.config/eww/scripts/email-listener @@ -14,24 +14,24 @@ count() case $sum in 0) - printf 'No Mail' + printf 'icon=\ntext=No Email' ;; 1) - printf '1 Mail' + printf 'icon=\ntext=1 Email' ;; *) - printf '%d Mails' $sum + printf 'icon=\ntext=%d Emails' $sum ;; esac [ $new -gt 0 ] && printf ' (%d Unread)' $new echo - echo $new >"$CACHE" } { - while sleep 1 + while : do + sleep 1 read new_mails <"$CACHE" if [ $new_mails -gt ${prev:=0} ] then @@ -55,14 +55,14 @@ count() done } & -count +count | jo inotifywait -qm "$MAILDIR"/*/Inbox/new "$MAILDIR"/*/Inbox/cur \ | while read _ event _ do case "$event" in CREATE|DELETE|MOVED_*) - count + count | jo ;; esac done |