Ask / Submit
23

Launch shell commands from user interface

asked 2014-02-04 16:33:31 +0300

tokaru gravatar image

updated 2014-02-05 22:10:24 +0300

AFAIK, there is currently no way to execute shell commands from the Sailfish OS user interface (i.e. without accessing the terminal first).

Say I have created a shell script to run a backup on some files or to reboot my PC at home. The terminal is great, but I would love to be able to execute stuff like this directly from the user interface.

EDIT: re-phrased this to be 100% feature request, initially it also included a question ("Is it possible...")

edit retag flag offensive close delete

Comments

1

Yes! Something like a dropdown terminal accessible from the pulley menu.

fc ( 2014-02-04 17:44:25 +0300 )edit
3

In your case, it seems like a shortcut app to your shell script would be ok, isn't it?

Tofe ( 2014-02-04 18:08:33 +0300 )edit

@Tofe Basically yes, but it is not very comfortable to build an app every time one needs a launcher for a shell script... even though it's probably easy once one has basic knowledge of Sailfish app development.

tokaru ( 2014-02-04 18:37:08 +0300 )edit
2

What about an app that runs premade shell scripts? Like it has a list of them?

Bulder ( 2014-02-04 18:40:23 +0300 )edit

@Bulder say if an app would display all *.sh files in /home/nemo, and I could trigger each with another touch? That would be a great app for sure. Being possible to launch it right from the app icons view would be pure luxus, but I guess it would be neccessary to create and install an app for each selected script automatically on the phone... phew ;-)

tokaru ( 2014-02-04 20:36:11 +0300 )edit

3 Answers

Sort by » oldest newest most voted
15

answered 2014-03-03 09:43:22 +0300

gehowa gravatar image

updated 2016-02-14 00:07:02 +0300

piero gravatar image

Just put a $my_script.desktop file in /usr/share/applications/ or without going root within ~/.local/share/applications directory.

[Desktop Entry]
Type=Application
Name=Run my script
Icon=/path/to/fancy/icon.png
Exec=/path/to/script
Comment=Terminal application
edit flag offensive delete publish link more

Comments

That's a nice, provisional workaround, thanks. Although it doesn't solves the need for a real shell-script-running-app, where you could start/stop the script, see the status, set some parameter and even get an active cover. See also related question https://together.jolla.com/question/28377/using-network-file-shares-smbclient-in-mer-repository-and-compiling/

melg01 ( 2014-03-04 08:10:39 +0300 )edit

Having problems with executing root-only commands like mount or umount... we still need a better way to wrap and run shell scripts.

melg01 ( 2014-03-04 22:15:53 +0300 )edit
2

Well, you could install sudo and add nemo ALL=NOPASSWD: /path/to/your/script to /etc/sudoers, then you can use Exec= sudo /path/to/your/script in the .desktop file to run your script with root privileges but without password prompt.

gehowa ( 2014-03-04 22:58:52 +0300 )edit
1

is there a way to make it so that it doesn't open a load app cover for a brief moment?

Whippler ( 2015-10-02 11:47:04 +0300 )edit

Same question/comment as @Whippler. I have made an sh file for a particular purpose, it works when I trigger it from a my launcher icon, but a 'load cover' appears for around 10-12 seconds. It would be nice to stop that cover from showing. Any ideas, anyone?

Edz ( 2016-03-31 12:24:06 +0300 )edit
11

answered 2014-04-27 17:19:17 +0300

Acce gravatar image

updated 2014-04-28 01:54:12 +0300

Hey, I created this app to scratch these itches, I've sent it to the harbour, but you can get the RPM and source from https://github.com/Acce0ss/shellex if you'd like to test it. I will eventually try to make an UI patch (for @Sfiet_Konstantin's patchmanager) to integrate the interface to the events view, so it's accessible all the time.

EDIT: links to screenshots:

Main page

image description

edit flag offensive delete publish link more

Comments

@Acce thanks. is this app similar to whats requested at: https://together.jolla.com/question/29226/app-request-command-line-outputs-on-a-customizable-cover/ ?

User ( 2014-04-27 17:37:49 +0300 )edit
1

Hmm, the functionality could be implemented as a setting for the cover, nice noticing! Currently the cover is pretty dull, it could really use some customizable improvements. Binding a script / command to the cover and allowing start/stop from cover and showing the output there sounds nice

Acce ( 2014-04-27 17:48:44 +0300 )edit

Wow, this is great :) Already more than I have dreamt of when requesting this feature - very nice.

By the way, did you know that GitHub has a "releases" feature, too - no need to commit compiled binaries into the repository. :)

tokaru ( 2014-04-28 01:02:39 +0300 )edit

@tokaru I didn't know about it, thanks! I'll try it :) and if you got it already, check it again, I fixed a bug which caused edits not to be saved to the database.. Why I always find these after pushing the app somewhere

Acce ( 2014-04-28 01:18:01 +0300 )edit

Shellex is available in the Jolla store ...

Holger ( 2016-02-14 12:38:19 +0300 )edit
8

answered 2014-10-11 14:22:39 +0300

SaimenSays gravatar image

Maybe this helps someone having the same problem... If you want to have script output visible, use "fingerterm -e". Also I realized, that program is singleton by default. So an additional line is needed.

My icon to start openvpn:

[Desktop Entry]
Type=Application
Name=OpenVPN
Icon=/opt/openvpn/OpenVPN.png
Exec=fingerterm -e "/opt/openvpn/my-openvpn.sh"
Comment=Connect to home over VPN
# Ensure fingerterm is executed second time if already running
X-Nemo-Single-Instance=no
edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
20 followers

Stats

Asked: 2014-02-04 16:33:31 +0300

Seen: 3,930 times

Last updated: Feb 14 '16