Page MenuHome GnuPG

pinentry: Possibly add pinentry-gtk with GTK 4, and Drop pinentry-gtk-2
Open, WishlistPublic

Description

GTK+-2 is obsolete now.

It would be good if we have pinentry with GTK4. But some features cannot be supported: grabbing input, asking window manager to center its window or to be placed on top of all windows. That's because GTK4 is a kind of pure toolkit not supporting backend control (of X11, Wayland, Windows, Mac, etc.).

Still, it is possible to provide a simple password entry window with GTK4, and there could be a way to enable fullscreen mode for that.

Event Timeline

gniibe triaged this task as Wishlist priority.Dec 28 2023, 6:13 AM
gniibe created this task.

Still, it is possible to provide a simple password entry window with GTK4, and there could be a way to enable fullscreen mode for that.

pinentry-gnome on fullscreen looks like this:

It's acceptable — it works. I just miss the "show password" toggle.
I'm running Sway WM (wlroots Wayland compositor).

You can even click anywhere on the black portions of the screen. Focus is lost when you do, but is easily regained by clicking on the pinentry dialog.

~There's only one problem: if you open dmenu (or wmenu in my case), you get a hidden menu stealing focus from the pinentry dialog — you can't even click the pinentry dialog to focus on it. Pressing ESC will close the menu and then pinentry gets focus again. Of course, a user should avoid opening the menu while a fullscreen window is visible; but if this happens accidentally, it can be confusing and frustrating. I'll check if the menu program has some kind of option to adjust this behavior.~

EDIT: Nevermind, this was fixed a few months ago by making wmenu an overlay window, but they haven't released a new stable version since then.

Do you think it's too difficult for a beginner to write a pinentry-gtk4? The source code doesn't look too long. I'd like to try, but I'm a total beginner on GTK.

The Qt dialog on fullscreen is interesting and it gives me an idea. Maybe if we center its contents? (on GTK, of course)

Do you think it's too difficult for a beginner to write a pinentry-gtk4?

FYI, my attempt is here (I use it daily for my desktop): https://dev.gnupg.org/source/pinentry/history/gniibe%252Fgtk4/
I don't think it's ready to merge.

The UI is manually written, so, it's harder to change its look&feel and it doesn't yet to support automatic passphrase generation.

Perhaps, it's better to use GtkBuilder for UI instead.
I was considering some tool to design UI:

FWIW, the original idea with Pinentry was to have a stripped down Widget which allows to securely enter the password. For that we even replaced the Gtk text widget to have better control over the code path from keyboard to screen. After a few years more more more stuff was requested and meanwhile the QT version of the Pinentry is probably larger than the gpg-agent process.

If you want to write a new thing please also consider the rendering hints gpg-agent can send to the pinentry. This is enabled if the Pineentry sends back a FEATURES sstatus tring with the keyword "tabbing".

/* The Pinentry support RS+US tabbing.  This means that a RS (0x1e)
 * starts a new tabbing block in which a US (0x1f) followed by a
 * colon marks a colon.  A pinentry can use this to pretty print
 * name value pairs.  */