From 0afea30934f267015b60993ef650652784b6ebc8 Mon Sep 17 00:00:00 2001 From: Jiri Kalvoda <jirikalvoda@kam.mff.cuni.cz> Date: Sun, 29 Nov 2020 11:42:15 +0100 Subject: [PATCH] MAIL Daemon --- i3/config | 4 +++- mail/init.sh | 3 ++- mail/m-daemon.sh | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100755 mail/m-daemon.sh diff --git a/i3/config b/i3/config index a328ef8..2d4c4d9 100644 --- a/i3/config +++ b/i3/config @@ -346,7 +346,7 @@ bindcode 123 exec "echo $(( $(cat .config/micloop/volume) + 10000 )) > .config/ #bindsym Control+Print exec gnome-screenshot -i #bindsym $mod+Print exec printscreengimp -bindsym Print exec "maim -suo | xclip -selection clipboard -t image/png" +bindsym Print exec "maim -suo | tee ~/screenshot.png | xclip -selection clipboard -t image/png" bindsym Shift+Print exec "maim -suo > ~/screenshot.png ; convert ~/screenshot.png $(zenity --file-selection --save --file-filter='Picture | *.png *.jpg *.gif *.bmp' --confirm-overwrite)" bindsym Ctrl+Shift+Print exec "maim -uo | convert png:- `zenity --file-selection --save --file-filter='Picture | *.png *.jpg *.gif *.bmp' --confirm-overwrite`" bindsym Ctrl+Print exec " maim -uo | xclip -selection clipboard -t image/png" @@ -356,6 +356,7 @@ exec --no-startup-id /usr/lib/policykit-1-gnome/polkit-gnome-authentication-agen for_window [class=".*"] border pixel 1 for_window [class="zoom"] move container to workspace ZOOM +for_window [title="MAIL"] move container to workspace MAIL for_window [title="Jitsi Meet"] floating enable @@ -380,6 +381,7 @@ bindsym $mod+Shift+o exec --no-startup-id killall -3 mate-session; exec --no-sta exec "setxkbmap us,cz -variant ,ucw -option grp:caps_switch" exec --no-startup-id "sleep 2; osdd-run & sleep 1;osdc --color=red START" +exec --no-startup-id "sleep 5; terminal -e m-daemon" bindcode 94 exec "osdc --duration=1 --log=1 \\"\\"" bindcode $mod+51 exec "osdc --duration=1 --log=1 \\"\\"" diff --git a/mail/init.sh b/mail/init.sh index c6d5f61..bd54158 100755 --- a/mail/init.sh +++ b/mail/init.sh @@ -12,6 +12,7 @@ sudo systemctl enable offlineimap-jiri mkdir -p ~/.config/neomutt ln -sr neomuttrc ~/.config/neomutt/ ln -sr m ~/bin +ln -sr m-daemon ~/bin ln -sr ~/Maildir-no-dot/INBOX ~/Maildir @@ -21,7 +22,7 @@ ln -sr ~/Maildir-no-dot/INBOX ~/Maildir do if [[ "$i" != "INBOX" ]] then - ln -sr $i INBOX/.$i + ln -sr $i INBOX/ fi done diff --git a/mail/m-daemon.sh b/mail/m-daemon.sh new file mode 100755 index 0000000..e109481 --- /dev/null +++ b/mail/m-daemon.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +kilrek() +{ + pgrep -P $1 | while read p; + do + echo $1 $2 to $p; + if [[ "$p" != "$2" ]] + then + kilrek $p $2 + echo $p; + kill $p; + fi + done + +} +whileok() +{ + while true + do + sleep 60 + read -ra x < ~/.cm + delay=$(( $(date +%s) - ${x[0]} )) + if (( $delay > 120 )) + then + ( + echo KILL + pidwok=$BASHPID + echo pidwok $pidwok + kilrek $1 $pidwok + return; + ) + fi + done +} + +pid=$BASHPID +while $run +do + whileok $pid & + echo -ne "\033]0;MAIL\007" + osdc --log=2 --color=red "TRY START MAIL" + m + sleep 2 +done + -- GitLab