Improve waybar and custom scripts

This commit is contained in:
2025-10-13 20:23:43 +02:00
parent e1d128f28a
commit 18cc8751c9
14 changed files with 183 additions and 104 deletions

View 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"