View Single Post
Posts: 25 | Thanked: 59 times | Joined on Jun 2010 @ Finland
#1
Hi!

Noticed this topic has been handled in some threads but to keep it readable, decided to start a new one dedicated to this. Good tips, ideas and more information about using systemui and d-bus welcome! These might also work with N770/8x0, haven't tried yet.

While playing with the power button menu configuration files at /etc/systemui/, I noticed there's an entry for "Top in XTerm" that starts XTerm with top running. If that is possible then starting any command should be possible, let's add some frequently used tools there. Also noticed some of the entries had icons so those could be added as well. I'm biking a lot and my biggest gripe for the N900 has been awkward access to anything unless you have two hands available, stable environment and full concentration. The power button menu allows starting, or focusing, anything with just a press of the power button and one touch of the large power menu items, easy even when biking.



Seems that all the *.xml files under /etc/systemui folder are loaded when systemui is restarted (see below). The basic structure of these files is:

Code:
<powerkeymenu path="/">
  <menuitem 
    priority="[Sort order, lowest first]" 
    name="[Name shown in the menu]">
    <icon>[Icon name, same as in *.desktop]</icon>
  [Actions]
  </menuitem>

  <menuitem priority="9" name="Another entry">
    ..
  </menuitem>  
</powerkeymenu>
Doesn't matter how entries are divided between files, maybe would be good to have the default ones in systemui.xml and add another for own entries or one for each entry.

Don't worry about the priorities at first, just create the buttons and plan on paper how would you like them arranged, then assign priority numbers from lower to higher numbers starting from top left.

I have disabled the shutdown and screen lock entries as those can be accessed by long press and double press anyway. Reboot I might disable too as that's easy enough to do in XTerm, considering that's not needed even every day.

In landscape mode, 14 entries fit the menu nicely, more than that will leave some outside the screen and it doesn't scroll. In portrait mode, 13 entries would (almost) fit, but even with 12 it's difficult to leave the menu without selecting something so a dummy entry might be handy.

My entries:
End task, just icon added:
Code:
  <menuitem priority="600" 
    name="powerup_memain_endcurrenttask">
    <icon>general_close</icon>
    <return>10</return>
    <po>osso-powerup-shutdown</po>
  </menuitem>
Reboot (icon from somewhere):
Code:
  <menuitem priority="500" name="Reboot">
    <icon>reboot</icon>
    <return>6</return>
    <po>osso-powerup-shutdown</po>
  </menuitem>
Top (icon from somewhere):
Code:
  <menuitem priority="4" name="Top">
    <icon>dashboard</icon>
      <callback service="com.nokia.xterm" 
        path="/com/nokia/xterm" interface="com.nokia.xterm" 
        method="run_command" bus="session" autostart="true">
      <argument type="string">/usr/bin/top</argument>
     </callback>
  </menuitem>
Nethack (whenever have some spare minutes:):
Code:
  <menuitem priority="6" name="Nethack">
    <icon>nethack</icon>
      <callback service="com.nokia.xterm" 
        path="/com/nokia/xterm" 
        interface="com.nokia.xterm" method="run_command" 
        bus="session" autostart="true">
      <argument type="string">/usr/games/nethack</argument>
    </callback>
  </menuitem>
SSH server access (using for IM, e-mail etc):
Code:
  <menuitem priority="5" name="Server">
    <icon>im-icq</icon>
      <callback service="com.nokia.xterm" 
        path="/com/nokia/xterm" 
        interface="com.nokia.xterm" method="run_command" 
        bus="session" autostart="true">
      <argument type="string">ssh user@server</argument>
    </callback>
  </menuitem>
Direct access without password using SSH public key (discussed elsewhere).

Plain XTerm (could be root as well but thought this is more general):
Code:
  <menuitem priority="3" name="X-Term">
    <icon>terminal</icon>
      <callback service="com.nokia.xterm" 
        path="/com/nokia/xterm" 
        interface="com.nokia.xterm" method="run_command" 
        bus="session" autostart="true">
      <argument type="string">sh</argument>
    </callback>
  </menuitem>
Panucci the audio player (which I use daily when biking to/from work):
Code:
  <menuitem priority="3" name="Panucci">
    <icon>panucci</icon>
    <callback service="com.nokia.HildonDesktop.AppMgr" 
      path="/com/nokia/HildonDesktop/AppMgr" 
      interface="com.nokia.HildonDesktop.AppMgr" 
      method="LaunchApplication" bus="session" 
      autostart="true">
      <argument type="string">panucci</argument>
    </callback>
  </menuitem>
There might be cleaner ways to start it, this seems to be better than with XTerm anyway.

Calendar:
Code:
  <menuitem priority="2" name="Calendar">
    <po>rtcom-calendar</po>
    <icon>general_calendar</icon>
    <callback service="com.nokia.calendar"
      path="/com/nokia/calendar"
      interface="com.nokia.calendar" method="top_application"
      bus="session" autostart="true">
    <argument type="boolean">true</argument>
    </callback>
  </menuitem>
Phone number shortcut:
Code:
 <menuitem priority="1" name="PhoneHome">
  <po>rtcom-call-ui</po>
  <icon>general_application_call</icon>
  <callback service="com.nokia.csd.Call"
	    path="/com/nokia/csd/call"
	    interface="com.nokia.csd.Call" method="CreateWith"
	    bus="system" autostart="true">
    <argument type="string">+xxxyyyzzzzzz</argument>
    <argument type="uint32">0</argument>
  </callback>
 </menuitem>
Some more ringing profiles I intend to add.

Editing instructions:
- Enable root access. If you don't know what is that, please do some homework or wait for someone write a nice tool for editing the power menu. You might brick your device by editing these files as they are loaded in the startup sequence.
- cd /etc/systemui
- cp systemui.xml systemui.xml_backup
- vi systemui.xml (or whatever editor you like)
or
- cp callui.xml mypowermenu.xml;
- vi mypowermenu.xml

Existing icons can be found in /usr/share/icons/hicolor/48x48/hildon (or other folders below 48x48). Own 48x48 icons can be put there as well.

Here's my icon for Nethack:



The new menu can be taken in use by rebooting but a quick way is to restart systemui. Here is a script for that, save somewhere and run when the menu needs to be refreshed:

Code:
systemui_restart.sh
#!/bin/sh
/usr/sbin/dsmetool -k /usr/bin/systemui
sleep 1
/usr/sbin/dsmetool -n -l -t /usr/bin/systemui

Some questions waiting for answers:
- Are those <title> and <po> in the beginning of systemui.xml (but not callui.xml) used for something?
- What's the <po> tag anyway?
- How exactly does this <callback> work, what do the parameters mean?

I have used Linux for >15 years but am a complete newbie in Maemo, trying to learn quick:)

Edit 2010-06-11:Added systemui restart instructions/script, info about number of entries, how to start apps without xterm.
Edit 2010-06-11:Added info about portrait mode power menu.
Edit 2010-06-17: Added phone shortcut entry.

Last edited by x-rated; 2010-06-17 at 13:33. Reason: Added phone shortcut entry.
 

The Following 45 Users Say Thank You to x-rated For This Useful Post: