aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/dot_config/waybar/executable_tb-unread.sh
diff options
context:
space:
mode:
authorLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:32 +0100
committerLibravatar sommerfeld <sommerfeld@sommerfeld.dev>2026-05-13 13:43:32 +0100
commit0c15212f4f2389f743b17cb6ceff50f1f9267a1b (patch)
tree9db73d86cfebc23b3032b32a1cc3be7b1e8bef38 /dot_config/waybar/executable_tb-unread.sh
parent2970b9dddc6b89705a6836fa0864fb841925ff6f (diff)
downloaddotfiles-0c15212f4f2389f743b17cb6ceff50f1f9267a1b.tar.gz
dotfiles-0c15212f4f2389f743b17cb6ceff50f1f9267a1b.tar.bz2
dotfiles-0c15212f4f2389f743b17cb6ceff50f1f9267a1b.zip
style: apply formatter drift across repo
Pre-existing whitespace/style drift caught by `just check`. Touch nothing semantic — pure formatter output (shfmt -i 2 -ci -s, ruff, prettier, taplo). Excludes dot_config/clangd/config.yaml whose manual indentation is intentionally preserved.
Diffstat (limited to 'dot_config/waybar/executable_tb-unread.sh')
-rw-r--r--dot_config/waybar/executable_tb-unread.sh22
1 files changed, 13 insertions, 9 deletions
diff --git a/dot_config/waybar/executable_tb-unread.sh b/dot_config/waybar/executable_tb-unread.sh
index 3c3e1c7..200cb70 100644
--- a/dot_config/waybar/executable_tb-unread.sh
+++ b/dot_config/waybar/executable_tb-unread.sh
@@ -13,20 +13,24 @@ PASS_PW=email/protonmail-bridge/pass
HOST=127.0.0.1
PORT=1143
-emit() { printf '%s\n' "$1"; exit 0; }
+emit() {
+ printf '%s\n' "$1"
+ exit 0
+}
# Cheap reachability probe — avoids a 30s python TLS timeout when the bridge
# is down (e.g. before it has finished unlocking on a fresh login).
-ncat -z -w 1 "$HOST" "$PORT" 2>/dev/null || \
+ncat -z -w 1 "$HOST" "$PORT" 2>/dev/null ||
emit '{"text":"󰵂","tooltip":"bridge unreachable","class":"error","alt":"error"}'
-user=$(pass show "$PASS_USER" 2>/dev/null) || \
+user=$(pass show "$PASS_USER" 2>/dev/null) ||
emit '{"text":"󰵂","tooltip":"missing pass entry: '"$PASS_USER"'","class":"error","alt":"error"}'
-pw=$(pass show "$PASS_PW" 2>/dev/null) || \
+pw=$(pass show "$PASS_PW" 2>/dev/null) ||
emit '{"text":"󰵂","tooltip":"missing pass entry: '"$PASS_PW"'","class":"error","alt":"error"}'
-n=$(PROTONMAIL_BRIDGE_USER="$user" PROTONMAIL_BRIDGE_PASS="$pw" \
- python3 - "$HOST" "$PORT" <<'PY' 2>/dev/null || true
+n=$(
+ PROTONMAIL_BRIDGE_USER="$user" PROTONMAIL_BRIDGE_PASS="$pw" \
+ python3 - "$HOST" "$PORT" <<'PY' 2>/dev/null || true
import imaplib, os, ssl, sys
host, port = sys.argv[1], int(sys.argv[2])
ctx = ssl.create_default_context()
@@ -45,7 +49,7 @@ PY
)
case "$n" in
- '') emit '{"text":"󰵂","tooltip":"IMAP query failed","class":"error","alt":"error"}' ;;
- 0) emit '{"text":"󰇮","tooltip":"Inbox: no unread","class":"empty","alt":"empty"}' ;;
- *) emit "$(printf '{"text":"󰇮 %s","tooltip":"Inbox: %s unread","class":"unread","alt":"unread"}' "$n" "$n")" ;;
+ '') emit '{"text":"󰵂","tooltip":"IMAP query failed","class":"error","alt":"error"}' ;;
+ 0) emit '{"text":"󰇮","tooltip":"Inbox: no unread","class":"empty","alt":"empty"}' ;;
+ *) emit "$(printf '{"text":"󰇮 %s","tooltip":"Inbox: %s unread","class":"unread","alt":"unread"}' "$n" "$n")" ;;
esac