aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2023-08-11 11:16:17 +0200
committerMatěj Cepl <mcepl@cepl.eu>2023-08-11 11:59:21 +0200
commit16bdf649318e52985d87c2a7f897a5f6eb6871f5 (patch)
tree418f3e5935b154046574da378597b999c314f021
parent89b8811738c4b1507fdb56fdc5fc91457e7ea195 (diff)
downloadpinentry-rofi-16bdf649318e52985d87c2a7f897a5f6eb6871f5.tar.gz
feat: make pinentry work both with and without GUI.
-rwxr-xr-xpinentry-rofi.sh10
1 files changed, 7 insertions, 3 deletions
diff --git a/pinentry-rofi.sh b/pinentry-rofi.sh
index 5b4d179..386054f 100755
--- a/pinentry-rofi.sh
+++ b/pinentry-rofi.sh
@@ -92,8 +92,6 @@ basturlencode () {
rofi_cmd="rofi -dmenu -input /dev/null -password"
INSIDE_BATS=${INSIDE_BATS:-0}
-assuan_send "OK Please go ahead"
-
win_title="Prompt for password"
win_prompt="Password"
win_mesg=""
@@ -103,6 +101,8 @@ keyinfo=""
main () {
local temp_str
+ assuan_send "OK Please go ahead"
+
while : ; do
read -r line
log_debug "line=$line"
@@ -231,6 +231,10 @@ main () {
if [ "$0" = "$BASH_SOURCE" ]; then
- main
+ if [ "$XDG_SESSION_TYPE" != "tty" ] ; then
+ main
+ else
+ exec pinentry-tty "$@"
+ fi
fi