Page 1 of 1

SOLVED - Desktop launcher for bash script not working

Posted: Mon Jun 03, 2019 5:08 pm
by iain_33
I'm using Mint 19.1, MATE edition. I've created a simple little bash script to turn my laptop display off:

Code: Select all

$ cat ~/bin/screenoff
#!/bin/bash
sleep 1
xset dpms force off
I've used it from the terminal a few times and it works fine. However, I can't get a desktop launcher to work for it (see attached screenshot) - I just get "There was an error launching the application". I've tried "Type" as "Application" and "Application in terminal" but get the same result.

I've also tried the full path for the command - /home/iain/bin/screenoff - this time I get the error "Details: Failed to execute child process "xterm" (No such file or directory)"

Screenshot at 2019-06-03 22-00-52.png
Screenshot at 2019-06-03 22-00-52.png (31.48 KiB) Viewed 326 times

Re: Desktop launcher for bash script not working

Posted: Mon Jun 03, 2019 5:32 pm
by ajgreeny
I suspect the command you're using is not needing the "Application in terminal" that you show but not using Mint I am not sure about that.

What other options show in that dropdown box?

One alternative, if the terminal is necessary, is to use a command starting with whatever terminal emulator you use, eg

Code: Select all

gnome-terminal -x /full/pathway/to/script
Change gnome-terminal to whatever is used in the mate desktop.

Re: Desktop launcher for bash script not working

Posted: Mon Jun 03, 2019 5:43 pm
by gm10
ajgreeny wrote:
Mon Jun 03, 2019 5:32 pm
I suspect the command you're using is not needing the "Application in terminal" that you show
Yes, and that's the problem, if he switches it to just Application it'll work.

Terminal launchers are broken by default in LM MATE. Run this once to fix them:

Code: Select all

sudo ln -s /etc/alternatives/x-terminal-emulator /usr/bin/xterm

Re: Desktop launcher for bash script not working

Posted: Mon Jun 03, 2019 5:50 pm
by iain_33
Thanks both for your replies.

I tried both "Application" and "Application in Terminal" with the same result.

I changed the command line to bash /home/iain/bin/screenoff and it works - I thought the #!/bin/bash line meant it would run by itself but hey-ho.

Re: Desktop launcher for bash script not working

Posted: Mon Jun 03, 2019 5:52 pm
by iain_33
gm10 wrote:
Mon Jun 03, 2019 5:43 pm
Terminal launchers are broken by default in LM MATE. Run this once to fix them:

Code: Select all

sudo ln -s /etc/alternatives/x-terminal-emulator /usr/bin/xterm
I've just tried that, changed my launcher back to how it was before (without the bash prefix) and it works now :D

Re: Desktop launcher for bash script not working

Posted: Tue Jul 30, 2019 8:09 am
by gostal
gm10 wrote:
Mon Jun 03, 2019 5:43 pm
Terminal launchers are broken by default in LM MATE. Run this once to fix them:

Code: Select all

sudo ln -s /etc/alternatives/x-terminal-emulator /usr/bin/xterm
Those of us who happen to like xterm have probably not experienced this problem since one of the first things we do is to install it. :)

Cheers,
gostal