Comment 50 for bug 486154

Revision history for this message
Grondr (grondr) wrote :

Okay, for anyone who's trying to restore the pre-Karmic behavior of beeping, here's what to do. It will give you old-style motherboard beeps when you hit rubout at an empty shell prompt in gnome-terminal or at an empty password prompt during gdm login; it will make xkbbell work; all rate-limiting of bells will be disabled; and bells will be emitted instantly, and not after a sluggish wait of up to a second.

INSTALL PATCH:
(a) [sudo] apt-get build-dep metacity
(b) apt-get source metacity; cd metacity-2.28.0
(c) Apply the patch or hand-edit src/core/bell.c
(d) [sudo] debchange -v 1:2.28.0-0ubuntu1+dontstealbell "Don't steal X bell events." [Note 0]
(e) [sudo] debuild -rfakeroot binary; dpkg -i ../*.deb; killall metacity
(f) metacity & in any shell on your X server screen [-not- via ssh from somewhere else!] metacity runs as you, not root.

FIX DEFAULTS:
(a) alsamixer; raise Beep to 100%; unmute. [Apparently unnecessary for motherboard beeping, but if you want anything -else- to beep later using PulseAudio or by playing bell.ogg or whatever, you'll probably have to do this. Safer just to raise it now.] Make sure your Master is also up and unmuted, but it presumably is or you'd never hear anything at all.
(b) Edit profile(s) in gnome-terminal and ensure that "Terminal bell" is checked.
(c) gconf-editor: desktop -> gnome -> peripherals -> keyboard. Change "bell_mode" from off to on.
(d) gconf-editor: apps -> metacity -> general. Change "audible_bell" from off to on.

ON EVERY BOOT:
(a) [sudo] modprobe pcspkr [put this in rc.local or somesuch] [Note 1] [Note 2]

ON EVERY LOGIN OR GDM RESTART:
(a) xset b [Note 3] [Note 4]

[Note 0] This will keep your private version of this from being overwritten if a newer version is released. Of course, if a newer version is released that fixes this bug, do "debchange -v 1:2.28.0-0ubuntu1" to declare that what's installed is what used to be installed (this won't -actually- change what's installed) and then update (which will then update it).
[Note 1] If you want the squarewave bell to come out of line-out and not the motherboard beeper, don't bother doing this.
[Note 2] It does -not- work to just comment-out the blacklisting of pcspkr in /etc/modprobe.d/blacklist.conf and reboot; this is because Karmic appears to load this kernel module too early for it to take effect, so you have to wait until the kernel's done loading things and then rmmod it and modprobe it again. Easier (until this bug is fixed) to just leave it blacklisted and just modprobe it in rc.local or in any other init that runs near the end of boot. [Bug #398161]
[Note 3] Every time gdm is restarted, -something- does the equivalent of "xset b 0". (I'd really like to find the guilty party.)
[Note 4] Note also that, due to -another- bug, "xset b 100" does -not- make the volume 100%---instead, it increases the bell -duration-! So "xset b" is a reasonable compromise: it sets the so-called bell volume to 50% and an acceptable duration. [Bug #280767]

P.S. Even once all the actual -bugs- are fixed, I consider the sheer number of places that must be hit to make bells work---e.g., for a rubout at a shell prompt to warn you, or for Emacs to be able to -say- something when you ^G or it gets an error---to be (at least!) a documentation bug, and (really) evidence of poor design. There should not be so many fingers in the pie here.