Figure out a way to avoid GTK apps making unpleasant beeping noises when run on Plasma
Closed, WontfixPublic

Description

The problem

On a non-Ubuntu-based distro that is running Plasma, open Firefox, hit Ctrl+F to search, and type "ffffffffff" or some other nonsense text that will not match anything.

Your speakers will emit a horrendous loud beeping sound, even if you have set the volume very low; it plays unless the speakers are explicitly muted. The sound makes you want to throw the computer out the window and irritates your spouse who's sitting next to you. If you're in a library or a lecture hall, you will annoy and disturb everyone else in the room, with potential social consequences. If you're wearing earbuds, it can be physically painful. I have personally experienced all of these things happening.

It happens because GTK apps emit the system bell in response to various conditions, and expect the window manager or desktop environment to intercept that signal and instead play a quieter, more pleasant notification sound. GNOME's Mutter does this, but KDE's KWin does not. See https://bugzilla.gnome.org/show_bug.cgi?id=781727 for details.

As a result, users of GTK apps in non-Mutter environments hear these unpleasant sounds a lot and suffer.

Potential solutions at the KDE level

  1. Set gtk-error-bell=0 in the Breeze GTK theme and have kde-gtk-config sync it into all the gtk-{2.0,3.0,4.0}/settings.ini files in ~/.config/. We used to do this, but it broke recently (https://bugs.kde.org/show_bug.cgi?id=435164) and is not really an ideal solution anyway since it can't fix the issue for people using any other GTK theme.
  2. Have KWin intercept the error bell signal and play a nicer sound, like Mutter does. This was vetoed by KWin's former maintainer a few years ago: https://bugs.kde.org/show_bug.cgi?id=381887. However perhaps it would be worth reconsidering?
  3. Do the above, but outside of KWin, via another daemon. Either kded, or a new one.

Potential solutions at the GTK level

  1. None; they are convinced that their approach is correct.

Potential solutions at the distro level

  1. Disable the system bell systemwide with echo "blacklist pcspkr" > /etc/modprobe.d/nobeep.conf. This is what Ubuntu does; see https://bugs.launchpad.net/ubuntu/+source/module-init-tools/+bug/77010. So Kubuntu and Neon users are not affected by the issue. However openSUSE and Arch do not want to make this change (I've asked them to; see https://bugzilla.opensuse.org/show_bug.cgi?id=1030936 and https://bugs.archlinux.org/task/53823) and I strongly suspect that Fedora would not want to either.
  2. Make GTK apps no longer emit system bells by setting gtk-error-bell=0 in all the gtk-{2.0,3.0,4.0}/settings.ini files in ~/.config/ or /etc/. This option suffers from the same problem as above: distros may not want to make the change.

Since GTK-level or distro-level solutions are not possible, it's up to us in KDE to somehow make this problem finally go away for our users.

ngraham created this task.May 27 2021, 9:10 PM
osezer added a subscriber: osezer.May 30 2021, 2:13 PM

Personally I agree with the KWin bug report that it doesn't belong in KWin, as this is primarily a notification/audio thing instead of a window management thing.

  1. Do the above, but outside of KWin, via another daemon. Either kded, or a new one.

This seems like the most sensible approach. Making a KDED module for this seems like it would be a fairly small and self-contained bit of code.

I just discovered the module-x11-bell PulseAudio module, which was just implemented in Pipewire's version 0.3.44.

This should be used by distros instead us us doing anything in our own KDED module.

ngraham closed this task as Wontfix.Jan 28 2022, 3:06 AM
ngraham moved this task from To Do to Abandoned on the Plasma board.
ngraham claimed this task.

Just updated from Fedora 35 to Fedora 37, now I hear the bell sound everywhere.
libpipewire-module-x11-bell module of PipeWire is not packaged as a separate package, and there's no easy way to disable its auto-load (as far as I know, Pipewire configuration file does not allow drop-in configuration to disable module loading).

Moreover, I could not disable the sound without unloading libpipewire-module-x11-bell by any means (mentioned here and elsewhere). KDE "Accessibility - Audible bell" doesn't work, Gnome's gsettings set org.gnome.desktop.sound event-sounds false and gsettings set org.gnome.desktop.wm.preferences audible-bell false doesn't work, GTK's gtk-error-bell=0 in GTK2 and GTK3 configuration file also doesn't work (I logged out and logged in after every change).
This happens at least in Firefox and Gajim.