mail: create notify mail service
This commit is contained in:
parent
1c0d53aa21
commit
80a6bdf2d1
|
@ -269,7 +269,7 @@ actions:
|
|||
_runit_config "{{@@ _dotfile_abs_dst @@}}"
|
||||
fusuma gammastep mako xsettingsd mpd mpDris2 telegram pipewire
|
||||
pipewire-media-session xdpw pulseaudio kdeconnectd kdeconnect-indicator
|
||||
kanshi swayidle waybar syncthing udiskie
|
||||
kanshi swayidle waybar syncthing udiskie notify-mail
|
||||
|
||||
# bootstrap scripts
|
||||
pam_gpg: _pam-gpg-strap
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec _notify-mail
|
|
@ -0,0 +1,54 @@
|
|||
#!/bin/fish
|
||||
|
||||
set NEW_MAIL_PATH ~/.local/share/mail/*/*/new/
|
||||
set ICON "/usr/share/icons/{{@@ icon_theme @@}}/symbolic/status/mail-unread-symbolic.svg"
|
||||
|
||||
inotifywait \
|
||||
--monitor \
|
||||
--quiet \
|
||||
--format %w%f \
|
||||
-e move -e create \
|
||||
$NEW_MAIL_PATH |
|
||||
while read new_mail_file
|
||||
# clear variables
|
||||
set -e from
|
||||
set -e subject
|
||||
set -e headers_ended
|
||||
|
||||
test -f "$new_mail_file"
|
||||
or continue
|
||||
|
||||
command cat "$new_mail_file" |
|
||||
while read line
|
||||
# End of headers
|
||||
if string match -qr '^$' "$line"
|
||||
set headers_ended
|
||||
continue
|
||||
end
|
||||
if not set -q headers_ended
|
||||
# capture header information
|
||||
if string match -qr '^From: ' $line
|
||||
set from $line
|
||||
end
|
||||
if string match -qr '^Subject: ' $line
|
||||
set subject $line
|
||||
end
|
||||
else
|
||||
# capture start of message, to maybe use as replacement of subject
|
||||
set msg_head $line
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
# From may be formated as either "someone@example.com" or "Someone <someone@example.com>"
|
||||
# Make for the seconde case, replace <.*> with nothing
|
||||
set from (string replace -r '<.*>' '' $from)
|
||||
|
||||
# If a message lacks a subject, use the message head as one
|
||||
if not test -n "$subject"
|
||||
set subject "$msg_head"
|
||||
end
|
||||
|
||||
notify-send --icon "$ICON" "$from" "$subject"
|
||||
|
||||
end
|
|
@ -6,9 +6,6 @@ then
|
|||
exit 0
|
||||
fi
|
||||
|
||||
test -z "$XDG_RUNTIME_DIR" &&
|
||||
export XDG_RUNTIME_DIR=/run/user/$(id -u)
|
||||
|
||||
die() {
|
||||
test "$?" = 0 ||
|
||||
notify-send "Failed to sync mail" "try unlocking your gpg key"
|
||||
|
@ -19,16 +16,6 @@ die() {
|
|||
mkdir -p "$HOME/.local/share/mail/{{@@ name @@}}/"
|
||||
{%@@ endfor @@%}
|
||||
|
||||
getnew() {
|
||||
cd "$HOME/.local/share/mail/" >/dev/null
|
||||
|
||||
find */INBOX*/new -type f |
|
||||
sed -E '/Duolingo|LBRY/d' |
|
||||
wc -l
|
||||
}
|
||||
|
||||
OLD=$(getnew)
|
||||
|
||||
if test "$1" = "update" && ! pidof mbsync; then
|
||||
if ! ping -c3 {{@@ mail.personal.imap @@}} > /dev/null
|
||||
then
|
||||
|
@ -37,12 +24,10 @@ if test "$1" = "update" && ! pidof mbsync; then
|
|||
mbsync -a
|
||||
fi
|
||||
|
||||
NEW=$(getnew)
|
||||
cd "$HOME/.local/share/mail/" >/dev/null
|
||||
|
||||
if test "$NEW" -gt "$OLD"; then
|
||||
notify-send " New E-Mails!"
|
||||
fi
|
||||
|
||||
echo $NEW | sed 's/^0$//'
|
||||
find */INBOX*/new -type f |
|
||||
wc -l |
|
||||
sed 's/^0$//'
|
||||
|
||||
# vim:ft=sh
|
||||
|
|
21
void.freeze
21
void.freeze
|
@ -1,9 +1,11 @@
|
|||
ImageMagick-7.1.0.19_1
|
||||
MangoHud-0.6.5_1
|
||||
Thunar-4.16.10_1
|
||||
Waybar-0.9.9_1
|
||||
alacritty-0.9.0_2
|
||||
apache-2.4.52_1
|
||||
atool-0.39.0_6
|
||||
bamf-devel-0.5.5_1
|
||||
base-system-0.114_1
|
||||
bat-0.18.3_1
|
||||
bc-1.07.1_5
|
||||
|
@ -45,6 +47,7 @@ fzf-0.29.0_1
|
|||
gammastep-2.0.7_2
|
||||
gcc-10.2.1pre1_3
|
||||
gdb-11.1_2
|
||||
gettext-0.21_4
|
||||
gimp-2.10.30_1
|
||||
git-2.35.0_1
|
||||
glib-devel-2.70.2_1
|
||||
|
@ -54,23 +57,26 @@ grub-x86_64-efi-2.06_2
|
|||
gst-plugins-bad1-1.18.5_1
|
||||
gst-plugins-good1-1.18.5_1
|
||||
gst-plugins-ugly1-1.18.5_1
|
||||
gtk+-devel-2.24.32_4
|
||||
gtk+3-devel-3.24.31_1
|
||||
gtk3-nocsd-3.0.8_1
|
||||
htop-3.1.2_1
|
||||
inetutils-2.2_1
|
||||
inkscape-1.1.1_3
|
||||
intel-media-driver-21.3.5_1
|
||||
inotify-tools-3.20.11.0_1
|
||||
intel-media-driver-22.1.1_1
|
||||
intel-video-accel-1_2
|
||||
inxi-3.3.07_1
|
||||
iotop-0.6_9
|
||||
isync-1.4.4_1
|
||||
iwd-1.21_1
|
||||
iwd-1.23_1
|
||||
j4-dmenu-desktop-2.18_3
|
||||
jnettop-0.13.0_2
|
||||
jq-1.6_1
|
||||
kak-lsp-11.1.0_1
|
||||
kakoune-2021.11.08_1
|
||||
kanshi-1.2.0_1
|
||||
kdeconnect-21.12.1_1
|
||||
kdeconnect-21.12.2_1
|
||||
khal-0.10.4_2
|
||||
khard-0.17.0_4
|
||||
kitty-0.24.1_1
|
||||
|
@ -78,6 +84,7 @@ kvantum-1.0.0_1
|
|||
libappindicator-12.10.0_3
|
||||
libbsd-devel-0.11.5_1
|
||||
liberation-fonts-ttf-2.1.5_1
|
||||
libgee08-devel-0.20.4_1
|
||||
libgepub-0.6.0_4
|
||||
libmariadbclient-devel-10.5.10_2
|
||||
libpipewire0.2-0.2.7_2
|
||||
|
@ -136,8 +143,9 @@ php-apache-7.4.27_1
|
|||
php-intl-7.4.27_1
|
||||
php-mysql-7.4.27_1
|
||||
phpMyAdmin-5.0.4_1
|
||||
pipewire-0.3.43_1
|
||||
pipewire-0.3.45_1
|
||||
pkg-config-0.29.2_3
|
||||
plank-devel-0.11.89_2
|
||||
playerctl-2.4.1_1
|
||||
playonlinux-4.3.4_2
|
||||
polkit-0.120_1
|
||||
|
@ -196,12 +204,13 @@ tumbler-4.16.0_2
|
|||
udiskie-2.2.0_4
|
||||
unrar-6.1.4_1
|
||||
urlview-0.9_2
|
||||
vala-0.54.6_1
|
||||
vdirsyncer-0.18.0_2
|
||||
void-repo-multilib-6_3
|
||||
void-repo-nonfree-9_5
|
||||
vscode-1.63.2_1
|
||||
wayland-devel-1.19.0_1
|
||||
wayland-protocols-1.24_1
|
||||
wayland-protocols-1.25_1
|
||||
wget-1.21.2_1
|
||||
wine-7.1_1
|
||||
wine-32bit-7.1_1
|
||||
|
@ -216,7 +225,7 @@ xsettingsd-1.0.2_1
|
|||
xtools-0.63_1
|
||||
xz-5.2.5_2
|
||||
yarn-1.22.10_1
|
||||
yt-dlp-2022.01.21_1
|
||||
yt-dlp-2022.02.04_1
|
||||
zathura-0.4.8_1
|
||||
zathura-pdf-poppler-0.3.0_1
|
||||
zoxide-0.8.0_1
|
||||
|
|
Reference in New Issue