[linux] KMonad: Cleanly and Efficiently Remap *ANY* Key on your P2Max!

The KMonad project is fairly new, but when I saw it, I immediately thought about how much it could help GPD owners who use linux.

Essentially, you define you keyboard using human readable key definitions. Below is my SRC for the P2Max.

SRC
    esc     1       2       3       4       5       6       7       8       9       0       bspc
    tab     q       w       e       r       t       y       u       i       o       p       \
    caps    a       s       d       f       g       h       j       k       l       ret
    lsft    z       x       c       v       b       n       m       ,       .       /       '
    lctl    lmet    spc     ralt    up      left    down    rght    pgup    pgdn    keyhome keyend
    `       -       =       [       ]       del     prnt

Keys can be organized in any sort of way, but they must match your default “layer” (which is how you define what you wish for your keymap to actually look like). This is my layer:

LAYER josh
    @esc    1       2       3       4       5       6       7       8       9       @0      bspc
    tab     q       w       e       r       t       y       u       i       o       p       @\
    @xcp    a       s       d       f       g       h       j       k       l       @ret
    lsft    z       x       c       v       b       n       m       @,      @.      /       '
    lctl    lmet    @spc    ralt    up      left    down    rght    pgup    pgdn    keyhome keyend
    `       -       =       [       ]       del     prnt

The first thing, you’ll note is some keys have the at symbol in front of them. KMonad’s goal is to mimic the robust functionality of the QMK firmware, so KMonad allows defining “special keys” which operate a bit differently. These are my special key definitions (with some notes):

// "TH" = "tap hold"
// this definition states that tapping the ESC key for < 150ms
// acts as an escape and holding for anything > 150ms generates the ` character
// (which is a common place for the tick character on a US keyboard layout)
@esc = TH 150 esc             `

// "MT" = "multi tap"
// this definition is weird, but essentially allows for double tapping the 0 key to toggle
// CAPS lock. hey - you *might* need it?
@0 = MT 0 300 caps

// this definition makes it so that when the \ key is tapped once, it acts as the \ key; if
// tapped twice, generate a - (hyphen), tapped three times, generate an _ (underscore)
// and tapped four times, it generates a plus character
@\ = MT \ 300 - 175 = 175 __ 175 +

// "TN" = "tap next"
// this definition switches CAPS to act as an ESC when tapped and a CTRL when held
@xcp = TN esc lctl

// definition (also weird and still being tested) generates a return/enter when tapped,
// a colon when double tapped and a semi-colon when triple tapped
@ret = MT ret 300 : 175 ;

// these should be self explanatory
@, = TH 300 , [
@. = TH 300 . ]

// this key, when held, toggles on the "gpdish" layer which is mainly the
// keys that would require the fn to operate normally. IMO, the spacebar is
// easier to hold than fn
@spc = TH 250 spc LT-gpdish

And that “gpdish” layer (_ = empty/undefined key)

LAYER gpdish ~ anchor esc
    f1      f2      f3      f4      f5      f6      f7      f8      f9      f10     f11     f12
    _       _       keymute vold    volu    `       ~       __      -       +       =       _
    _       _       _       _       _       _       _       _       _       _       _
    _       brdn    brup    _       {       }       [       ]       _       _       _       _
    _       _       _       _       pgup    keyhome pgdn    keyend  _       _       _       _
    _       _       _       _       _       _       _

This is a Gist for the entire KMonad config.

5 Likes

I am a huge fan of QMK! this is awesome thank you for sharing josh

2 Likes