• You are not logged in.
  • Index
  • Technical
  • Map ctrl+key different than key in linux/xkb

    Map ctrl+key different than key in linux/xkb

    • Started by data5
    • 7 Replies:
    • Reputation: 0
    • Registered: 24-Jan-2016
    • Posts: 7

    I have used wide/angle/dh colemak for some time in windows with qwerty virtual keys and finds it working perfectly. I want to do the same in linux i.e. have qwertys ctrl+key behavior but colemak layout.
    I often switch between colemak and qwerty so I would prefer to have the physical key mapped so that it don't break qwerty e.g. m:0x4 + c:54 is better than control + c.

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Not sure how Linux ctrl keys are implemented, really. Sorry.

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 0
    • Registered: 24-Jan-2016
    • Posts: 7

    I didn't know that Norwegians was the Canadians of Scandinavia :)
    //svenne

    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Heh, we're not. I'm just that guy who's had my head so far down into the Linux inner workings that I feel I should've had an answer for you. But I don't.

    Nu jävlar! :-)

    Last edited by DreymaR (06-Jun-2016 14:41:59)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
    • Reputation: 23
    • From: Belgium
    • Registered: 26-Feb-2008
    • Posts: 482

    I'm not aware of a proper way to do this with xkb either, since Ctrl acts as a modifier key in X11 and does not enable an extra "character plane" like Shift and AltGr do.

    But I found this Dvorak-Qwerty tool for X11 that "grabs" the Ctrl key combinations and modifies them to the appropriate Qwerty-mapped Ctrl sequences, using low level XGrabKey and XSendEvent calls:
    https://github.com/kentonv/dvorak-qwerty
    You can easily adjust the kDvorak character array in the source code to your own layout.

    Please let us know if it works for you.

    Last edited by ghen (07-Jun-2016 10:26:53)
    Offline
    • 0
    • Reputation: 0
    • Registered: 24-Jan-2016
    • Posts: 7

    Thanks ghen, I have some busy days now but will surely try It soon.

    Offline
    • 0
    • Reputation: 0
    • Registered: 24-Jan-2016
    • Posts: 7

    I found out a way to use xkb for this, maybe you are interested @DreymaR https://github.com/ZeptByteS/dvorak-qwerty (not my work)

    I did some modifications to make it colemak+dh+wide+otherstuff at http://pastebin.com/3fLQyk0F
    Most of the modifications are in "dvorak-qwerty" at the buttom and not in "dvq-simplified", the syntax is "key <????> { [ NoSymbol, ctrlkey, shiftkey, NoSymbol, normalkey, altgrkey ] };"

    If alt is removed from /usr/share/X11/xkb/types/dvorak-qwerty modifiers to
    type "DVQ-SIMPLIFIED_ALPHA_NUMERIC"{
            modifiers= None+Shift+Lock+LevelThree+Control+Super;

    xbindkeys and xte can be used to map alt hotkeys
    http://pastebin.com/3zaxziVm

    Last edited by data5 (02-Jul-2016 11:20:23)
    Offline
    • 0
    • Reputation: 214
    • From: Viken, Norway
    • Registered: 13-Dec-2006
    • Posts: 5,364

    Piggybacking on other scan codes to achieve Ctrl-key compliance is beyond ugly, and will break modularity and my xkb models. I will not touch that, thank you. ;-)

    But nice for you if you can use it!

    Last edited by DreymaR (10-Jul-2016 21:55:33)

    *** Learn Colemak in 2–5 steps with Tarmak! ***
    *** Check out my Big Bag of Keyboard Tricks for Win/Linux/TMK... ***

    Offline
    • 0
      • Index
      • Technical
      • Map ctrl+key different than key in linux/xkb