Suppressing a modifier key on specific key presses

Rocky Backer rocky.backer at gmail.com
Sat Mar 7 04:46:01 PST 2015


Hi,

Here is my usecase: I want to send "<Super> + <F5>" when I press <F5> and
send "<F5>" when I press "<Super> + <F5>". All other modifier combinations
with <F5> key must be the same(as in normal behavior).

I have achieved most of this behavior with the xkb configurations listed
below. The only trouble I am facing is in the xkb_compatibility file. I am
trying to use the following code.

default partial
xkb_compatibility "ac_xmonad" {

  virtual_modifiers Super;
  interpret F5+Exactly(Super) {
    action = RedirectKey(keycode=<FK05>, clearmods=Super);
  };

};

But, "interpret F5+Exactly(Super)" doesn't seem to work. While testing. I
found that "interpret F5 {...};" works just fine. It is as if using
+Exactly(Super) doesn't capture the key.

I appreciate any help in form of clues as to what I am doing wrong. I also
welcome any other solution suggestions for my usecase scenario.

Here is a complete listing of the configurations that I am using as of now.

~/.xkb/keymap/xkb_ac_xmonad
-----------------------------------------------
 xkb_keymap {
    xkb_keycodes  { include "evdev+aliases(qwerty)"    };
    xkb_types     { include "complete+ac_xmonad"    };
    xkb_compat    { include "complete+ac_xmonad"    };
    xkb_symbols   { include "pc+us+inet(evdev)+ac_xmonad"    };
    xkb_geometry  { include "pc(pc104)"    };
};

~/.xkb/types/ac_xmonad
------------------------------------
default partial
xkb_types "ac_xmonad_fn" {
    virtual_modifiers Alt,Super;
    type "ACXMONADFN" {
        modifiers = Shift+Control+Alt+Super;
        map[None] = Level1;

        map[Shift] = Level2;
        preserve[Shift] = Shift;

        map[Control] = Level2;
        preserve[Control] = Control;

        map[Alt] = Level2;
        preserve[Alt] = Alt;

        map[Super] = Level2;
        preserve[Super] = Super;

        map[Control+Alt] = Level3;
        preserve[Control+Alt] = Control+Alt;

        map[Shift+Control+Alt] = Level2;
        preserve[Shift+Control+Alt] = Shift+Alt;

        level_name[Level1] = "Extra";
        level_name[Level2] = "Normal";
        level_name[Level3] = "Ctrl+Alt";
    };
};


~/.xkb/symbols/ac_xmonad
----------------------------------------
default partial
xkb_symbols "ac_xmonad_fn" {
    replace key <FK05> {
        type = "ACXMONADFN",
        symbols[Group1] = [ F25, F5, XF86_Switch_VT_5 ]
    };
};


~/.xkb/compat/ac_xmonad
---------------------------------------
default partial
xkb_compatibility "ac_xmonad" {
    virtual_modifiers Super;
    interpret F5+Exactly(Super) {
        action = RedirectKey(keycode=<FK05>, clearmods=Super);
    };
};

Thanks in advance.

Regards,
Rocky
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.x.org/archives/xorg/attachments/20150307/8c6af7ce/attachment.html>


More information about the xorg mailing list