git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

protocol/river-xkb-config-v1.xml (10.9K)

  1 <?xml version="1.0" encoding="UTF-8"?>
  2 <protocol name="river_xkb_config_v1">
  3   <copyright>
  4     SPDX-FileCopyrightText: © 2026 Isaac Freund
  5     SPDX-License-Identifier: MIT
  6 
  7     Permission is hereby granted, free of charge, to any person obtaining a copy
  8     of this software and associated documentation files (the "Software"), to
  9     deal in the Software without restriction, including without limitation the
 10     rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 11     sell copies of the Software, and to permit persons to whom the Software is
 12     furnished to do so, subject to the following conditions:
 13 
 14     The above copyright notice and this permission notice shall be included in
 15     all copies or substantial portions of the Software.
 16 
 17     THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 18     IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 19     FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 20     AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 21     LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 22     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 23     IN THE SOFTWARE.
 24   </copyright>
 25 
 26   <description summary="configure xkbcommon keyboards">
 27     This protocol allow a client to set the xkbcommon keymap of individual
 28     keyboard input devices. It also allows switching between the layouts of a
 29     keymap and toggling capslock/numlock state.
 30 
 31     The key words "must", "must not", "required", "shall", "shall not",
 32     "should", "should not", "recommended", "may", and "optional" in this
 33     document are to be interpreted as described in IETF RFC 2119.
 34   </description>
 35 
 36   <interface name="river_xkb_config_v1" version="2">
 37     <description summary="xkb config global interface">
 38       Global interface for configuring xkb devices.
 39 
 40       This global should only be advertised if river_input_manager_v1 is
 41       advertised as well.
 42     </description>
 43 
 44     <enum name="error">
 45       <entry name="invalid_destroy" value="0"/>
 46       <entry name="invalid_format" value="1"/>
 47     </enum>
 48 
 49     <request name="stop">
 50       <description summary="stop sending events">
 51         This request indicates that the client no longer wishes to receive
 52         events on this object.
 53 
 54         The Wayland protocol is asynchronous, which means the server may send
 55         further events until the stop request is processed. The client must wait
 56         for a river_xkb_config_v1.finished event before destroying this object.
 57       </description>
 58     </request>
 59 
 60     <event name="finished">
 61       <description summary="the server has finished with the object">
 62         This event indicates that the server will send no further events on this
 63         object. The client should destroy the object. See
 64         river_xkb_config_v1.destroy for more information.
 65       </description>
 66     </event>
 67 
 68     <request name="destroy" type="destructor">
 69       <description summary="destroy the river_xkb_config_v1 object">
 70         This request should be called after the finished event has been received
 71         to complete destruction of the object.
 72 
 73         It is a protocol error to make this request before the finished event
 74         has been received.
 75 
 76         If a client wishes to destroy this object it should send a
 77         river_xkb_config_v1.stop request and wait for a
 78         river_xkb_config_v1.finished event. Once the finished event is received
 79         it is safe to destroy this object and any other objects created through
 80         this interface.
 81       </description>
 82     </request>
 83 
 84     <enum name="keymap_format">
 85       <entry name="text_v1" value="1" summary="XKB_KEYMAP_FORMAT_TEXT_V1"/>
 86       <entry name="text_v2" value="2" summary="XKB_KEYMAP_FORMAT_TEXT_V2"/>
 87     </enum>
 88 
 89     <request name="create_keymap">
 90       <description summary="create a keymap object">
 91         The server must be able to mmap the fd with MAP_PRIVATE.
 92         The server will fstat the fd to obtain the size of the keymap.
 93         The client must not modify the contents of the fd after making this request.
 94         The client should seal the fd with fcntl.
 95       </description>
 96       <arg name="id" type="new_id" interface="river_xkb_keymap_v1"/>
 97       <arg name="fd" type="fd"/>
 98       <arg name="format" type="uint" enum="keymap_format"/>
 99     </request>
