GSettings – How to Add Icon to Launcher by Command [Duplicate]

gsettingsunity

Although there are several posts on the Internet on the subject, I did not find a solution yet:
my goal is to find a command that adds an icon (.desktop file) to the Unity launcher and shows it immediately. when I open dconf-editor (desktop > unity > launcher) and I add an item to the favorites list, it shows at once in the launcher, so my idea is that it must be possible to do the same thing by command. The solutions I found so far on the Internet do not do the job.

I need to do it by command, to use in a quicklist editor I am working on.

You would make someone unbelievably happy if you could help out

Best Answer

You can act on dconf also with gsettings tool.

gsettings set com.canonical.Unity.Launcher favorites "$(gsettings get com.canonical.Unity.Launcher favorites | sed "s/, *'yourapp' *//g" | sed "s/'yourapp' *, *//g" | sed -e "s/]$/, 'yourapp']/")"