dotfiles

Alpine Linux dotfiles

git clone git://git.lin.moe/dotfiles.git

 1#!/bin/sh
 2# from https://codeberg.org/achill/pinentry-rofi
 3# ported from pinentry-dmenu
 4# ported from https://codeberg.org/sewn/home/raw/branch/master/bin/pinentry-wmenu
 5
 6echo 'OK Pleased to meet you'
 7
 8while read stdin; do
 9	echo $stdin >> /tmp/pinenetry
10	case $stdin in
11		*BYE*) exit ;;
12		*SETDESC*) export desc="${stdin/SETDESC/}"; ;;
13		*GETPIN*) printf 'D %s\n' $(rofi -dmenu -password -p "${error:+$error }$prompt " -mesg "${desc//%0A/\&\#x0a;}") ;;
14		*SETERROR*) error="${stdin#*\ }"; ;;
15		*SETPROMPT*) prompt="${stdin#*\ }"; ;;
16		*CONFIRM*)
17			if rofi -dmenu -p "$prompt" -mesg "$desc" -e "Press Enter to Confirm or Esc to Cancel" > /dev/null; then
18				:
19			else
20				# User canceled
21				echo "ERR 83886179 Operation cancelled <Pinentry>"
22				continue
23			fi
24			;;
25	esac
26
27	echo OK
28done
29