Monday, September 27, 2010

One-click Reboot and Shutdown in Haiku

Maybe I'm reckless, but when I want to reboot, I prefer just one-click. I don't want to be asked "Am I sure?" Just go ahead and reboot. Or shutdown as the case may be.
Right now in Haiku R1 A2, to reboot you must click on the deskbar leaf, then click on shutdown and then move the cursor to either Restart or Power Off.
To create a one-click icon to reboot and a similar one to shutdown, I got an awful lot of help from this thread.
I also learnt quite a lot of new stuff about Haiku which I'll share with you here.
First, to summarize from the thread how to make the shutdown/reboot icons:
1. Open StyledEdit
2. Create a script with the following input:

3. Save the file to the Desktop and call it Shutdown
4. Create another called Reboot in which the second line becomes
shutdown -r

5. Download this collection of hvif icons from
6. Right-click on the icon for the Shutdown app and then click on Add-ons>>File Type.
7. Now drag whichever icon you want from the downloaded collection to the icon placeholder box (now you should see the icon on your Desktop change for this app.
8. If you don't have LaunchBox on the Desktop, open it by going to Leaf>>Desktop Applets
9. Drag your newly created apps to the LaunchBox after opening up a space by right-clicking the LaunchBox and then hitting Add Button Here.
10. Now you can shutdown or reboot Haiku with just one click.

So what did I learn?
Primarily that in Haiku scripts and terminal commands run in a different mode than do symlinks which is the reason why I got the message mentioned in my first post in the thread. This is eloquently explained in this reply.
As I pointed out, it seems that scripts and terminal commands run in the Haiku equivalent of what would be called Run Level 3 in Linux while symlinks run in Run Level 5.

Next, this reply introduced me to hvif icons (Haiku vector icon file) and showed me how to change the icon of any application.

Finally, the shutdown command (or /boot/system/bin/shutdown) can take a "-a" switch which causes a choice box offering Shutdown/Restart/Cancel options. This might be useful for many people but, for me, it deviated from the one-click shutdown goal.

No comments:

Post a Comment