Skip to content

Instantly share code, notes, and snippets.

@nanpuyue
Created March 9, 2019 14:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanpuyue/ddbb14c47a035e2271ef436416a2773c to your computer and use it in GitHub Desktop.
Save nanpuyue/ddbb14c47a035e2271ef436416a2773c to your computer and use it in GitHub Desktop.
a notifier for yubikey-touch-detector
#!/bin/bash
# file: yubikey-touch-notify
# date: 2019-03-09
# license: GPLv3 https://www.gnu.org/licenses/gpl-3.0.txt
# author: nanpuyue <nanpuyue@gmail.com> https://blog.nanpuyue.com
# refer: https://github.com/maximbaz/yubikey-touch-detector
SOCKET="$XDG_RUNTIME_DIR/yubikey-touch-detector.socket"
NOTIFY_ICON="dialog-information"
while read -n5 event; do
case "$event" in
GPG_1|U2F_1)
notify-send -i "$NOTIFY_ICON" "Please touch the YubiKey (${event%_*})."
;;
GPG_0|U2F_0)
# TODO
:
;;
esac
done < <(socat unix-connect:"$SOCKET" stdout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment