The appropriate way to start any process or application via GUI is using a .desktop
file. You can also use it to run scripts with sudo
privileges. In its simplest form that would be:
[Desktop Entry]
Name=Some Name
Exec=gksu python3 /path/to/script
Type=Application
If the script is executable, you could simply use:
Exec=gksu /path/to/script
In the Exec=
-line
important notes
- You need to make the
.desktop
file executable to make it work on double- click.
- You can "dress up" the
.desktop
file with more options, such as an icon etc., as shown here.
Alternatively
More complicated and kind of a detour, but it should be mentioned nevertheless:
You could set nautilus
to run (executable) scripts on double- click, as described here.
Then (doing it "your way"), a separate bash script:
#!/bin/bash
gksu python3 /path/to/script
made executable, would also run the python script, similarly to the .desktop
file.
.desktop
file with the commandgksu python3 /path/to/script
should work. Must be a dupe of something. – Jacob Vlijm Nov 03 '15 at 15:54.desktop
file? – TellMeWhy Nov 03 '15 at 16:00.desktop
file is the appropriate GUI way to start any process or application via GUI, similar to: http://askubuntu.com/questions/626434/launching-a-sh-file-from-a-launcher/626513#626513. Alternatively, you can set nautilus to run executable scripts on double- click, but I'd prefer the general way. – Jacob Vlijm Nov 03 '15 at 16:02