I'm writing a bash script that modifies a program, then adds an icon to the unity launcher. Although I've created the .desktop file in /usr/share/applications, I can't see a way to programmatically add the shortcut to the launcher.
Asked
Active
Viewed 2,316 times
1 Answers
4
- First get the list of applications from the launcher:
$ gsettings get com.canonical.Unity.Launcher favorites
Make an array of the items.
Then have your install script add your application to the array
Then have your script add the items from the created array to this command with item comma separated:
$ gsettings set com.canonical.Unity.Launcher favorites "['app1','app2','app3','your program.desktop']"
The app# is the applications from the array that you are including in your installer script.
Replace your program with the name of the *.desktop launcher you created.
Update:
The procedure is listed above.
This is a command line that will append your application to the launcher
gsettings set com.canonical.Unity.Launcher favorites "$(gsettings get com.canonical.Unity.Launcher favorites | sed "s/]/,'Your Program.desktop']/")"
Add the above commandline to your install script. Replace the bold Your Program.desktop with the program you created. This will not clobber what your current icons. It'll append.
L. D. James
- 25,444