qpdfview not auto-focusing when openning a document

Asked by Tohiko Looka on 2020-08-17

On Ubuntu 18.04 (not sure about other systems), if I have an instance of qpdfview already open and then I try to open a new pdf in the same window with `--unique` the qpdfview window is not brought to front nor focused.

On the other hand, if I open the pdf with `--unique`, a new qpdfview instance is created, focused and brought to front.

Is there a way to have the pdf instance (old or new) be always focused and brought to front?
Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
qpdfview Edit question
Assignee:
No assignee Edit question
Last query:
2020-08-17
Last reply:
2020-08-18
Adam Reichold (adamreichold) said : #1

Hello Tohiko,

I guess this is not what you want to hear but I think this depends on the window manager, i.e. in your case it will bring a newly started application to the foreground but it will not honor the request of an already running application which is a common default to avoid programs pushing themselves into the foreground in an irritating manner. I am not sure which desktop environment your are running exactly, but GNOME Tweak Tool or dropping down to using dconf-editor and looking for settings related to Mutter might yield something useful.

Best regards,
Adam

Tohiko Looka (tohiko) said : #2

Yes, I am using GNOME 3. I will dig in the settings.

I wasn't sure if qpdfview is making that request, since other applications like emacsclient (which should bring an emacs instance to the front) do not suffer from the same issue.

This might also be related to another issue that I am having where running emacsclient from the terminal brings it to the front while running it from qpdfview (as a source editor) does not. I am wondering these "requests" that qpdfview is making to the WM are not compatible with GNOME 3.

Adam Reichold (adamreichold) said : #3

Hello again,

qpdfview uses Qt's raise [1] and activateWindow [2] methods to request being put into the foreground. It could be that emacsclient is doing that via Gtk which is properly supported. Maybe trying another Qt application like VLC gives more insight?

Best regards,
Adam

[1] https://doc.qt.io/qt-5/qwidget.html#raise

[2] https://doc.qt.io/qt-5/qwidget.html#activateWindow

Can you help with this problem?

Provide an answer of your own, or ask Tohiko Looka for more information if necessary.

To post a message you must log in.