3

I followed all the steps in this answer: https://askubuntu.com/a/975230/719469

However when I run xprop WM_CLASS in Terminal and click on my application's window, it gives me: WM_CLASS: not found. What should I do to get a single icon of the app on the Ubuntu Dock?

duplicate icons on Recoll on Launcher

The application I am talking about is Recoll, installed using apt-get install recoll. I am using Ubuntu 18.04 (Xorg).

The contents of .desktop file in /usr/share/applications:

[Desktop Entry]
Categories=Utility;Filesystem;Database;
Comment=Find documents by specifying search terms
Exec=recoll
GenericName=Local Text Search
Icon=recoll
Name=Recoll
Terminal=false
Type=Application
Keywords=Search;Full Text;

Edit:

I tried changing the .desktop file lines by making these changes

Exec=recoll --class CustomClassName

and then adding the line

StartupWMClass=CustomClassName

After doing this, the app fails to launch from its icon and I still get WM_CLASS: not found. in the terminal

Kewal Shah
  • 1,044
  • 2
  • 13
  • 35
  • There's a way to forcefully assign WM_CLASS when it's not found, but I'm not sure how to adapt that to fix your issue. – pomsky Nov 07 '18 at 16:55
  • @pomsky thanks for sharing the link, the first edit sets a name for a particular window,

    xprop -f WM_CLASS 8s -set WM_CLASS "RecollSearch"

    gives

    WM_CLASS(STRING) = "RecollSearch". Edit2 in the answer

    xprop -name "RecollSearch" -f WM_CLASS 8s -set WM_CLASS "CustomName"

    gives

    xprop: error: No window with name RecollSearch exists!. Thus, on testing on a new window xprop gives WM_CLASS not found

    – Kewal Shah Nov 07 '18 at 17:36
  • @pomsky I found a similar question with an accepted answer on other networks. But the problem is, as I do not understand scripting, I cannot apply these possibly working solutions to my problem! – Kewal Shah Nov 07 '18 at 17:49
  • Might be related to this bug: https://bugs.chromium.org/p/chromium/issues/detail?id=118613 – pomsky Dec 03 '18 at 08:42
  • Hope someones provides an answer below for Recoll as it is officially in Ubuntu's Repos and still suffers from this problem – Kewal Shah Dec 04 '18 at 06:33

1 Answers1

2

For a similar situation I have to do the following:

  1. Determine the class as in the new answer in related question

    Briefly:

    • open the app
    • AltF2, write lgEnter, go to Windows menu (up-right).
    • find the app in the list and take note of its wmclass
    • close lg ESC and app
  2. Add class to .desktop file

    StartupWMClass=classSeenInPreviousStep
    

    Normally in: /usr/share/applications or .local/share/applications

  3. keep icon in favorites (add to menu)

    • open app, right button in icon, 'Add to favorites'. If this fails, check that in .desktop Terminal=false

    • or: open dconf-editor, search favorite-apps, add .desktop file to list

    • or: Paste this to create a script for that purpose

      cat >addToMenu.sh <<'EOL'
      #!/usr/bin/env bash
      STATE=`gsettings get org.gnome.shell favorite-apps`
      STATE=$(sed 's/]/,'\ \'YOURAPP.desktop\'']/g' <<< $STATE)
      gsettings set org.gnome.shell favorite-apps "${STATE}"
      EOL
      

      Run it:

      sudo apt install gnome-shell-extensions bash addToMenu.sh

if this fails: Look in the .desktop file for a line with OnlyShowIn=..., and remove the line

Ferroao
  • 850