13

After upgrading to Ubuntu 17.10, multiple instances of okular will no longer group under a single icon in the desktop dock.

I am running 17.10 under X.org, and if it matters: I am viewing PDF files with okular. All other applications I have tested work correctly. For example, multiple instances of gnome-terminal and emacs will group under a single item in the desktop dock. There was no problem with grouping for okular in 17.04.

Why is it important to have them grouped? It enables one to use a keyboard shortcut to switch between applications of the same type (Alt+|). It also makes it easier to switch between different applications (Alt+Tab) since there are fewer instances to cycle through.

How can I get okular instances to group correctly in 17.10?

David
  • 383
Håkon Hægland
  • 3,973
  • 12
  • 46
  • 80
  • I had the same issue with okular, you running the snap app version ? – wblm Jan 14 '18 at 10:47
  • 2
    @pomsky Great! I think it works. There are many desktop files for okular in /usr/share/applications. I chose the one called : okularApplication_pdf.desktop and added the line : StartupWMClass=okular to the end of that file. – Håkon Hægland Jan 14 '18 at 10:48
  • One small trivia, the combination you mentioned as alt+| is written as "alt+key-above-tab" in documentations. The reason is there is no global standard for that key, in many keyboards it's the backtick (`) key. – pomsky Jan 14 '18 at 13:52

1 Answers1

16
  1. Copy the okularApplication_pdf.desktop file from /usr/share/applications to ~/.local/share/applications. For that you may run

    cp /usr/share/applications/okularApplication_pdf.desktop ~/.local/share/applications/
    
  2. Open the copied file with a text editor. For example by running

    gedit ~/.local/share/applications/okularApplication_pdf.desktop
    
  3. Add (or modify) the following line to the file

    StartupWMClass=okular
    
  4. Save the file.

Adapted from this answer.

Edit:

If you have installed okular as a snap, you will find the desktop file at /var/lib/snapd/desktop/applications/okular_org.kde.okular.desktop

In this case the following could become your step 1:

cp /var/lib/snapd/desktop/applications/okular_org.kde.okular.desktop ~/.local/share/applications/

Then follow steps 2 to 4 as mentioned in the previous method.

Kewal Shah
  • 1,044
  • 2
  • 13
  • 35
pomsky
  • 68,507