100 
101     <event name="xkb_keyboard">
102       <description summary="new xkb keyboard">
103         A new xkbcommon keyboard has been created. Not every
104         river_input_device_v1 is necessarily an xkbcommon keyboard as well.
105       </description>
106       <arg name="id" type="new_id" interface="river_xkb_keyboard_v1"/>
107     </event>
108   </interface>
109 
110   <interface name="river_xkb_keymap_v1" version="2">
111     <description summary="xkbcommon keymap">
112       This object is the result of attempting to create an xkbcommon keymap.
113     </description>
114 
115     <request name="destroy" type="destructor">
116       <description summary="destroy the keymap object">
117         This request indicates that the client will no longer use the keymap
118         object and that it may be safely destroyed.
119       </description>
120     </request>
121 
122     <event name="success">
123       <description summary="keymap creation succeeded">
124         The keymap object was successfully created and may be used with the
125         river_xkb_keyboard_v1.set_keymap request.
126       </description>
127     </event>
128 
129     <event name="failure">
130       <description summary="keymap creation failed">
131         The compositor failed to create a keymap from the given parameters.
132 
133         It is a protocol error to use this keymap object with
134         river_xkb_keyboard_v1.set_keymap.
135       </description>
136       <arg name="error_msg" type="string"/>
137     </event>
138   </interface>
139 
140   <interface name="river_xkb_keyboard_v1" version="2">
141     <description summary="xkbcommon keyboard device">
142       This object represent a physical keyboard which has its configuration and
143       state managed by xkbcommon.
144     </description>
145 
146     <enum name="error">
147       <entry name="invalid_keymap" value="0"/>
148     </enum>
149 
150     <request name="destroy" type="destructor">
151       <description summary="destroy the xkb keyboard object">
152         This request indicates that the client will no longer use the keyboard
153         object and that it may be safely destroyed.
154       </description>
155     </request>
156 
157     <event name="removed">
158       <description summary="the xkb keyboard is removed">
159         This event indicates that the xkb keyboard has been removed.
160 
161         The server will send no further events on this object and ignore any
162         request (other than river_xkb_keyboard_v1.destroy) made after this event
163         is sent. The client should destroy this object with the
164         river_xkb_keyboard_v1.destroy request to free up resources.
165       </description>
166     </event>
167 
168     <event name="input_device">
169       <description summary="corresponding river input device">
170         The river_input_device_v1 corresponding to this xkb keyboard. This event
171         will always be the first event sent on the river_xkb_keyboard_v1 object,
172         and it will be sent exactly once.
173       </description>
174       <arg name="device" type="object" interface="river_input_device_v1"/>
175     </event>
176 
177     <request name="set_keymap">
178       <description summary="set the keymap">
179         Set the keymap for the keyboard.
180 
181         Setting a keymap will reset all layout/modifier state.
182 
183         It is a protocol error to pass a keymap object for which the
184         river_xkb_keymap_v1.success event was not received.
185       </description>
186       <arg name="keymap" type="object" interface="river_xkb_keymap_v1"/>
187     </request>
188 
189     <request name="set_layout_by_index">
190       <description summary="set the active layout by index">
191         Set the active layout for the keyboard's keymap. Has no effect if the
192         layout index is out of bounds for the current keymap.
193       </description>
194       <arg name="index" type="int"/>
195     </request>
196 
197     <request name="set_layout_by_name">
198       <description summary="set the active layout by name">
199         Set the active layout for the keyboard's keymap. Has no effect if there
200         is no layout with the give name for the keyboard's keymap.
201       </description>
202       <arg name="name" type="string"/>
203     </request>
204 
205     <event name="layout">
206       <description summary="currently active layout">
207         The currently active layout index and name. The name arg may be null if
208         the active layout does not have a name.
209 
210         This event is sent once when the river_xkb_keyboard_v1 is created and
211         again whenever the layout changes.
212       </description>
213       <arg name="index" type="uint"/>
214       <arg name="name" type="string" allow-null="true"/>
215     </event>
216 
217     <request name="capslock_enable">
218       <description summary="enable capslock">
219         Enable capslock for the keyboard.
220       </description>
221     </request>
222 
223     <request name="capslock_disable">
224       <description summary="disable capslock">
225         Disable capslock for the keyboard.
226       </description>
227     </request>
228 
229     <event name="capslock_enabled">
230       <description summary="capslock is currently enabled">
231         Capslock is currently enabled for the keyboard.
232 
233         This event is sent once when the river_xkb_keyboard_v1 is created and
234         again whenever the capslock state changes.
235       </description>
236     </event>
237 
238     <event name="capslock_disabled">
239       <description summary="capslock is currently disabled">
240         Capslock is currently disabled for the keyboard.
241 
242         This event is sent once when the river_xkb_keyboard_v1 is created and
243         again whenever the capslock state changes.
244       </description>
245     </event>
246 
247     <request name="numlock_enable">
248       <description summary="enable numlock">
249         Enable numlock for the keyboard.
250       </description>
251     </request>
252 
253     <request name="numlock_disable">
254       <description summary="disable numlock">
255         Disable numlock for the keyboard.
256       </description>
257     </request>
258 
259     <event name="numlock_enabled">
260       <description summary="numlock is currently enabled">
261         Numlock is currently enabled for the keyboard.
262 
263         This event is sent once when the river_xkb_keyboard_v1 is created and
264         again whenever the numlock state changes.
265       </description>
266     </event>
267 
268     <event name="numlock_disabled">
269       <description summary="numlock is currently disabled">
270         Numlock is currently disabled for the keyboard.
271 
272         This event is sent once when the river_xkb_keyboard_v1 is created and
273         again whenever the numlock state changes.
274       </description>
275     </event>
276 
277     <event name="done" since="2">
278       <description summary="all information has been sent">
279         This event is sent after all information about the keyboard has been
280         sent.
281 
282         This allows changes to one or more river_xkb_keyboard_v1 properties to
283         be seen as atomic, even if they happen via multiple events.
284       </description>
285     </event>
286   </interface>
287 </protocol>