Minimized panel icon flashes but will not restore (qpdfview only?)

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
murphycc
Level 1
Level 1
Posts: 9
Joined: Mon Dec 09, 2013 10:53 am

Minimized panel icon flashes but will not restore (qpdfview only?)

Post by murphycc »

Hi everyone,

This problem has been bugging me for the past few months.

What I'm using:
- Mint 20.3
- Cinnamon 5.2.7

Problem:
If my PDF viewer (in this case qpdfview) has one or more documents open but is minimized to the Cinnamon panel, opening a new PDF document from either a web browser or Nemo does not restore qpdfview but instead simply makes its panel icon flash red. See screenshot. I think this behavior changed in the last 3-6 months or so, because before that it would restore qpdfview and show me the new PDF document. Now I have to click on the qpdfview icon and it will show me the new PDF.

Cinnamon_panel_restoreissue.png
Cinnamon_panel_restoreissue.png (10.8 KiB) Viewed 370 times

I have tried:
- restoring Cinnamon through the panel 'troubleshoot' option
- deleting my PDF mime types and choosing different default PDF program (I think it happens with others and is not qpdfview specific)
- using the panel applet 'Grouped Window List' but tried 'Window List' as well with same result
- looking through Cinnamon settings to affect this behavior (flashing/visual notification) with no luck

I wonder if it's related to qpdfview using tabs instead of new window for each document? I think tabs are always used in qpdfview though. I don't think it happens with other programs or mime types like LibreOffice Writer if I open additional document files from web or Nemo links.

Has anyone else seen this, or do you have any ideas on it? I'm nearly certain some update in last 3-6 months affected this.

Thanks,
Chris
Last edited by LockBot on Tue Jul 11, 2023 10:00 pm, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
murphycc
Level 1
Level 1
Posts: 9
Joined: Mon Dec 09, 2013 10:53 am

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by murphycc »

I should have asked right away:

Could somebody else (using Cinnamon) please try this with qpdfview to check if you see same behavior?

Steps: open a PDF with qpdfview, minimize it to panel, then see if opening another PDF file via Nemo file browser or web browser restores the qpdfview window or if it just flashes. If you don't have qpdfview set to be your default document viewer, you will need to chose 'open with...' for the second file.

Thanks,
Chris
mikeflan
Level 17
Level 17
Posts: 7084
Joined: Sun Apr 26, 2020 9:28 am
Location: Houston, TX

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by mikeflan »

Would you be willing to try Okular instead?
Install Okular and go to: Settings->Configure Okular->General->Program Features->Open new files in tabs.
Taken from this fairly old post, so it may not work:
https://askubuntu.com/questions/1251841 ... -from-with
murphycc
Level 1
Level 1
Posts: 9
Joined: Mon Dec 09, 2013 10:53 am

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by murphycc »

Thanks for the ideas, Mike. I have known about Okular but really wanted to avoid installing a KDE program with all of its gobs of dependencies. That being said, I did install Okular right now just for debug purposes. It does work properly, in that documents can open in its tabs when minimized and the window will restore. But I'll probably uninstall Okular and its dependencies anyhow.

I had actually been using SumatraPDF through Wine for quite a while too (which works very well) and I tried that today for this issue but it also shows the odd behavior with not restoring the minimized window after file open.

Mendeley (also in the link you sent) is an interesting choice. I actually tried it but it's a bit cumbersome for only viewing PDFs, and it looks like any PDFs I open have to be 'synced' to the online site.

I tried the 'qpdfview --unique'... options too and that doesn't seem to change behavior any.

Thanks,
Chris
murphycc
Level 1
Level 1
Posts: 9
Joined: Mon Dec 09, 2013 10:53 am

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by murphycc »

I managed to create a work-around for this, which makes use of the 'xdotool' program. I forgot if I had to install xdotool myself or not.

I wrote a script that essentially looks for the qpdfview window (if it exists), and restores that window after opening the new PDF. If no qpdfview window exists, qpdfview is launched as normal. So no more flashing icon on the Cinnamon panel anymore.

Save this as, e.g. qpdf_start.sh (do a chmod +x):

Code: Select all

#!/bin/bash
# Forces qpdfview window to restore from Cinnamon panel if minimized
# Set this script as default "Open with..." program for PDF type
# Use as: qpdf_start.sh filename.pdf

# Get window id if program already running
# Limit option used, but should always be 1 window only since qpdfview in tabs mode
qpdfwin=`xdotool search --all --onlyvisible --limit 1 --name qpdfview`

# Open the file with qpdfview, each document to open in unique qpdfview tab
qpdfview --unique "$1"

# Restore the pre-existing window
if [ ! -z "$qpdfwin" ]
then
xdotool windowactivate $qpdfwin
fi
This script must become the new default application to open PDF files, which can be set most easily through the Nemo file manager by right-clicking on a PDF file, choose Open With Other Application, and browsing to this script to set for the bottom field.

It can be helpful to look in /usr/share/applications to view .desktop files to see how they are launched in case somebody needs to adapt this to another program or MIME type. There are some in ~/.local/share/applications as well.

Chris
Last edited by murphycc on Sat Jan 28, 2023 6:59 pm, edited 1 time in total.
User avatar
Koentje
Level 7
Level 7
Posts: 1571
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by Koentje »

Nice workaround! I have the exact same problem with Bluefish editor, so i'm going to try this. :D

Edit: Works like a charme! I had this problem since 19.3..
murphycc
Level 1
Level 1
Posts: 9
Joined: Mon Dec 09, 2013 10:53 am

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by murphycc »

I'm glad to know you were able to adapt it.

I made a minor edit to the script above just now by changing $1 to "$1", as a file with spaces in it ("like this one.pdf") did not open properly without the quotes. So now files with spaces should work properly.

Chris
User avatar
Koentje
Level 7
Level 7
Posts: 1571
Joined: Tue Jan 04, 2022 6:23 pm
Location: Netherlands

Re: Minimized panel icon flashes but will not restore (qpdfview only?)

Post by Koentje »

I already corrected that.. but thanks anyway! ;)
Locked

Return to “Software & Applications”