Create a panel shortcut to a .sh script

Questions about Grub, UEFI,the liveCD and the installer
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
audio2u
Level 1
Level 1
Posts: 45
Joined: Thu Jun 21, 2018 1:44 am
Location: Gosford, NSW

Create a panel shortcut to a .sh script

Post by audio2u »

Hi all.
I have a shell script which launches an app for me with custom parameters (which is why I don't use the standard app shortcut).
I would like to create a symlink to that script, and place that shortcut on the panel.
How do I do that, and can I add the app's icon (which I can find) as the shortcut icon?
Thanks in advance.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Create a panel shortcut to a .sh script

Post by smurphos »

Which Desktop Environment (Cinnamon, Mate or XFCE)?
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
audio2u
Level 1
Level 1
Posts: 45
Joined: Thu Jun 21, 2018 1:44 am
Location: Gosford, NSW

Re: Create a panel shortcut to a .sh script

Post by audio2u »

Oh, sorry...
Mint 20, Cinnamon 4.6.7
User avatar
spamegg
Level 14
Level 14
Posts: 5104
Joined: Mon Oct 28, 2019 2:34 am
Contact:

Re: Create a panel shortcut to a .sh script

Post by spamegg »

audio2u wrote: Thu Jan 20, 2022 5:52 am Hi all.
I have a shell script which launches an app for me with custom parameters (which is why I don't use the standard app shortcut).
I would like to create a symlink to that script, and place that shortcut on the panel.
How do I do that, and can I add the app's icon (which I can find) as the shortcut icon?
Thanks in advance.
I've done this with an AppImage that I launch with custom parameters. The process should be similar:

You can right-click on the Desktop and "Create a new launcher here..."
In the "Command" box, you would write something like: sh /path/to/your/script.sh --your --parameters (somebody correct me if I'm wrong on this!)
And you can click on the Icon box on the top left to add an icon to it.
This will create a Desktop launcher, but it will ask you "do you want to also add it to the Menu?" Say YES.
Then go to the new Menu shortcut, right-click, and "Add to Panel".
audio2u
Level 1
Level 1
Posts: 45
Joined: Thu Jun 21, 2018 1:44 am
Location: Gosford, NSW

Re: Create a panel shortcut to a .sh script

Post by audio2u »

Thanks spamegg.
Weird thing is... the desktop launcher works, and I could choose to add it to the menu. But the menu version DOESN'T work. Same with the panel. I could add it, but it wouldn't run the script.
I'm sure I'm missing something really simple here. Any ideas?
User avatar
smurphos
Level 18
Level 18
Posts: 8498
Joined: Fri Sep 05, 2014 12:18 am
Location: Irish Brit in Portugal
Contact:

Re: Create a panel shortcut to a .sh script

Post by smurphos »

Can you share the contents of the script, and the launcher you've created in the menu - you will find it in ~/.local/share/applications - right click it and open with text edito to share.

For executable shell scripts just the full path to the script should work e.g. this works fine for me on a desktop launcher, menu and panel. Double quotes aren't needed in this example but would be if there was a space somewhere in the path to the script.

"/home/steve/.local/bin/toggle_surfshark.sh"

You can use sh if you want - in this case the command would be sh -c "/home/steve/.local/bin/toggle_surfshark.sh"
For custom Nemo actions, useful scripts for the Cinnamon desktop, and Cinnamox themes visit my Github pages.
audio2u
Level 1
Level 1
Posts: 45
Joined: Thu Jun 21, 2018 1:44 am
Location: Gosford, NSW

Re: Create a panel shortcut to a .sh script

Post by audio2u »

Ahhhh!
Smurphos, you pointed me in a direction which enabled me to help myself!
I had edited the desktop launcher in a text editor to change ...

Code: Select all

Exec=sh ~/darktable_3.8.0.sh
... to read as ....

Code: Select all

Exec=sh darktable_3.8.0.sh
But the launcher (if that's what you would call it) which was located in /home/bruce/.local/share/applications still contained the original code, with the tilde and forward slash.
I removed those, and now the menu version AND the panel version of the launcher both work!
Thanks. I knew it would be something simple! :)
Locked

Return to “Installation & Boot”