Closed ayushnix closed 2 years ago
It should work and does for me.
They aren't being used on my laptop
$ env | rg -i bemenu
BEMENU_OPTS=-i -l 10 -w --scrollbar=autohide -n --fn 'PT Mono 16'
$ cat .gnupg/gpg-agent.conf
pinentry-program /usr/bin/pinentry-bemenu
The BEMENU_OPTS
environment variable is used when I use bemenu
for other purposes but not when used as pinentry-bemenu.
Any ideas what could be wrong on my setup? Anything else I should set or check?
This is the environment of your usersession.
gpg-agent is likely started from your systemd user instance which uses a different environment.
Try to to systemctl --user edit gpg-agent
and add
[Service]
Environment=BEMENU_OPTS=...
Afterwards:
systemctl --user daemon-reload
systemctl --user restart gpg-agent
I created a file .config/environment.d/10-bemenu.conf
with the BEMENU_OPTS
value and restarted gpg-agent and reloaded the user session daemon.
$ systemctl --user show-environment | rg -i bemenu
BEMENU_OPTS=$'--ignorecase --list 10 --wrap --scrollbar=autohide --no-overlap --fn "PT Mono 16"
Just to be sure, I also added BEMENU_OPTS
to the gpg-agent.service
file as well and restarted everything but still no success.
Why is there a dollar and a lone single quote?
To see if the process actually got the env variable you can look at /proc/$PID/environ
Why is there a dollar and a lone single quote?
There was an ending single quote which I forgot to add but yeah, I'm not sure why the BEMENU_OPTS
environment variable is exported like this. Here's how the relevant file looks like
$ cat .config/environment.d/13-bemenu.conf
BEMENU_OPTS='--ignorecase --list 10 --wrap --scrollbar=autohide --no-overlap --fn "PT Mono 16"'
To see if the process actually got the env variable you can look at /proc/$PID/environ
It seems so. Here's a somewhat redacted output.
$ ps -ef | rg -i gpg-agent
user 2446 954 0 14:35 ? 00:00:00 /usr/bin/gpg-agent --supervised
$ cat /proc/2446/environ
HOME=/home/userLANG=en_US.UTF-8LANGUAGE=en_US:enSYSTEMD_EXEC_PID=2446USER=userXDG_RUNTIME_DIR=/run/user/1000BEMENU_OPTS=--ignorecase --list 10 --wrap --scrollbar=autohide --no-overlap --fn "PT Mono 16"DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/busI3SOCK=/run/user/1000/sway-ipc.1000.968.sockSWAYSOCK=/run/user/1000/sway-ipc.1000.968.sockWAYLAND_DISPLAY=wayland-1.....
I really wish that bemenu used a config file instead of environment variables.
The problem is that --ignorecase
is not implemented.
For compatibility with the original pinentry tool unknown cli options do not prevent the tool from running.
On the other hand the first unknown option stops the option parsing.
I'll think about a way of handling this better.
The problem is that
--ignorecase
is not implemented.
You mean in pinenetry-bemenu
?
I removed that option from the env var and restarted services but pinentry-bemenu still doesn't pick up the the BEMENU_OPTS
env var.
Yes, wrap
etc are also not suppored.
If you execute pinentry-bemenu standalone with the env variable it should give you output about the unsupported options.
Hmm, got it. I was able to get pinentry-bemenu
to use the BEMENU_OPTS
env var after removing --ignorecase --list 10 --wrap --scrollbar=autohide
.
Perhaps the README.md file should contain the list of flags supported by pinentry-bemenu and point out that other flags aren't supported?
--ignorecase
, --list
and --wrap
are now supported.
Isn't the output from --help
enough?
--ignorecase
,--list
and--wrap
are now supported.
Thanks.
Isn't the output from
--help
enough?
It might be but I didn't have any reason to believe that those options would be unsupported until I faced this issue. Maybe I'm at fault here but I didn't think of checking --help
until now.
Also, I'm not sure if this a limitation with bemenu itself but all the contents of the prompt are printed on a single line with a few ↵ symbols in between. Is this intended? Can the password prompt be segregated into multiple lines? Let me know if I should open another issue for this.
I'll try to figure out a way of reporting issues better.
As for the lines: This is fixed in a later version of pinentry-bemenu.
Thanks.
You're welcome!
When using pinentry-bemenu v0.7.1, the environment variables for bemenu set using
BEMENU_OPTS
are not used. Is this expected?