Executable script won't execute in panel

12 risposte [Ultimo contenuto]
GNUser
Offline
Iscritto: 07/17/2013

Hey.
I made this script:

"
#!/bin/bash
# this script will automatically turn touchpad clicks on and off
if [ "$(synclient -l | grep 'TapButton1' | awk '{print $3}')" == 0 ];
then
synclient TapButton1=1
else
synclient TapButton1=0
fi
"

When I was using debian, I just made the script executable and draged it to the lower panel. Everytime I clicked it, it would do it's job.
But in trisquel, even though it works (when I execute it from the terminal), I can't get it to work in the panel, it only opens in gedit for editing.

Do I really have to move the script to a specific folder? I wanted to create a folder in home called "MyScripts" and put all of mine there.

Any help?

kyamashita (non verificato)
kyamashita

What do you have in your command box for launching the script?

kyamashita (non verificato)
kyamashita

I just created a script to test this out and it works fine. I assume you are using something close to Trisquel's default GNOME 3 configuration?

GNUser
Offline
Iscritto: 07/17/2013

Thanks for the help.
Indeed, I am using the standard Trisquel DE, gnome 3 fallback mode.
I just right clicked the script file, permissions, allow this to be run as executable. But I can only execute it from the terminal.
If i double click it or try to use it from a launcher, it opens in gedit.

lembas
Offline
Iscritto: 05/13/2010

Does this help?gsettings set org.gnome.nautilus.preferences executable-text-activation launch

Now be careful because you now run scripts when you double click them.

GNUser
Offline
Iscritto: 07/17/2013

Not really. It runs the script when I double click the file, but if I drag the file to the lower panel, creating a "shrotcut", clicking it will just open gedit.
I can't believe I will really have to put my scripts into a specific folder in linux (which I forgot which one, will have to research) in order for this to work.

lembas
Offline
Iscritto: 05/13/2010

It's probably best you set the pref to "ask" instead of "launch".

One way is to use bash -c "/path/to/script" as the target of the shortcut.

kyamashita (non verificato)
kyamashita

Instead of dragging the file there, try right-clicking on the panel itself and creating a custom launcher. You should use the path to your script as the command. That is what works for me. Other than that, I'm not sure what could be different in our set-ups.

Magic Banana

I am a member!

I am a translator!

Offline
Iscritto: 07/24/2010

Have you tried to create a launcher from the "Main Menu" utility (in the "System settings") with the path to the executable script as the "command"? You could then try to drag it from the menu and drop it onto the panel.

GNUser
Offline
Iscritto: 07/17/2013

Thanks to everyone who replied!
Well, I am not sure what happened, I tried lembas' suggestion, bash -c /path/to/script, and it gave me an error, I went around a few tries and eventually got it to work.

For someone going through the same: I think the problem is I hadn't made the script executable prior to creating the launcher (I think). Now when I drag it to the panel, it creates the command as "/path/to/script/" and it works. Before it would create it as "file:///path/to/script" and it wouldn't work.
Well, it works now, so, hey anyone feel free to use my script it you need/like it :)

jbar
Offline
Iscritto: 01/22/2011

GNUser said: "anyone feel free to use my script it you need/like it :)"

I know that's a small script, but it's a good habit adding a free license to it
https://www.gnu.org/licenses/license-recommendations.html

GNUser
Offline
Iscritto: 07/17/2013

I can agree with the principle, but i think it's silly to have more lines in the license than the script itself...
I will probably go with the do what the fuck you want license :P

moxalt
Offline
Iscritto: 06/19/2015

> it's silly to have more lines in the license than the script itself...

So GNU Hello basically.