GUI interactions: system alert beep() missing on Linux platform Qt

Most platforms (OS’s) have some aural (audible) way of telling the user that their action is a dud (will not have any effect).  Typically, the dud action is a keystroke, when no window has keyboard focus.  This GUI interaction is typically called the ‘system alert.’  Not to be confused with alert dialogs, and other alerts that appear for example in the upper right of the screen, for example when new email messages arrive.

The Qt framework has a QApplication.beep()  that is supposed to do this interaction, on all platforms.  Unfortunately, it doesn’t work on Linux.

As I sit writing this, if I click on the Ubuntu menu bar and start pressing the ‘a’ key, I don’t hear anything.   I think that the sound settings are properly set to ‘play the alert sound.’  (I don’t think this even goes through Qt.)

The root cause doesn’t seem to be that Qt is deficient.  It seems to be that Linux is deficient.  There are many bug reports about this is at least for Ubuntu distributions.  The bug reports are so many, long, and intricate that it is hard for me to be sure where the fault lies.  But it certainly seems like great minds have looked at it and that it is a complicated issue that no average coder can step forward and fix.  To me, the root cause is that someone made a decision that the Ubuntu platform should not have an alert that the user cannot mute or control the volume on (squelch.)  So the hardware that all PC’s have (a small speaker on the motherboard) is made not directly available through the operating system, but only indirectly available through the OS’s sound subsystem.  And that sound subsystem is complicated and fragile, if not broke.  You might say that the root root cause is that Linux supports so many variations of hardware and software that the complexity is too great to be easily maintained.

Suppose you have written an app using Qt and want to use ‘system alerts.’ One workaround is for the Linux platform only, display a dialog with a “don’t show again” checkbox.  Then at least the user will be able to learn what dud actions exist in your app.  Then they can squelch the dialog.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s