Add script to periodicaly watch imaps server. Some ergonomic improvements
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
|||||||
scripts/variables
|
scripts/variables
|
||||||
|
scripts/imap_creds
|
||||||
links/X11/.Xresources
|
links/X11/.Xresources
|
||||||
links/dunst/dunstrc
|
links/dunst/dunstrc
|
||||||
links/polybar/colors.ini
|
links/polybar/colors.ini
|
||||||
|
|||||||
7
icons/gmail.svg
Normal file
7
icons/gmail.svg
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="52 42 88 66">
|
||||||
|
<path fill="#4285f4" d="M58 108h14V74L52 59v43c0 3.32 2.69 6 6 6"/>
|
||||||
|
<path fill="#34a853" d="M120 108h14c3.32 0 6-2.69 6-6V59l-20 15"/>
|
||||||
|
<path fill="#fbbc04" d="M120 48v26l20-15v-8c0-7.42-8.47-11.65-14.4-7.2"/>
|
||||||
|
<path fill="#ea4335" d="M72 74V48l24 18 24-18v26L96 92"/>
|
||||||
|
<path fill="#c5221f" d="M52 51v8l20 15V48l-5.6-4.2c-5.94-4.45-14.4-.22-14.4 7.2"/>
|
||||||
|
</svg>
|
||||||
|
After Width: | Height: | Size: 419 B |
@@ -16,13 +16,10 @@ scrollback_indicator_opacity 0.5
|
|||||||
|
|
||||||
#Url
|
#Url
|
||||||
open_url_with firefox
|
open_url_with firefox
|
||||||
|
|
||||||
underline_hyperlinks always
|
underline_hyperlinks always
|
||||||
|
|
||||||
copy_on_select clipboard
|
copy_on_select clipboard
|
||||||
|
select_by_word_characters @-./_~?&%+#!
|
||||||
select_by_word_characters @-./_~?&%+#
|
|
||||||
|
|
||||||
sync_to_monitor yes
|
sync_to_monitor yes
|
||||||
|
|
||||||
# Layout
|
# Layout
|
||||||
@@ -49,3 +46,6 @@ map alt+left previous_tab
|
|||||||
map alt+right next_tab
|
map alt+right next_tab
|
||||||
map alt+tab next_tab
|
map alt+tab next_tab
|
||||||
map alt+t set_tab_title
|
map alt+t set_tab_title
|
||||||
|
# Copy paste
|
||||||
|
map ctrl+alt+c copy_to_clipboard
|
||||||
|
map ctrl+alt+v paste_from_clipboard
|
||||||
|
|||||||
@@ -170,6 +170,24 @@ format-prefix-font = 2
|
|||||||
format-prefix-padding-right = 5px
|
format-prefix-padding-right = 5px
|
||||||
format-prefix-foreground=${colors.primary}
|
format-prefix-foreground=${colors.primary}
|
||||||
|
|
||||||
|
[module/watchdog]
|
||||||
|
type = custom/script
|
||||||
|
exec = /usr/local/share/dotfiles/scripts/mailbox.sh count
|
||||||
|
interval = 30
|
||||||
|
|
||||||
|
format = <label>
|
||||||
|
#format-prefix = "✗ "
|
||||||
|
format-prefix = " "
|
||||||
|
format-prefix-font = 2
|
||||||
|
format-prefix-padding-right = 5px
|
||||||
|
format-prefix-foreground=${colors.primary}
|
||||||
|
|
||||||
|
format-fail = <label-fail>
|
||||||
|
format-fail-prefix = "✗ "
|
||||||
|
format-fail-prefix-font = 0
|
||||||
|
format-fail-prefix-foreground=${colors.alert}
|
||||||
|
|
||||||
|
click-left = /usr/local/share/dotfiles/scripts/mailbox.sh fetch
|
||||||
|
|
||||||
[module/dateprefix]
|
[module/dateprefix]
|
||||||
type = custom/text
|
type = custom/text
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ padding-right = 0px
|
|||||||
font-0 = ComicShannsMono Nerd Font:size=14;2
|
font-0 = ComicShannsMono Nerd Font:size=14;2
|
||||||
font-1 = ComicShannsMono Nerd Font:size=14;1
|
font-1 = ComicShannsMono Nerd Font:size=14;1
|
||||||
font-2 = ComicShannsMono Nerd Font:size=14;0
|
font-2 = ComicShannsMono Nerd Font:size=14;0
|
||||||
|
font-3 = DejaVuSansM Nerd Font:size=14;0
|
||||||
|
|
||||||
fixed-center = true
|
fixed-center = true
|
||||||
modules-left = arch separator cpu separator memory separator filesystemprefix filesystem separator eth separator ethspeed separator pulseaudio
|
modules-left = arch separator cpu separator memory separator filesystemprefix filesystem separator eth separator ethspeed separator pulseaudio
|
||||||
@@ -49,11 +50,12 @@ padding-right = 0px
|
|||||||
font-0 = ComicShannsMono Nerd Font:size=14;2
|
font-0 = ComicShannsMono Nerd Font:size=14;2
|
||||||
font-1 = ComicShannsMono Nerd Font:size=14;1
|
font-1 = ComicShannsMono Nerd Font:size=14;1
|
||||||
font-2 = ComicShannsMono Nerd Font:size=14;0
|
font-2 = ComicShannsMono Nerd Font:size=14;0
|
||||||
|
font-3 = DejaVuSansM Nerd Font:size=14;0
|
||||||
|
|
||||||
fixed-center = true
|
fixed-center = true
|
||||||
modules-left = arch separator cpu separator memory separator filesystemprefix filesystem separator eth separator ethspeed separator pulseaudio
|
modules-left = arch separator cpu separator memory separator filesystemprefix filesystem separator eth separator ethspeed separator pulseaudio
|
||||||
modules-center = i3
|
modules-center = i3
|
||||||
modules-right = pacman separator xkeyboard separator dateprefix date systray
|
modules-right = watchdog separator pacman separator xkeyboard separator dateprefix date systray
|
||||||
|
|
||||||
cursor-click = pointer
|
cursor-click = pointer
|
||||||
cursor-scroll = ns-resize
|
cursor-scroll = ns-resize
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
export BROWSER="/usr/bin/firefox"
|
#export BROWSER="/usr/bin/firefox"
|
||||||
export EDITOR="nvim"
|
export EDITOR="nvim"
|
||||||
export TERMINAL="rxvt-unicode"
|
export TERM="xterm"
|
||||||
|
|
||||||
export XDG_CONFIG_HOME="$HOME/.config"
|
export XDG_CONFIG_HOME="$HOME/.config"
|
||||||
export XDG_CACHE_HOME="$HOME/.cache"
|
export XDG_CACHE_HOME="$HOME/.cache"
|
||||||
|
|||||||
@@ -56,9 +56,6 @@ PATH=/games:/usr/local/sbin:/usr/local/bin:/usr/bin
|
|||||||
HISTSIZE=1000
|
HISTSIZE=1000
|
||||||
HISTTIMEFORMAT="%F %T "
|
HISTTIMEFORMAT="%F %T "
|
||||||
|
|
||||||
# Term config
|
|
||||||
TERM=xterm
|
|
||||||
|
|
||||||
neofetch
|
neofetch
|
||||||
|
|
||||||
if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
|
if [ -z "$DISPLAY" ] && [ "$XDG_VTNR" = 1 ]; then
|
||||||
|
|||||||
4
scripts/imap_creds.example
Normal file
4
scripts/imap_creds.example
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
_USER="user@example.com"
|
||||||
|
_PASSWD="mypassword"
|
||||||
|
_SERVER="example.com"
|
||||||
|
_FOLDER="INBOX"
|
||||||
35
scripts/mailbox.sh
Executable file
35
scripts/mailbox.sh
Executable file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd -- "$(dirname -- "$0")"
|
||||||
|
_DIRNAME="$(pwd)"
|
||||||
|
|
||||||
|
source ./imap_creds
|
||||||
|
|
||||||
|
if [[ -n $1 ]] && [[ $1 == "count" ]]
|
||||||
|
then
|
||||||
|
_COUNT=$(curl -u "$_USER:$_PASSWD" "imaps://$_SERVER" -X "STATUS $_FOLDER (UNSEEN)" 2>/dev/null | \
|
||||||
|
sed -e 's/)\r//' -e 's/.*UNSEEN //')
|
||||||
|
printf "%s" "$_COUNT"
|
||||||
|
(( _COUNT == 0 )) && exit 0
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -n $1 ]] && [[ $1 == "fetch" ]]
|
||||||
|
then
|
||||||
|
_UNSEEN="$(curl -u 'beastie:}q6658JD~{}{oiRWsb~Q{P@SV=Qsy,ae' "imaps://$_SERVER/$_FOLDER" -X "SEARCH UNSEEN" 2>/dev/null | \
|
||||||
|
sed -e "s/\\r//" -e "s/* SEARCH //" -e "s/ /,/g")"
|
||||||
|
_MAILS=$(curl -v -u "$_USER:$_PASSWD" "imaps://$_SERVER/$_FOLDER" -X "FETCH $_UNSEEN BODY.PEEK[HEADER.FIELDS (From Subject)]" 2>&1 | \
|
||||||
|
grep -E "From:|Subject:" | sed -e 's/< //' -e 's/Subject/\nSubject/')
|
||||||
|
dunstify -I ../icons/gmail.svg \
|
||||||
|
"" "$_MAILS"
|
||||||
|
printf "%s" "$_MAILS"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
cat <<EOF
|
||||||
|
Usage:
|
||||||
|
mailbox.sh count => Count unseen mails in $_FOLDER
|
||||||
|
mailbox.sh fetch => Fetch "From:" and "Subject:" from unseen mails in $_FOLDER
|
||||||
|
EOF
|
||||||
Reference in New Issue
Block a user