Ask Your Question
1

.desktop launcher for a shell script (Gnome/24)

asked 2016-06-24 18:47:04 -0500

forums gravatar image

Is it possible to write a .desktop launcher for a shell script, or must these always be run in a terminal?

edit retag flag offensive close merge delete

Comments

1

yes, you can write a .desktop lauhcher for a shell script.

aeperezt gravatar imageaeperezt ( 2016-06-24 22:26:27 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted
1

answered 2016-07-01 23:57:30 -0500

vikas_kr gravatar image

Yes it is possible to write launcher for shell script. First of all you need to give executable permission to that file. Now you need to understand the structure of a .desktop file.

[Desktop Entry]

Name=[A formal name for your script]

GenericName=[genric name for your script [optional]]

Exec=[address of your shell script]

Icon=[icon file [optional]]

Type=Application

StartupNotify=true

You just have to create a .desktop file with content same as above and then add absolute path to your script as the value of Exec, ie. Exec=\home\vikas\test.sh .

If you want to put this in you application launcher, you have to copy the desktop file in /usr/share/applications

edit flag offensive delete link more

Comments

It is also possible to use ~/.local/share/applications/, and it is /, not \ :)

skytux gravatar imageskytux ( 2016-07-28 15:31:45 -0500 )edit

yes so the absolute path should be in the following format:

Exec=/home/user/script.sh
mohamedation gravatar imagemohamedation ( 2016-07-30 01:29:10 -0500 )edit
0

answered 2016-07-28 15:20:37 -0500

ssieb gravatar image

If you want to see the output of the script, add a line containing Terminal=true to the .desktop file and that will run the script in a terminal window.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-24 18:47:04 -0500

Seen: 4,653 times

Last updated: Jul 28 '16