Improve waybar and custom scripts
This commit is contained in:
26
modules/optionnals/desktop/config/etc/xdg/scripts/waybar-mailbox.sh
Executable file
26
modules/optionnals/desktop/config/etc/xdg/scripts/waybar-mailbox.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
_USER=beastie
|
||||
_PASSWD='}q6658JD~{}{oiRWsb~Q{P@SV=Qsy,ae'
|
||||
_SERVER=unixyourbrain.org
|
||||
_FOLDER=Admin
|
||||
|
||||
set -e
|
||||
|
||||
cd -- "$(dirname -- "$0")"
|
||||
_DIRNAME="$(pwd)"
|
||||
|
||||
### Sourcer à partir des secrets
|
||||
#source ~/.config/polybar/imap_creds
|
||||
|
||||
|
||||
_COUNT=$(curl -u "$_USER:$_PASSWD" "imaps://$_SERVER" -X "STATUS $_FOLDER (UNSEEN)" 2>/dev/null | \
|
||||
sed -e 's/)\r//' -e 's/.*UNSEEN //')
|
||||
|
||||
_UNSEEN=$(curl -u "$_USER:$_PASSWD" "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 | \
|
||||
sed -e "s|\\r||" | awk '/< Subject|< From/ {sub(/^< /, ""); printf "%s\\n", $0}')
|
||||
|
||||
printf '{"text": "%s ", "tooltip": "%s"}' "$_COUNT" "$_MAILS"
|
||||
Reference in New Issue
Block a user