Page 1 of 1

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

Posted: Sat 02 Feb 2013, 05:12
by wawi
Hi,

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

Posted: Sat 02 Feb 2013, 07:09
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

Posted: Sat 02 Feb 2013, 14:19
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.)

Posted: Sat 02 Feb 2013, 14:51
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.

Posted: Sat 02 Feb 2013, 15:59
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.

Posted: Sat 02 Feb 2013, 22:07
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.

Posted: Sat 02 Feb 2013, 22:29
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!

Posted: Sat 02 Feb 2013, 23:41
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

Posted: Sat 02 Feb 2013, 23:56
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.

Posted: Thu 07 Feb 2013, 03:00
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