diff options
author | NeodarZ <neodarz@neodarz.ovh> | 2016-09-21 20:01:28 +0200 |
---|---|---|
committer | NeodarZ <neodarz@neodarz.ovh> | 2016-09-21 20:01:28 +0200 |
commit | 78db7d43845d3ea276b8028bec6d67b5a5641a1b (patch) | |
tree | 27a58084c5eac2dc9b084e9f57fd6bc762afc480 /.i3-blocks/blocks/mail | |
parent | 0cde152bf8483e894eb64c41529c5d8c6349327b (diff) | |
download | dotfiles-78db7d43845d3ea276b8028bec6d67b5a5641a1b.tar.xz dotfiles-78db7d43845d3ea276b8028bec6d67b5a5641a1b.zip |
Ajout de la conf de vim + mise à jour de la structure
Diffstat (limited to '.i3-blocks/blocks/mail')
-rwxr-xr-x | .i3-blocks/blocks/mail | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/.i3-blocks/blocks/mail b/.i3-blocks/blocks/mail deleted file mode 100755 index 66b1d0a..0000000 --- a/.i3-blocks/blocks/mail +++ /dev/null @@ -1,59 +0,0 @@ -#!/bin/bash - -# Requires https://www.google.com/settings/security/lesssecureapps for gmail. - -CONFIG_FILE="${BLOCK_INSTANCE}" -CONFIG_FILE=${CONFIG_FILE/\~/$HOME} - -# Config file needs the following settings: -#MAIL_SERVER="imap.domain.tld:993" -#MAIL_USER="user@domain.tld" -#MAIL_PASSWORD="secret" -#MAIL_FOLDER="INBOX" - -if [[ ! -f "${CONFIG_FILE}" ]]; then - echo "${CONFIG_FILE}" - exit 33 -fi - -source "${CONFIG_FILE}" - -MAIN_DOMAIN=$(expr match "${MAIL_SERVER}" '.*\.\(.*\..*\)' | awk -F ':' '{print $1}') - -# Add https so xdg knows that it's a website -if [[ "${MAIN_DOMAIN}" != http* ]]; then - MAIN_DOMAIN="https://${MAIN_DOMAIN}" -fi - -# Left click -if [[ "${BLOCK_BUTTON}" -eq 1 ]]; then - xdg-open "${MAIN_DOMAIN}" -fi - -MAIL_FILE="/tmp/.mail" -URGENT_VALUE="100" - -GET_UNREAD=$(cat<<EOF -? LOGIN "${MAIL_USER}" "${MAIL_PASSWORD}" -? STATUS "${MAIL_FOLDER}" (unseen) -? LOGOUT -EOF -) - -echo "${GET_UNREAD}" | openssl s_client -connect "${MAIL_SERVER}" -crlf -ign_eof > "${MAIL_FILE}" 2>/dev/null -UNREAD_COUNT=$(cat "${MAIL_FILE}" | grep -i "UNSEEN" | grep -oE "[0-9]*" | head -n 1) - -# For security reasons -rm "${MAIL_FILE}" - -if [[ "${UNREAD_COUNT}" = "" ]]; then - exit -fi - -echo "${UNREAD_COUNT}" -echo "${UNREAD_COUNT}" -echo "" - -if [[ "${UNREAD_COUNT}" -ge URGENT_VALUE ]]; then - exit 33 -fi
\ No newline at end of file |