aboutsummaryrefslogtreecommitdiffstats
path: root/pinentry-rofi.py
diff options
context:
space:
mode:
Diffstat (limited to 'pinentry-rofi.py')
-rw-r--r--pinentry-rofi.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/pinentry-rofi.py b/pinentry-rofi.py
new file mode 100644
index 0000000..3ce5556
--- /dev/null
+++ b/pinentry-rofi.py
@@ -0,0 +1,30 @@
+import subprocess
+
+rofi = ['rofi', '-dmenu', '-input', '/dev/null', '-password']
+
+def assuan_send(t):
+ print(t)
+
+assuan_send("OK Please go ahead")
+
+while True:
+ line = input()
+ ok = True
+ if line.startswith("OPTION "):
+ # OPTION grab
+ # OPTION ttyname=/dev/pts/1
+ # OPTION ttytype=tmux-256color
+ # OPTION lc-messages=C
+ # OPTI
+ pass
+ elif line == "BYE":
+ break
+ else:
+ rofi.append(line.strip())
+ ok = False
+
+ if ok:
+ break
+
+password = subprocess.check_output(rofi).decode().strip()
+assuan_send(password)