From 5b9ff2c334a3a85c25b11bc17009f211eec51575 Mon Sep 17 00:00:00 2001 From: Philip Wittamore Date: Tue, 3 Jun 2025 20:12:49 +0200 Subject: update --- pw-biff | 25 +++++++++++++++++++++++++ pw-update-fingerprint | 16 ++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100755 pw-biff create mode 100755 pw-update-fingerprint diff --git a/pw-biff b/pw-biff new file mode 100755 index 0000000..40265e4 --- /dev/null +++ b/pw-biff @@ -0,0 +1,25 @@ +#!/usr/bin/env bash + +# run from cron + +if [ -z $1 ]; then + exit +fi + +export DISPLAY=:0.0 +export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus + +maildir="$HOME/.mail/$1/Inbox/new/" + +mailcount=$(find $maildir -type f | wc -l) + +if (("$mailcount" > 0)); then + + /usr/local/bin/dunstify \ + -t 5000 \ + -a "You have mail" \ + -u normal \ + -i internet-mail-symbolic \ + -h string:x-dunst-stack-tag:Mail "$1 has mail: $mailcount messages" + +fi diff --git a/pw-update-fingerprint b/pw-update-fingerprint new file mode 100755 index 0000000..e25a0b4 --- /dev/null +++ b/pw-update-fingerprint @@ -0,0 +1,16 @@ +#!/bin/bash + +# update tls_fingerprint entry in ~/.msmtprc + +MAILSERVER="mail.server.com" +PORT="587" + +cd $HOME + +# get the server fingerprint +KEY=$(msmtp --serverinfo --tls --tls-certcheck=off --host="$MAILSERVER" --port="$PORT" | grep -E -o "([0-9A-Za-z]{2}:){31}[0-9A-Za-z]{2}") + +# replace tls_fingerprint line in .msmtprc +sed -i "s/^tls_fingerprint.*/tls_fingerprint $KEY/g" .msmtprc + +echo ".msmtprc has been updated with the latest $MAILSERVER fingerprint." -- cgit v1.2.3