Skip to content
Jamie Lentin edited this page Jun 12, 2022 · 1 revision

The following script can be run as part of your X session to display any touch alerts using i3-nagbar, a red pop-up at the top of the currently active screen.

#!/bin/sh
set -eu

ALERT_PID=""
close_alert() {
    [ -n "${ALERT_PID}" ] && { kill "${ALERT_PID}" || true; }
    ALERT_PID=""
}
trap close_alert EXIT INT TERM

# NB: -stdout is only an option on 1.10.0 or later
yubikey-touch-detector -no-socket -stdout | while read -r L; do
    close_alert
    if [ "$(echo "$L" | cut -c5)" = "1" ]; then
        i3-nagbar -m "${L}: Press the Yubikey button" 2>/dev/null &
        ALERT_PID="$!"
    fi
done

Integrations

Clone this wiki locally