I am using Ubuntu 18.04 LTS and when I heard about KDE plasma 5.13 I decided to try it, and be able to use both DEs. However, I found my Ubuntu dock cluttered with KDE apps like Dolphin and Okular... I want each desktop environment to have its default built-in apps but I don't want it to have the other's. How do I go about that? I don't want to hide the apps manually, I would rather have a script take care of it. Any help would be greatly appreciated!

Edit: I tried making a bash file to make KDE apps only visible in KDE after following instructions from a UNIX stackexchange post. Here is its content:

cd /usr/share/applications/kde4/ || exit
sudo for i in *.desktop; do echo "OnlyShowIn=KDE" >> "$i"; done

and ran it with the following command: $ sudo bash default_apps_restricter.sh However, I got this output:

default_apps_restricter.sh: line 3: syntax error near unexpected token `do'
default_apps_restricter.sh: line 3: `sudo for i in *.desktop; do echo "OnlyShowIn=KDE" >> "$i"; done'

Please help!

  • do I add a line saying OnlyShowIn=Gnome for gnome apps? or is it OnlyShowIn=Ubuntu and where are the default apps' .desktop files located for each of the DEs? – Oussema Jun 18 '18 at 9:15
  • Also for KDE apps do I type OnlyShowIn=KDE or Plasma or Kubuntu? – Oussema Jun 18 '18 at 9:20
  • OnlyShowIn=KDE should work but you may have to run sudo update-desktop-database after making the change. – pomsky Jun 18 '18 at 9:30

You can edit the .desktop launcher associated to each application and add OnlyShowIn or NotShowIn keys accordingly. The .desktop files can be found in /usr/share/applications/ (and some in ~/.local/share/applications/).

But it's not recommended to edit the files in /usr/share/applications/ (they'll most likely be overwritten once an associated package gets updated). Instead copy the .desktop file from /usr/share/applications/ to ~/.local/share/applications/ and edit the copied file.

To make an application visible only in GNOME add the following line


and to make an application invisible in GNOME add the following line

  • I tried to automate that but it doesn't work. Could you please take a look at my edited post? – Oussema Jun 18 '18 at 9:48
  • @Oussema Have you checked whether OnlyShowIn=KDE; got appended to the files (; is needed)? – pomsky Jun 18 '18 at 9:59
  • Ok, I sorted it out by removing sudo from the bash file but it turns out only three apps are in /kde4 and I have to go through the rest manually. Thank you for your help I will just go one by one. – Oussema Jun 18 '18 at 10:01

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.