Can't get launcher icons to run scripts SOLVED

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
linx255
Level 5
Level 5
Posts: 668
Joined: Mon Mar 17, 2014 12:43 am

Can't get launcher icons to run scripts SOLVED

Post by linx255 »

When I had Mate 17, I just created a .desktop icon, entered the script name, and then it turned into a beautiful green icon which I could click to immediately execute the script.

Code: Select all

The launcher is test.desktop, which contains:
[Desktop Entry]
Version=1.0
Type=Application
Icon[en_US]=mate-panel-launcher
Name[en_US]=import contacts
Exec=/home/user/scripts/import.sh
Terminal=true
Name=import contacts
Icon=mate-panel-launcher
Double-clicking gives the following error:
There was an error launching the application.
Details: Failed to execute child process "xterm" (No such file or directory)
Strange, because my default terminal is mate-terminal.
There doesn't seem to be a place to specify the terminal here, but I never had to muck with that before.
Do I need to change the 'Type'? If I change it to 'Script' it at least opens a dialogue that lets me choose 'Run in Terminal' or 'Edit' but that's not what I want. It needs to just 'Run in Terminal' automatically; no prompt.

Can't imagine where I'm going wrong here.
Much appreciated.

Best,
linx255
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 4 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
- I'm running Mint 18 Mate 64-bit
- 4.15.0-34-generic x86_64
- All my bash scripts begin with #!/bin/bash
User avatar
Fred Barclay
Level 12
Level 12
Posts: 4185
Joined: Sat Sep 13, 2014 11:12 am
Location: USA primarily

Re: Can't get launcher icons to run scripts

Post by Fred Barclay »

What would happen if you replaced Exec=/home/user/scripts/import.sh with Exec=mate-terminal /home/user/scripts/import.sh?
Image
"Once you can accept the universe as matter expanding into nothing that is something, wearing stripes with plaid comes easy."
- Albert Einstein
User avatar
Odyseus
Level 2
Level 2
Posts: 53
Joined: Tue May 05, 2015 5:00 am

Re: Can't get launcher icons to run scripts

Post by Odyseus »

Hello, linx255.

I had a similar problem that might be related to yours. Under certain circumstances, the wrong terminal emulator was used instead of the default set by the system. Launch the following command from a terminal:

Code: Select all

sudo update-alternatives --config x-terminal-emulator
It will present you with a list of terminal emulators. You just have to select the number of the terminal emulator that you want to be the default.
User avatar
linx255
Level 5
Level 5
Posts: 668
Joined: Mon Mar 17, 2014 12:43 am

Re: Can't get launcher icons to run scripts

Post by linx255 »

What would happen if you replaced Exec=/home/user/scripts/import.sh with Exec=mate-terminal /home/user/scripts/import.sh?
No change.

Code: Select all

sudo update-alternatives --config x-terminal-emulator
gives:
There is only one alternative in link group x-terminal-emulator (providing /usr/bin/x-terminal-emulator): /usr/bin/mate-terminal.wrapper
Nothing to configure.
And still no change, but I just checked, and xterm was not installed.
After installing xterm, the launcher runs, but opens both xterm and mate-terminal, and the script does not execute. :(

I ran

Code: Select all

sudo update-alternatives --config x-terminal-emulator
again, and get:
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/mate-terminal.wrapper 30 auto mode
1 /usr/bin/koi8rxterm 20 manual mode
2 /usr/bin/lxterm 30 manual mode
3 /usr/bin/mate-terminal.wrapper 30 manual mode
4 /usr/bin/uxterm 20 manual mode
5 /usr/bin/xterm 20 manual mode
Whether set to 0 or 3 it doesn't make any difference.
- I'm running Mint 18 Mate 64-bit
- 4.15.0-34-generic x86_64
- All my bash scripts begin with #!/bin/bash
User avatar
Odyseus
Level 2
Level 2
Posts: 53
Joined: Tue May 05, 2015 5:00 am

Re: Can't get launcher icons to run scripts

Post by Odyseus »

Hello, linx255.

This seems to be an issue for years now. Here, here, here and this GitHub issue all are reporting your same issue since 2012. The g@y on this comment on the GitHub issue has Linux Mint 18 with Mate 1.14 and used the following workaround to fix the problem.

Code: Select all

sudo ln -s /usr/bin/mate-terminal /usr/bin/gnome-terminal
I just tested it on a virtual machine with Linux Mint 18 Mate and it worked. Don't ask me why creating a symbolic link to a terminal that it isn't installed to fix a problem with a third terminal that isn't installed either fixes the problem because I have no clue. LOL
User avatar
linx255
Level 5
Level 5
Posts: 668
Joined: Mon Mar 17, 2014 12:43 am

Re: Can't get launcher icons to run scripts

Post by linx255 »

Turns out all I had to do is change 'terminal=true' to 'terminal=false' and add a '-e' after 'mate-terminal' and it runs fine.
Strangely, the default setting is 'terminal=true'.
Also weird is the fact you can't create launchers anywhere except the desktop. It's not an option in any other directory.
But at least it works now and I don't have to have xterm installed as once believed. :D
- I'm running Mint 18 Mate 64-bit
- 4.15.0-34-generic x86_64
- All my bash scripts begin with #!/bin/bash
justpeanut
Level 1
Level 1
Posts: 10
Joined: Tue Feb 02, 2021 2:20 am

Re: Can't get launcher icons to run scripts SOLVED

Post by justpeanut »

I am just writing this if someone else stumbles upon this thread and if it might help...
what solved the issue for me of the binary file not being run by creating a launcher icon, was simply to change the "Path" option in the .desktop file to

Code: Select all

Path=/
.

PS: I am just a newbie.. nothing else worked in my case.. also my DE was xfce.
Locked

Return to “MATE”