<p>Debugging this took me a bit too long, so I want to write about the caveat.</p>
<p>My problem: My laptop does not have PageUp and PageDown keys, and many other
keyboards I use have similar deficiencies. And I use various environments and
various systems, some of which are shared with other people who don't need/want
my tweaks. IOW: I want something generic, but it must be confined to my user –
no system-wide daemon, no udev remapping. (I mostly ended up with these
solutions when I searched for a way to remap keys on Wayland.)</p>
<p>Requirements: xkbcommon implementation of XKB with utilities. It is quite
common these days (duh…), but you could probably just compile this yourself if
you don't have it.</p>
<divclass="section"id="the-tweaking">
<h2>The tweaking</h2>
<p>The <aclass="reference external"href="https://xkbcommon.org/doc/current/user-configuration.html">xkbcommon guide</a> tells us that we
can inspect the files in <aclass="footnote-reference"href="#lazy"id="footnote-reference-1">[1]</a><ttclass="docutils literal">/usr/share/X11/xkb</tt> for the source files
and just write our bits to <ttclass="docutils literal"><spanclass="pre">~/.config/xkb/symbols/ledoian</span></tt>. In particular, I
added this snippet to remap keyboard brightness controls to PageUp/Down:</p>
<preclass="literal-block">
partial
xkb_symbols "qs" {
key <I238> {[ Prior ]};
key <I237> {[ Next ]};
};
</pre>
<p>The key identifiers are taken e.g. from <ttclass="docutils literal">xkbcli <spanclass="pre">interactive-wayland</span></tt>.
However, this is KcCGST <aclass="footnote-reference"href="#kccgst-vs-rmlvo"id="footnote-reference-2">[2]</a> description, but layouts are
configured using RMLVO, so I need to define an option and tell what it should
do. The guide wants me to create <ttclass="docutils literal"><spanclass="pre">~/.config/xkb/rules/evdev</span></tt> with:</p>
<preclass="literal-block">
! option = symbols
ledoian:qs = +ledoian(qs)
! include %S/evdev
</pre>
<p>Now I just add <ttclass="docutils literal">ledoian:qs</tt><aclass="footnote-reference"href="#option-vs-symbol"id="footnote-reference-3">[3]</a> to my keyboard configuration
and… it does not work. For this, at all, but if I remap e.g. the L key, that
gets applied. The problem? That included file says that the default keyboard
model always includes <ttclass="docutils literal">inet(evdev)</tt> symbols. Those symbols set the default
meaning of the keys, but since that got applied later, it overrides my tweak.</p>
<p>Solution: first include, then add my option.</p>
<p>How to debug: read stuff that <ttclass="docutils literal">xkbcli <spanclass="pre">compile-keymap</span><spanclass="pre">--verbose</span></tt> tells you
(pass your config as <ttclass="docutils literal"><spanclass="pre">--layout</span></tt>, <ttclass="docutils literal"><spanclass="pre">--variant</span></tt>, <ttclass="docutils literal"><spanclass="pre">--options</span></tt>, …). At the top
it says what it does:</p>
<preclass="literal-block">
xkbcommon: DEBUG: Include path added: /home/ledoian/.config/xkb
xkbcommon: DEBUG: Include path added: /usr/share/X11/xkb
xkbcommon: DEBUG: Compiling from RMLVO: rules 'evdev', model 'pc105', layout 'us', variant '(null)', options '(null)'
<tr><tdclass="label"><aclass="fn-backref"href="#footnote-reference-3">[3]</a></td><td>While both this example and the <aclass="reference external"href="https://www.freedesktop.org/wiki/Software/XKeyboardConfig/">upstream</a> layouts name
the symbols and options similarly, I think they don't need to be related –
you should be able to put whatever you want in your options to the left of
<ttclass="docutils literal">=</tt>, the right hand side is the name of the symbol file and if a
non-default layout from that file is used, its name is put in the