How to make a desktop icon run a bash script? (Solved)

Booting, installing, newbie
Post Reply
Message
Author
wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

How to make a desktop icon run a bash script? (Solved)

#1 Post by wawi »

Hi,

how can I generate an icon that launches the console with my bash script?

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#2 Post by musher0 »

Hello, wawl.

Welcome to the kennels! :)

There already are two console icons in /usr/local/lib/X11/pixmaps, console48.png and console24.png. Perhaps more in /usr/share/pixmaps and /usrshare/icons. Certanly small ones in /usr/local/lib/X11/mini-icons.

Return to your console script. Right click on it. 12th entry in the submenu says "Define icon". Click on that. A rectangle opens. Drag one of the icons above in the open rectangle. The rectangle closes automatically. Now, if you bring your script on your desktop, it will carry the chosen illustration.

Best regards.

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#3 Post by wawi »

Thanks for the welcome.

It was a misunderstanding. I do not want a beautiful icon, but a icon of the desired functionality: Clicking on it should
  • start the console
    start my script in the console.
I am also interested on the way to my script in a console to start immediately after boot. (Place the script in the Startup folder did not work.)

User avatar
rcrsn51
Posts: 13096
Joined: Tue 05 Sep 2006, 13:50
Location: Stratford, Ontario

#4 Post by rcrsn51 »

Read here for some ideas.
I am also interested on the way to my script in a console to start immediately after boot. (Place the script in the Startup folder did not work.)
What is in the script? Getting things to work out of the Startup folder can be a bit tricky.

User avatar
Flash
Official Dog Handler
Posts: 13071
Joined: Wed 04 May 2005, 16:04
Location: Arizona USA

#5 Post by Flash »

Wawi, I haven't tried it, but it looks to me like if you follow musher's instructions the result will be an icon on your desktop that will do exactly what you said you want. You can even draw a custom icon if you want. Either way, when you click on it, it will run your script.

User avatar
8-bit
Posts: 3406
Joined: Wed 04 Apr 2007, 03:37
Location: Oregon

#6 Post by 8-bit »

After you created the script, and saved it, did you go back and set the script to be executable?
I have forgotten to do that at times myself!
I have not figured out if the script needs to be put in an executables directory such as usr/bin or root/my-applications/bin for it to be found.
Otherwise, one gets feedback of the file or directory not being found or that it is not recognized as a command.

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#7 Post by wawi »

Hello Flash,

I tested both:

musher's result is only another icon, but rcrsn51 has the perfect solution.

It works also, the script in the Startup folder to run automatically.

And, of course, it is possible, to split the script in two parts with

Code: Select all

exec rxvt-e sh / ... / Script.txt
in the first.

I thought, click start of script icons works out of the box in other distributions, but I was wrong. Ubuntu Unity has the same problem.

Thanks at all!

User avatar
tallboy
Posts: 1760
Joined: Tue 21 Sep 2010, 21:56
Location: Drøbak, Norway

#8 Post by tallboy »

Hi wawi.
The script to be executed, must be in the executable path, if you place the script - or a link to it - in ~/my-applications/bin/, it should run.

See this thread from earlier this week: Putting icons on desktop.

tallboy
True freedom is a live Puppy on a multisession CD/DVD.

wawi
Posts: 18
Joined: Sat 02 Feb 2013, 04:50
Location: Germany

#9 Post by wawi »

tallboy wrote:Hi wawi.
The script to be executed, must be in the executable path, if you place the script - or a link to it - in ~/my-applications/bin/, it should run.
Yes, but outside from this PATH is it possible with ./example.sh

My problem was to start a script AND the console with one click - and we have the solution now.

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#10 Post by musher0 »

Hi, wawi.

You wrote:
< musher's result is only another icon,

Just a note to tell you that I have lots of "another icons" on my desktop or in a ROX panel that have been launching lots of bash scripts in Puppy successfully for years.

It's not the icon that launches the script, it's the script dressed up with an icon. You can have any script on your desktop with just the ugly default icon, and it will do its job, dressed up with a lovely icon or not.

I'm sure rcrsn51's works fine, and I won't bring up the matter again, but you know very well deep down what this "another icon" is telling you: "Do a thorough check next time before affirming that something does not work."

Respectfully,

musher0
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Post Reply