script key action usage

Asked by headup84 on 2012-08-28

Hello,

I'm looking to implement a custom key in my layout that will kill any browser processes in my environment but am having significant issues accomplishing this.

Could someone please provide a brief description/example of the script="name" attribute?

Any help would be greatly appreciated.

Thanks for your time

Question information

Language:
English Edit question
Status:
Solved
For:
Onboard Edit question
Assignee:
No assignee Edit question
Solved by:
marmuta
Solved:
2012-08-29
Last query:
2012-08-29
Last reply:
2012-08-28
Best marmuta (marmuta) said : #1

Hi, we're not using the script tag anymore for the default layouts, but it should still work. Here's an example:

- add a key line with the 'script' attribute to your layout file (*.onboard):
  <key id='settings' label='Preferences' script='sokSettings'/>

- create a python script, we're reusing the existing 'sokSettings.py' for this example, and place it in /usr/share/onboard/scripts. You can use sokSettings.py as a template for your script, but all it really needs is a run() method.

When the key is pressed, Onboard imports the script and calls its run method. That's basically it. You may be able to store your script a different directory by modifying the python path, e.g. by setting the PYTHONPATH environment variable before launching Onboard.

Hope that helps.

headup84 (pep84) said : #2

Thanks marmuta, that was exactly what I needed.

I Didn't mess with the PYTHONPATH environment variable; just put my script in the /usr/share/onboard/scripts folder, so I can't vouch for that solution, but the script attribute works perfectly.

 Thanks again

AACOS (ubuntuaaos) said : #3

Hello,
can anyone confirm that this option is still available on onboard.
<key id='settings' label='Preferences' script='sokSettings'/> with python script or bash.

I've tried to insert on onboard custome layout I does not execute the script.
I've Fellowed instructions on previous posting.
I am mising something.
Thanks for any tips.