17

I am aware that you can right-click on an application and choose "Add to Favorites". I am trying to add it to the favorites section without using the GUI at all. Everything needs to be done in the terminal or a script.

Anyone have any ideas?

This is not a duplicate of this question. That is for SETTING the favorites, not ADDING to the favorites. When you right click on an application and choose "Add to Favorites", that must run a script somewhere that takes an input of the application name. What I'm asking is, where is that script or how can I replicate it?

0

2 Answers 2

19

Unfortunately, as an end-user you can only "read" and "write" (also reset) the array that dictates the list of favourite apps by using dconf/gsettings. For example, as mentioned here, you can get the value by running

gsettings get org.gnome.shell favorite-apps

and write a new value by a suitable gsettings set command. There is no straightforward way to append to the array, you can only overwrite.

But you can combine these two and have a custom command. You need to know the name of the .desktop launcher associated to the application you want to add to the favourites first. Let's say it is appname.desktop. Then you can run the following to add the application associated to appname.desktop to the favourites:

gsettings set org.gnome.shell favorite-apps "$(gsettings get org.gnome.shell favorite-apps | sed s/.$//), 'appname.desktop']"
2
  • Life saver, thank you! I'm not as familiar with all the available commands within Ubuntu as I'd like to be, and this is incredibly helpful. Commented Dec 4, 2019 at 7:39
  • To overwrite rather than append: gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop', 'firefox-esr.desktop']" Commented Apr 5 at 16:21
6

The path for dconf is: /org/gnome/shell/favorite-apps. For example

dconf read /org/gnome/shell/favorite-apps

Which for me produces

['org.gnome.Nautilus.desktop', 'firefox.desktop', 'vivaldi-stable.desktop', 'steam.desktop']

So in theory you could use dconf write to adjust these values

3
  • Welcome! If you can, complete the answer with an example of configuration, that way you will get upvoted and accepted Commented Dec 3, 2019 at 15:38
  • That is setting the favorite apps, not adding to them. Commented Dec 3, 2019 at 15:50
  • 1
    my ubuntu 20.04 doesn't have /org... Commented Nov 30, 2021 at 0:43

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .