You are not logged in.

#1 2023-03-24 08:42:15

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

[SOLVED] Executing a shell script by double-clicking and .desktop file

I have a shell script that's manipulating PDF files in a certain folder. Currently that script sits in the same folder as the PDF files and I'm able to execute it by opening that folder in a console and then start the script from the command line, but I could not make it work by just double-clicking the file in the file manager and I'm not sure what is to be done to be be able to put that script in a different folder (like ~/bin) and run it by executing a .desktop file (currently on Gnome, but want to move to KDE Plasma).

Any hints?

Last edited by Master One (2023-03-24 17:08:09)

Offline

#2 2023-03-24 10:44:17

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,657

Re: [SOLVED] Executing a shell script by double-clicking and .desktop file

Do you want the shell script to open a terminal while executing it or do you just want it executed? The latter should be fixable by simply making it executable (not sure how GNOME handles this, KDE will ask you whether you want to execute or edit an executable shell script)

Offline

#3 2023-03-24 12:56:53

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: [SOLVED] Executing a shell script by double-clicking and .desktop file

V1del wrote:

Do you want the shell script to open a terminal while executing it or do you just want it executed? The latter should be fixable by simply making it executable (not sure how GNOME handles this, KDE will ask you whether you want to execute or edit an executable shell script)

Opening a terminal while executing it only makes sense if there is any interaction or output, so I guess it can just be executed (the script prints some things to stdout, but the output is not important).

The script is marked as executable. In Gnome I can right click the file and choose "Execute as application" and it indeed now opens a terminal and executes it properly (not sure why this didn't happen before). I have now tried successfully with the script being in a different folder, so the only remaining task is to get a proper .desktop file into place.

Offline

#4 2023-03-24 13:34:35

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,657

Re: [SOLVED] Executing a shell script by double-clicking and .desktop file

https://wiki.archlinux.org/title/Desktop_entries should contain all to get you started if you still want a .desktop file of that

Offline

#5 2023-03-24 16:26:26

Master One
Member
From: Europe
Registered: 2007-01-21
Posts: 249

Re: [SOLVED] Executing a shell script by double-clicking and .desktop file

V1del wrote:

https://wiki.archlinux.org/title/Desktop_entries should contain all to get you started if you still want a .desktop file of that

Done and working smile

Offline

#6 2023-03-24 16:28:57

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,657

Re: [SOLVED] Executing a shell script by double-clicking and .desktop file

Great, please mark as [SOLVED] by editing the title in your first post.

Offline

Board footer

Powered by FluxBB