[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How bind "Super" key *all by itself* to a function?

From: Yuri Khan
Subject: Re: How bind "Super" key *all by itself* to a function?
Date: Mon, 19 Jan 2015 16:08:00 +0700

[Damn Gmail. Its Send button is too near the “show quote” button and
too high-contrast.]

On Mon, Jan 19, 2015 at 1:35 PM, Rusi <> wrote:

>> However, you can use XKB (in X) and/or loadkeys (in tty) to map the
>> Windows key to produce a different keycode such as F13, and then bind
>> that to any function you like.
> Do you have a simple howto on that? [XKB]
> With xmodmap it was at least conceivable
> Xkb is too much of a dragon
> eg Say I have a broken ~ key and I want to make F12 generate ~

Not quite qualifies as “simple” but not very complicated.

* Find the XKB data directory. [Normally, this is /usr/share/X11/xkb.]
* In its “keycodes” subdirectory, create a file that is unlikely to be
overwritten by a future version of XKB (e.g. by prefixing it with your
initials). [Let’s name it “rusi” for the sake of this example.]
* In this file, paste the following:

xkb_keycodes "f12tilde" {
    # remappings go here…

# you can have multiple remapping sections
# and activate any subset thereof, just add more
# xkb_keycodes "some_name" {
#   # …
# };

Each remapping takes the form: <KEYNAME> = KEYCODE;

Refer to the existing entries in the section “default xkb_keycodes
"evdev"” for key names and codes.

For keyname, find the name of the key you want to generate. In your
case, it’s <TLDE>.

For keycode, find the numeric code of the key you want to remap. In
your case, it’s the code which is normally bound to <FK12>, namely,


    <TLDE> = 96;

* Now that you have a keycodes section of your own, make a
corresponding option. In the rules/evdev file, find the following

! option = keycodes

In that section, add something like:

  rusi:f12tilde = +rusi(f12tilde)

Here, the form on the right refers to the keycodes filename and
section, and the name on the left specifies the option name.

* Next, you want your X server to pick up this option. You can do it
system-wide or per-user; I’ll describe the system-wide setup because I
find it easier and less DE-specific.
* In the /usr/share/X11/xorg.conf.d directory [or its equivalent on
your system], create a uniquely named file [e.g.

Section "InputClass"
    Identifier "Keyboard layouts"
    Driver "evdev"
    Option "XkbOptions" "rusi:f12tilde"
    Option "AutoServerLayout" "on"
    MatchIsKeyboard "on"
    MatchDevicePath "/dev/input/event*"

In the XkbOptions line, refer to the option name you added to rules/evdev.

Next time you boot X or plug in a keyboard, it should use your customization.

You can check the current set of XKB options by executing the
following command in a terminal emulator within an X session:

$ setxkbmap -query


Legend has it that there is a possibility of using xkbcomp(1) on a
user-specific configuration file, but I never learned that;
system-wide is good enough for me.

One caveat: whenever you update the package that contains the
rules/evdev file, it may be overwritten and you might have to re-add
your option line.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]