Add gnome ubuntu application luncher with custom shell environment

By neokrates, written on March 22, 2010

howto

  • Join date: 11-30-99
  • Posts: 224
View Counter:
  • 109 views
Rate it
Ad
Poll
  • Your skill as shell programmer is?

    View Results

    Loading ... Loading ...
Feeds:
  • bodytext bodytext bodytext

You have some script or application which needs shell(bash!?) environment. If you add it to the Application Luncher, it misses variables and script fails.

The problem is that you might have your variables in bashrc or file like this, and they are not been read in this case. In this howto, I will add Java path to the PATH environment variable so that my eclipse can start from script. But solution would work for any similar case…

My eclipse directory is ECLIPSE_HOME.

Step 1. 

In ECLIPSE_HOME:
Create file with your variables and export them. Call the file “vars”:

DEVTOOLS=/opt/dev
JAVA_HOME=$DEVTOOLS/lang/jdk
export JAVA_HOME
PATH=$PATH:$JAVA_HOME/bin:.

Step 2.

Create starter script. I.e., mine is called “estarter”:

#!/bin/bash
cd /opt/dev/ide/eclipse
source vars
./eclipse

 
The source vars command tells bash to read variables from my vars file.

Step 3.

Make “estarter” executable:

ECLIPSE_HOME> chmod a+x estarter

Step 4.

Now drag the icon of estarter from File Browser to the Gnome Starter panel. Give a name for new luncher.

Done.

💡 Remark: You can put vars in your ~ (home directory). That will spare you the problem of double configuration.

Then, you use it from .bashrc, .profiles etc. like this:

source vars
Be Sociable, Share!
 
Does that help to solve your problem?
VN:F [1.8.5_1061]
Rating: -1 (from 1 vote)
0 votes 'YES'  1 votes 'NO'


TAGS

SOCIAL
Be Sociable, Share!

INCOMING SEARCH TERMS


Leave a Reply