Comment 67 for bug 486154

Revision history for this message
Nic Shakeshaft (nshakeshaft) wrote :

Having struggled with this for ages, just thought I'd post the (extremely hacky!) workaround which finally got the system bell working normally for me, in case it's of any help to anyone. This is for Lucid. There were two issues for me: first, the fact that the pcspkr kernel module (when removed from blacklist) loads too early and hence fails to do anything, as Grondr points out above.

Second, the window manager's "audible bell" setting (Compiz in my case - I haven't checked, but it may be the same for metacity) appears to be overruled by pulseaudio's attempt to capture system bells and replace them with a sampled sound (using module-x11-bell), such that these settings in gconf-editor, etc., don't actually do anything. For love nor money, I can't stop pulseaudio from doing this, but have at least discovered that the window manager's "audible bell" setting DOES take effect if it is applied AFTER pulseaudio has finished doing its thing. With Compiz, for example, this means that toggling 'General Options' -> 'Audible bell' in CCSM (System -> Preferences -> CompizConfig Settings Manager) off and then back on again restores normal bell behaviour!

Doing this manually after every boot is predictably annoying, but fortunately it can be scripted. For simplicity, I've put the workarounds for both bugs into the same executable script, ~/bin/sysbell_hacks, and added it to "Startup Applications" so that it runs as Gnome loads, after login. Here's the script:

"""
#!/bin/bash

 # Make sure gnome and pulseaudio have finished loading
sleep 30s

 # pcspkr kernel module insertion bug: remove (if not blacklisted) and reinsert the module
sudo modprobe -r pcspkr
sudo modprobe pcspkr

 # window manager setting override hack: toggle the audible_bell flag
gconftool-2 --set "/apps/compiz/general/allscreens/options/audible_bell" --type bool "false"
sleep 1s
gconftool-2 --set "/apps/compiz/general/allscreens/options/audible_bell" --type bool "true"
"""

As I said... hacky. This works (at least for me...) with compiz, but on the off-chance that something similar is happening with metacity, its users might just try replacing the compiz setting in the script above with "/apps/metacity/general/audible_bell", in both of the gconftool-2 commands. No promises! :)