Can't get launcher icons to run scripts SOLVED

Forum rules
Before you post please read how to get help
Post Reply
User avatar
linx255
Level 5
Level 5
Posts: 682
Joined: Mon Mar 17, 2014 12:43 am

Can't get launcher icons to run scripts SOLVED

Post by linx255 » Mon Oct 03, 2016 7:54 am

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 linx255 on Wed Oct 05, 2016 5:50 am, edited 3 times in total.
- 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: 4188
Joined: Sat Sep 13, 2014 11:12 am
Location: Bumping around in the bush

Re: Can't get launcher icons to run scripts

Post by Fred Barclay » Mon Oct 03, 2016 3:37 pm

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 » Mon Oct 03, 2016 3:39 pm

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: 682
Joined: Mon Mar 17, 2014 12:43 am

Re: Can't get launcher icons to run scripts

Post by linx255 » Wed Oct 05, 2016 4:57 am

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 » Wed Oct 05, 2016 5:44 am

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: 682
Joined: Mon Mar 17, 2014 12:43 am

Re: Can't get launcher icons to run scripts

Post by linx255 » Wed Oct 05, 2016 5:47 am

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

Post Reply

Return to “MATE”