Home » Featured, Hacks

[How-To] Adding a “Reboot” button to your powerkey menu

12 January 2012Entry by

Ever wanted to have a graphical button to reboot your beloved device? Well, today I’ll show you how to add one to your powerkey menu!

Note: the tips we go through involve editing a low-level system file and imply that readers know what they are doing.

Adding the Reboot button:

First, we would want to go root:

  sudo gainroot

Next, let’s modify the sudoers file to allow us running reboot:

echo “user ALL = NOPASSWD: /sbin/reboot” > /etc/sudoers.d/reboot.sudoers

Update sudoers:

update-sudoers

Now, we would want to create a d-bus service.

[editor] /usr/share/dbus-1/services/reboot.service

Replace [editor] with whatever editor you prefer, for example, leafpad.

Paste the following into the file:

  [D-BUS Service]
  Name=com.misc.reboot
  Exec=/usr/bin/sudo reboot

Save the file and exit the editor. Change current directory:

cd /etc/systemui

Open up systemui.xml file in your preferred editor:

[editor] systemui.xml

Paste the following anywhere between the <powerkeymenu> and </powerkeymenu> tags:

<menuitem priority=”750″ name=”Reboot”>
   <icon>general_refresh</icon>
   <callback service=”com.misc.reboot” path=”/com/misc/reboot” interface=”com.misc.reboot” method=”reboot” bus=”session”   autostart=”true”>
   <argument type=”boolean”>true</argument>
  </callback>
</menuitem>

Note: some of you may notice that a reboot entry is already defined in systemui.xml. However, it utilizes osso-powerup-shutdown and preforms a very brutal shutdown. Rebooting with sudo reboot will gently shutdown all software and sync your filesystems, which is safer. Let’s just say that there  was probably a reason that the default entry was commented out.

Save the file, exit the editor and reboot your N900.

reboot

Enjoy your newly added Reboot button which will perform a safe reboot once pressed!

 

Source: Talk Maemo

Comments:


Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.