xkbbell
Control the keyboard bell sound
SYNOPSIS
xkbbell [-display display] [-force | -noforce] [-keyboard kbd_id] [-id id] [-bell bell_name] [-percent percent] [-pitch pitch] [-duration duration]
PARAMETERS
-display display
Specifies the X server display to connect to. If not specified, it defaults to the value of the DISPLAY environment variable.
-force
Forces the bell to ring, even if the keyboard bell is currently disabled by the X server's configuration (e.g., via xset b off).
-noforce
Only rings the bell if the keyboard bell is enabled in the X server's configuration. This is the default behavior.
-keyboard kbd_id
Specifies the ID of a particular keyboard device for which the bell event should be generated. Useful in multi-input device setups.
-id id
Similar to -keyboard, specifies the ID of a specific device to ring the bell for. This is a more general option that can apply to any input device that supports a bell.
-bell bell_name
Specifies a named bell to ring. This option is less commonly used and depends on the XKB configuration supporting named bells.
-percent percent
Sets the volume of the bell as a percentage from 0 (silent) to 100 (maximum volume). The actual perceived volume depends on system audio settings.
-pitch pitch
Sets the pitch of the bell in Hertz (Hz). A higher value indicates a higher-pitched sound.
-duration duration
Sets the duration of the bell sound in milliseconds (ms). A longer duration means a longer sound.
DESCRIPTION
xkbbell is a utility program for the X Window System that requests the X server to generate a keyboard bell event. This event can result in an audible sound, a visual flash on the screen, or both, depending on the X server's configuration and the user's settings. It is commonly used by applications to provide simple feedback or to signal an error condition to the user. While traditionally associated with an audible 'beep', modern X servers and desktop environments often translate the bell event into a visual flash or a more configurable system sound, allowing for a less intrusive user experience. The command provides options to control various aspects of the bell, such as its volume, pitch, and duration, as well as to force the bell even if it's otherwise disabled by user settings. It's an essential component for basic system feedback within an X environment.
CAVEATS
The actual audible or visual output of the bell is highly dependent on the X server's configuration and the desktop environment. If xset b off has been used, xkbbell will not produce a sound unless the -force option is used. In some modern desktop environments, the X bell event might be remapped to a theme-specific sound or a visual notification, potentially ignoring pitch, duration, or volume settings.
xkbbell is specific to the X Window System and will not work in a console-only Linux environment or on Wayland-based systems without an XWayland compatibility layer.
AUDIBLE VS. VISUAL BELL
Historically, the X keyboard bell primarily referred to an audible 'beep' from the system's internal speaker. However, with modern X servers and desktop environments, the bell event is often configured to produce a visual flash on the screen (e.g., flashing the window title bar or the entire screen briefly) or to play a system sound file through the audio system. This allows for more configurable and less intrusive feedback, especially on systems without an internal PC speaker or where an audible beep is undesirable.
HISTORY
xkbbell is part of the xkbutils package, which provides utilities for configuring and using the X Keyboard Extension (XKB). The XKB extension itself was introduced to provide a more flexible and powerful way to manage keyboard layouts and behavior within the X Window System, replacing the simpler traditional keyboard mapping. xkbbell emerged as a standard tool within this framework, allowing applications and users to reliably trigger the X server's bell event, evolving with the X server's capabilities to support both audible and visual bell feedback.