In the PDF workflow post, I said I was test driving Master PDF Editor. My complaints there were about scrolling and page views. This one is about the window itself, and it’s a bigger problem for anyone who opens files all day.

What broke

I run Debian Trixie with GNOME on Wayland, and I installed Master PDF Editor as a Flatpak. If Master PDF is already open and I open a second PDF from the file manager, the file loads. The Master PDF window doesn’t come to the front. It stays behind whatever I was working in, and I have to Alt+Tab or click the taskbar to find it.

Other apps behave. Evince, LibreOffice, and Firefox all come forward when I open a file into them. So this isn’t a general Wayland problem on my desktop. It’s Master PDF.

The failure is quiet. Nothing errors. The document is there, but you can’t see it unless you go looking. That’s a bad failure mode for a lawyer. You think the file didn’t open, so you open it again, and now you have two copies of the same document in two windows and no clear idea which one you edited.

What I checked first

Master PDF has had a Flatpak bug before. Files opened in new windows instead of the existing one. That was fixed in the Flatpak wrapper script with a quoting correction. It’s a different bug. The old one was about how arguments get passed to the app. This one is about focus.

When I looked, I found no bug report about focus on Wayland.

What I think is going on

This part is a theory. I’m not a developer, and I haven’t confirmed it with the app’s developers.

Wayland doesn’t let an app grab focus whenever it likes. An app has to present an activation token, a short-lived credential tied to a user action. When I double-click a PDF in the file manager, the compositor (the part of GNOME that manages windows) creates a token. The file manager passes that token through the XDG portal to the app, and the app is supposed to use it to ask for focus.

My guess is that Master PDF gets the file and loads it, but doesn’t use the token to bring its window forward. On X11, apps could raise themselves without asking. On Wayland, no token means no raise, and there’s no error message. The window just stays where it was.

Other Qt apps have hit the same kind of problem. KDE developers worked through similar issues with Kate and Konsole and fixed them by passing the token through to the window-raise call. Since other Flatpak apps focus correctly on my machine, I think the gap is in Master PDF rather than in Flatpak or GNOME. I can’t prove that from the outside.

The workaround

Alt+Tab or the taskbar. It’s not elegant, but it works. Two commands help you check the setup before you file a report:

# Show the installed Master PDF Editor version and runtime
flatpak info net.code_industry.MasterPDFEditor

# Show which app your system opens PDFs with by default
xdg-mime query default application/pdf

Neither command fixes anything. The first gives you the version to put in a bug report. The second tells you whether your file manager is sending PDFs to Master PDF at all. If the default points somewhere else, you’re debugging the wrong thing.

Update

Finally, there seems to be some movement with PDF editors that aren’t trying to mimic Acrobat and I’m moving away from Master PDF.