Table of Contents


XkbBellEvent - Provides a function that initiates a bell event for the keyboard without ringing the bell


Bool XkbBellEvent
(Display *display, Window window, int percent, Atom name);


- display
connection to the X server
- window
the event window, or None
- percent,
relative volume, which can range from -100 to 100 inclusive
- name
a bell name, or NULL


The core X protocol allows only applications to explicitly sound the system bell with a given duration, pitch, and volume. Xkb extends this capability by allowing clients to attach symbolic names to bells, disable audible bells, and receive an event whenever the keyboard bell is rung. For the purposes of this document, the audible bell is defined to be the system bell, or the default keyboard bell, as opposed to any other audible sound generated elsewhere in the system. You can ask to receive XkbBellNotify events when any client rings any one of the following:

Return Values

The XkbBellEvent immediately returns False, if a compatible keyboard extension isn't present in the X server.


Xkb generates XkbBellNotify events for all bells except for those resulting from calls to XkbForceDeviceBell and XkbForceBell. To receive XkbBellNotify events under all possible conditions, pass XkbBellNotifyMask in both the bits_to_change and values_for_bits parameters to XkbSelectEvents.

The XkbBellNotify event has no event details. It is either selected or it is not. However, you can call XkbSelectEventDetails using XkbBellNotify as the event_type and specifying XkbAllBellNotifyMask in bits_to_change and values_for_bits. This has the same effect as a call to XkbSelectEvents.

The structure for the XkbBellNotify event type contains:

   typedef struct _XkbBellNotify {
       int            type;        /* Xkb extension base event code */
       unsigned long  serial;      /* X server serial number for event
       Bool           send_event;  /* True => synthetically generated */
       Display *      display;     /* server connection where event generated
       Time           time;        /* server time when event generated
       int            xkb_type;    /* XkbBellNotify */
       unsigned int   device;      /* Xkb device ID, will not be XkbUseCoreKbd

       int            percent;     /* requested volume as % of max */
       int            pitch;       /* requested pitch in Hz */
       int            duration;    /* requested duration in microseconds
       unsigned int   bell_class;  /* X input extension feedback class
       unsigned int   bell_id;     /* X input extension feedback ID */
       Atom           name;        /* "name" of requested bell */
       Window         window;      /* window associated with event */
       Bool           event_only;  /* False -> the server did not produce
a beep 
   } XkbBellNotifyEvent;
If your application needs to generate visual bell feedback on the screen when it receives a bell event, use the window ID in the XkbBellNotifyEvent, if present.

See Also

XkbChangeEnabledControls(3) , XkbDeviceBellEvent(3) , XkbForceBell(3) , XkbForceDeviceBell(3) , XkbSelectEventDetails(3) , XkbSelectEvents(3)

Table of Contents