maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Nokia N810 (https://talk.maemo.org/forumdisplay.php?f=28)
-   -   Launching script from icon (https://talk.maemo.org/showthread.php?t=19707)

adaviel 2008-05-01 18:25

Launching script from icon
 
I want to put a button on the tablet desktop that, when clicked, launches
a script inside an xterm.

On my gnome desktop, I use "add to panel", "custom application launcher",
pick an icon and use a command like
'gnome-terminal -t goofy -e "ssh -i ~/goofy.key -e goofy.example.com"'
I can put a button on a panel, a drawer etc. - one click and I've got a login screen. Then I put down the mouse and type ...

I know this has been asked before, but I'm still having trouble (N810, OS2008).
kerez: just found it, works, still not one-click launch.
simple-launcher: didn't work for me
hacking a .desktop : didn't work for me
cmd-navigator, personal-menu: controls appear in settings/control-panel,
but I can't find how to actually launch the command

... heck, I guess I can do it myself ...
Code:

/* launch.c */
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
int main (int argc, char **argv) {
  if (execvp("/usr/local/bin/ssh.goofy",argv)) {
    perror("Error executing ssh.goofy") ;
    exit(-1) ;
  }
}

/usr/share/applications/hildon/goofy.desktop :
Code:

[Desktop Entry]
Encoding=UTF-8
Version=1.0
Type=Application
Icon=terminal
Name=ssh to goofy
Exec=/usr/local/bin/launch
X-Osso-Service=org.maemo.ssh_goofy

/usr/share/dbus-1/services/goofy.service
Code:

[D-BUS Service]
Name=org.maemo.ssh_goofy
Exec=/usr/local/bin/launch

/usr/local/bin/ssh.goofy
Code:

exec osso-xterm -e "ssh donald@goofy.example.com"


/etc/init.d/af-startup stop ; /etc/init.d/af-startup start

Now I can find the icon in control panel/panels/applications-organize
and drag it to "my selection". 2 taps. :)
(kerez is more versatile, but it seems to hang around consuming memory)
With a bit of tinkering, I could probably put the ssh command right
in the C program without the intervening shell script, but then I'd have
to recompile to change anything. "launch" is 3Kb stripped.


All times are GMT. The time now is 09:26.

vBulletin® Version 3.8.8