A
A
Anton Karmanov2016-08-06 13:05:44
vim
Anton Karmanov, 2016-08-06 13:05:44

How to hang several additional characters on one key in the xkb config?

I'm using the xkb config which adds some vim or emacs style keyboard shortcuts for [CapsLock]. Scrolling pages in emacs mode remains an unsolved problem, because you need to bind [PgDn] and [PgUp] to [v] and [V] respectively. If you put [PgDn] on the third level, and [PgUp] on the fourth level, then it will work, but scrolling up will select everything starting from the cursor, since [Shift] is considered to be clamped. A combination with [Alt] would do, but I don't know how to implement it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
Zr, 2016-08-06
@py_tosha

If in keywords, then RedirectKey(key=..., clearmods). And if on the right side (what to translate into) there is always one key, and not a chord, then in general it makes sense to describe your entire scheme as overlay- this is much cleaner.
[from comments]> and could you give a couple of examples
For overlay - yes, please, here is an excerpt from somewhere in ~/.xkb.d/. And although I actually don’t use it, because:
- Firstly, the commented out part ( C-wC-backspace) worked unstable for me - and in the most bizarre way - at the first compilation it gave some kind of error, and after a series of dances with a tambourine - it was still going to worked.
- And secondly, I found that I don’t have any need for all this, because I have some of the most actively used programs: GNU Emax and Icewizel (Firefox), sometimes a number of programs in the terminal emulator. With the first - it is clear; Icewizel - on the GTK, where keyboard shortcuts can be configured much more flexible than stupid context-independent translation (and the basic emax keyboard shortcuts for the GTK are supplied out of the box); most interactive programs that run in a terminal emulator use (or can use) GNU Readline, which is still better than GTK.
But, as I remember, everything else should work here.

partial modifier_keys
xkb_symbols "lctrl_overlay" {
    replace key <LCTL> {
            type = "PC_CONTROL_LEVEL2",
            symbols = [ Control_L, NoSymbol ],
            actions = [ SetMods(modifiers=Control),
                        SetControls(controls=overlay1) ]
    };
};

partial modifier_keys
xkb_symbols "rctrl_overlay" {
    replace key <RCTL> {
            type = "PC_CONTROL_LEVEL2",
            symbols = [ Control_R, NoSymbol ],
            actions = [ SetMods(modifiers=Control),
                        SetControls(controls=overlay1) ]
    };
};

default partial modifier_keys
xkb_symbols "ctrl_overlay" {
    include "nav(lctrl_overlay)"
    include "nav(rctrl_overlay)"
};

partial modifier_keys
xkb_symbols "lctrl_lock_overlay" {
    replace key <LCTL> {
            type = "PC_CONTROL_LEVEL2",
            symbols = [ Control_L, NoSymbol ],
            actions = [ SetMods(modifiers=Control),
                        LockControls(controls=overlay1) ]
    };
};

partial modifier_keys
xkb_symbols "rctrl_lock_overlay" {
    replace key <RCTL> {
            type = "PC_CONTROL_LEVEL2",
            symbols = [ Control_R, NoSymbol ],
            actions = [ SetMods(modifiers=Control),
                        LockControls(controls=overlay1) ]
    };
};

default partial modifier_keys
xkb_symbols "ctrl_lock_overlay" {
    include "nav(lctrl_lock_overlay)"
    include "nav(rctrl_lock_overlay)"
};

partial modifier_keys
xkb_symbols "hwdm" {
    // key <I250> { symbols = [ NoSymbol ] };
    // key <I250> {
    //     actions = [ RedirectKey(key=<BKSP>, mods=Control) ]
    // };
    key <LatH> { overlay1 = <BKSP> };
    key <LatW> { overlay1 = <I250> };
    key <LatD> { overlay1 = <DELE> };
    key <LatM> { overlay1 = <LNFD> };
};

partial modifier_keys
xkb_symbols "pbnf" {
    key <LatP> { overlay1 = <UP> };
    key <LatB> { overlay1 = <LEFT> };
    key <LatN> { overlay1 = <DOWN> };
    key <LatF> { overlay1 = <RGHT> };
};

partial modifier_keys
xkb_symbols "ijkl" {
    key <LatI> { overlay1 = <UP> };
    key <LatJ> { overlay1 = <LEFT> };
    key <LatK> { overlay1 = <DOWN> };
    key <LatL> { overlay1 = <RGHT> };
};

partial modifier_keys
xkb_symbols "khjl" {
    key <LatK> { overlay1 = <UP> };
    key <LatH> { overlay1 = <LEFT> };
    key <LatJ> { overlay1 = <DOWN> };
    key <LatL> { overlay1 = <RGHT> };
};

partial modifier_keys
xkb_symbols "zxcv" {
    key <LatZ> { overlay1 = <UNDO> };
    key <LatX> { overlay1 = <CUT> };
    key <LatC> { overlay1 = <COPY> };
    key <LatV> { overlay1 = <PAST> };
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question