Joined: 23 Oct 2003
Location: Ormond Beach, FL
|Posted: Sun Feb 22, 2004 11:19 pm Post subject: Using zenity & gkrellm (attn: laptop owners)
|Using zenity & gkrellm
ka0ttic at cfl dot rr dot com
This isn't solely a laptop-related tip, as I'm sure people could find other things to use it for, but I use this all the time on my laptop.
If you run GNOME, as I do, then you should have something called zenity installed (see the zenity(1) manual page, as there are a sleu of different options). Zenity allows you to show GTK+ dialogs by just typing a command.
In conjunction with the commonly-used gkrellm, zenity allows you to show prompts when certain conditions occur.
I use this all the time to alert me when my battery gets to 10% and then once again at 2%.
To enable this, right click on the monitor in gkrellm that you'd like to mess with, and somewhere in the properties for that monitor, you should see an "Alerts" button. Click on that, and you should be able to set commands.
For example, so that gkrellm will alert me when my battery is almost dead, I click on the "Alerts" button under the battery monitor. It allows you to set a "Low warn limit" and a "low alarm limit", which I set to 10 and 2, repectively (meaning 10% and 2%).
This is where zenity comes in. In my example, for the low warn limit command, I just type zenity --warning --text="10% battery remaining" and do the same thing for the low alarm limit.
It would also be possible to set the low alarm limit to say, 1% (you might want to test this to make sure 1% gives you enough time), then set the command to something like sudo halt, assuming you have sudo setup of course. This is a convienent way to automatically shut down when you're battery is almost dead. Of course, the low warn limit, could alert you before hand so you know that you either need to plug in the A/C adapter, a new battery, or save your stuff and get ready to shutdown.
Any comments/questions encouraged.
Hope you guys find this tip helpful.