PDA

View Full Version : [ubuntu] How to add a app to the unity launcher? in 11.10



larryzhao
November 15th, 2011, 05:19 AM
There's a lot of application which is launched by a shell script, how could I add these kind of thing to the laucher bar?

Thank you very much for helping.

hansdown
November 15th, 2011, 05:50 AM
Welcome to the forum, larryzhao.

It is a little different, in 11.10.

http://www.ubuntugeek.com/how-to-create-desktop-launchers-in-ubuntu-11-10oneiric.html

riverabove
November 15th, 2011, 06:02 AM
There's a lot of application which is launched by a shell script, how could I add these kind of thing to the laucher bar?

Thank you very much for helping.

Based on your title in this thread, I think you are asking how to create a launcher on unity bar not on the desktop, CMIIW. I don't try yet to make a launcher for shell script, but for other application that not on unity bar by default, I just run the application then the icon of that application will appear on the unity, right click and mark 'keep in launcher'. Have you try it?

Thanks, and I'm sorry if it not helping. :)

stinkeye
November 15th, 2011, 07:43 AM
You can use alacarte (need to install alacarte and gnome-panel in 11.10) to create a .desktop file for the script.
You can also give it an icon to use by clicking on the icon in the launcher properties window.
Then the name you gave to the file should show up in a dash search, where you can drag it to the launcher.
The .desktop file is saved to ~/.local/share/applications where
you can also drag the .desktop file to the launcher.

larryzhao
November 16th, 2011, 04:45 PM
Thanks you very much guys for the help.

@hansdown, I really mean how to create a launcher in the launcher bar, not on the desktop. But still thanks a lot to your answer, which I didn't know yet.

@riverabove, yes, you get what I mean. But using "keep it in launcher" to a shell script will not working after the application started by the shell is exit.

@stinkeye, looks very promising, but I do not have the "script" category, I attached screenshot of mine, would you please check what's wrong with mine...

Frogs Hair
November 16th, 2011, 05:21 PM
To create a new menu named scripts , select New Menu and add the launcher under the new category .

stinkeye
November 16th, 2011, 05:31 PM
Thanks you very much guys for the help.

@stinkeye, looks very promising, but I do not have the "script" category, I attached screenshot of mine, would you please check what's wrong with mine...
Nothing.
I created the scripts sub menu with the new menu button
and then added the launcher in scripts with the new item button.
You can create the launcher anywhere you like or make up your own sub menu.

larryzhao
November 17th, 2011, 04:43 AM
Many thanks,

After fixing the bug: https://bugs.launchpad.net/ubuntu/+source/alacarte/+bug/826049 I finally added a new item in the alacarte.

But since it is executed under root(maybe, I am not sure), it could not use the environment variable defined under my user(I define them in .bashrc),

Is there a way to tell alacarte to execute is under my user? or the only way is I have to put the environment variable in /etc/environment instead?

stinkeye
November 17th, 2011, 04:57 AM
After fixing the bug: https://bugs.launchpad.net/ubuntu/+source/alacarte/+bug/826049 I finally added a new item in the alacarte.

Edited original post to include gnome-panel.

Bit lost here.
What scripts are you trying to add?

larryzhao
November 17th, 2011, 03:20 PM
@stinkeye I am going to add the start shell script of RubyMine,
RubyMine requires JVM. I set all the runtime environment variables like JAVA_HOME in ~/.bashrc, so it only affects the Terminal session my user opens.

So I ask in the last post, is there a way to tell alacarte to launch this only use my profile? (I've opened the .desktop file generated by alacarte but didn't see anything about that).

stinkeye
November 17th, 2011, 04:24 PM
Try choosing application in terminal.

larryzhao
November 17th, 2011, 06:43 PM
Thanks, stinkeye, but I found another way which is dirty but maybe easier.

I add lines of export environment variable to the shell script which launches the application, then it works. :popcorn:

stinkeye
November 17th, 2011, 07:03 PM
Thanks, stinkeye, but I found another way which is dirty but maybe easier.

I add lines of export environment variable to the shell script which launches the application, then it works. :popcorn:

Ok glad you got it sorted.