;; Linux kmonad.kbd

(defcfg
    ;; The device file to read input from, under /dev/input/by-id
    ;; Can be obtained by running `sudo evtest` and selecting the device
    input (device-file "/dev/input/by-id/usb-Razer_Razer_BlackWidow_V3_Mini-event-kbd")
    ;; The device file to write output to, under /dev/uinput
    output (uinput-sink "KMonad")
    ;; fallthrough - boolean{false}, allows user to only specify certain parts of a layout
    ;; Others remain unchanged
    fallthrough true
    ;; allow-cmd - boolean{false}, allowing to run shell commands
    allow-cmd true
    ;; cmp-seq - key{RightAlt}, So called `AltGr` key
    cmp-seq ralt
    ;; cmp-seq-delay - NN{0} - delay between each pressed key in a compose-key sequence
    cmp-seq-delay 0
    ;; ;; key-seq-delay - NN{5} - delay between each outputted key event
    ;; key-seq-delay 5
    ;; implicit-around - {around} - Not sure what this does
    implicit-around around
    )

;; Razer BlackWidow V3 Mini - 65% ANSI layout
;; This layer is a reference default layer, won't be used directly
;; The first `deflayer' below will be the default layer
;; (defsrc
;;   esc  1    2    3    4    5    6    7    8    9    0    -    =    bspc del
;;   tab  q    w    e    r    t    y    u    i    o    p    [    ]    \    pgup
;;   caps a    s    d    f    g    h    j    k    l    ;    '    ret       pgdn
;;   lsft z    x    c    v    b    n    m    ,    .    /    rsft   up      ins
;;   lctl lmet lalt           spc            ralt     rctl     left down  right
;; )

(defsrc
  grv  1    2    3    4    5    6    7    8    9    0    -    =    \   del
  tab  q    w    f    p    g    j    l    u    y    ;    [    ]    bspc pgup
  caps a    r    s    t    d    h    n    e    i    o    '    ret       pgdn
  lsft z    x    c    v    b    k    m    ,    .    /    rsft   up      ins
  lctl lmet lalt         spc            ralt     rctl     left down  right
)

;; (deflayer name
;;   _  _    _    _    _    _    _    _    _    _    _    _    _    _ _
;;   _  _    _    _    _    _    _    _    _    _    _    _    _    _    _
;;   _ _    _    _    _    _    _    _    _    _    _    _    _       _
;;   _ _    _    _    _    _    _    _    _    _    _    _   _      _
;;   _ _ _           _            _     _     _ _  _
;; )

;; CapsLock -> Esc when tapped, Ctrl when held
(defalias mo1 (tap-next-release esc lctl))
(defalias spctl (tap-next-release spc (layer-toggle spcl)))


;; Colemak
(deflayer colemak
  grv  1    2    3    4    5    6    7    8    9    0    -    =    \   del
  tab  q    w    f    p    g    j    l    u    y    ;    [    ]    bspc pgup
  @mo1 a    r    s    t    d    h    n    e    i    o    '    ret       pgdn
  lsft z    x    c    v    b    k    m    ,    .    /    rsft   up      ins
  lctl lmet lalt         @spctl            ralt     rctl     left down  right
)

(deflayer qwerty
  esc  1    2    3    4    5    6    7    8    9    0    -    =    bspc del
  tab  q    w    e    r    t    y    u    i    o    p    [    ]    \    pgup
  @mo1 a    s    d    f    g    h    j    k    l    ;    '    ret       pgdn
  lsft z    x    c    v    b    n    m    ,    .    /    rsft   up      ins
  lctl lmet lalt         @spctl            ralt     rctl     left down  right
)


;; SPACE Layer
(deflayer spcl
  grv f1   f2   f3   f4   f5   f6   f7   f8   f9   f10   f11  f12    \    del
  tab  q    w    f    p    g    j    l    u    y    ;   pgup  pgdn    bspc pgup
  @mo1 a    r    s    t    d    left down up right    end    '    ret       pgdn
  lsft z    x    c    v    b    home    m    ,    .    /    rsft   up      ins
  lctl lmet lalt           spc            ralt     rctl     left down  right
)

;; (deflayer spcl
;;   esc  1    2    3    4    5    6    7    8    9    0    -    =    bspc del
;;   tab  q    w    e    r    t    y    u    i    o    p    [    ]    \    pgup
;;   @mo1 a    s    d    f    g    left down up right    ;    '    ret       pgdn
;;   lsft z    x    c    v    b    n    m    ,    .    /    rsft   up      ins
;;   lctl lmet lalt         spc            ralt     rctl     left down  right
;; )
