[PATCH] Turn Powerdevil suspend notification into a dialog

Aurélien Gâteau aurelien.gateau at canonical.com
Tue Sep 22 13:19:57 BST 2009


Hi,

In case you missed it, an earlier discussion about notification 
capabilities on this list diverged a bit on Powerdevil suspend 
notification. I am referring to the notification which appears when your 
laptop is running out of battery. Powerdevil shows a notification to 
tell you it will suspend the machine in a few seconds, unless you click 
the "Cancel" button of the notification.

I believe this is one of the few cases where using a dialog is more 
appropriate than using a notification because the system is about to do 
something very drastic, so it should ensure the user does not miss it.

The dialog approach has a drawback though: it can steal the focus, 
resulting in the user accidentally triggering one of the dialog buttons 
if the dialog receive a keystroke intended for the previously active window.

Attached first patch turns Powerdevil suspend notification into a 
dialog. To avoid the focus-stealing problem it opens the dialog as 
always-on-top and on all desktops, but keeps the previously active 
window active. I have been running it for a while without problems.

It also adds a few niceties:
- A button to trigger the action right now.
- A real-time updated count down in the dialog text, so that the user 
knows in real time how much time is left.

Here is a screenshot of the dialog:
http://imagebin.ca/view/OT7MHYEn.html

(Unfortunately updating the text of a KMessageBox is not possible at 
runtime, so I had to create a KDialog-based dialog. This could be fixed 
by giving an object name to the text label created by KMessageBox)

The second patch increases the default timeout from 10 seconds to 30 
seconds, giving the user more time to react.

What do you think about this?

Aurelien
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Turn-low-battery-notifications-into-a-countdown-dial.patch
Type: text/x-diff
Size: 15451 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090922/f75e72b3/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-Increase-WaitBeforeSuspendingTime-from-10-to-30-seco.patch
Type: text/x-diff
Size: 920 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20090922/f75e72b3/attachment-0001.patch>


More information about the kde-core-devel mailing list