Skip to content

Commit

Permalink
feat(kanata): add HRM-optimized navigation layer
Browse files Browse the repository at this point in the history
## HRM friendly S-tab/tab

S-tab and tab stay on the homerow while playing nice with Ctrl and Alt mods.

## Add cross-platform quit shortcut on HRM nav layer

- @qut → [Q]
- @pad → [W]

Rationale:
- @qut allows closing apps on any OS (C-q on Linux, A-f4 on Windows, etc.), optimizing muscular memory
- it is more coherent to map @qut on [Q]

## Map esc/del on [A]/[V]

The goal is to allow escaping and deleting using the left hand only.

## Media controls in funpad

Because funpad stands for fun!
Rationale: mod keys in the existing funpad are pointless with HRMs.
  • Loading branch information
fnuttens committed Oct 20, 2024
1 parent 2aa9171 commit b3d0337
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
52 changes: 52 additions & 0 deletions kanata/deflayer/navigation_vim_hrm.kbd
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
;; Vim-Navigation layer (optimized for home-row mods):
;; - right: Vim-like arrows on HJKL, home/end page up/down, mouse scroll
;; - left: Tab/Shift-Tab, prev/next, quit, esc, del
;; - top: Super-num (i3/sway) or Alt-num (browser), zoom in/out

;; The `lrld` action stands for "live reload". This will re-parse everything
;; except for linux-dev, i.e. you cannot live reload and switch keyboard devices.

(deflayer navigation
M-1 M-2 M-3 M-4 M-5 lrld M-6 M-7 M-8 M-9 M-0
@qut @pad bck fwd XX home pgdn pgup end @run
esc S-tab tab tab XX lft down up rght @fun
XX XX XX del XX _ @mwl @mwd @mwu @mwr XX
del _ esc
)

;; NumPad
(deflayer numpad
_ _ _ _ _ _ _ _ _ _ _
XX home up end pgup @/ @7 @8 @9 XX
XX lft down rght pgdn @- @4 @5 @6 @0
XX XX XX XX XX _ @, @1 @2 @3 @.
@std @nbs @std
)

;; function keys
(deflayer funpad
XX XX XX XX XX XX XX XX XX XX XX
f1 f2 f3 f4 XX XX prev pp next XX
f5 f6 f7 f8 XX XX vold volu mute _
f9 f10 f11 f12 XX XX XX brdn bru XX XX
_ _ _
)

(defalias
std (layer-switch base)
pad (layer-switch numpad)

fun (layer-while-held funpad)

;; Replace XX by the keyboard shortcut to quit applications on your OS.
;; qut C-q ;; [Command]-[Q]
qut XX ;; do nothing

;; Mouse wheel emulation
mwu (mwheel-up 50 120)
mwd (mwheel-down 50 120)
mwl (mwheel-left 50 120)
mwr (mwheel-right 50 120)
)

;; vim: set ft=lisp
1 change: 1 addition & 0 deletions kanata/kanata.kbd
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

(include deflayer/navigation.kbd) ;; ESDF on the left, NumPad on the right
;; (include deflayer/navigation_vim.kbd) ;; HJKL + NumPad on [Space]+[Q]
;; (include deflayer/navigation_vim_hrm.kbd) ;; HJKL + NumPad on [Space]+[W], optimized for home-row mods

;; Replace XX by the keyboard shortcut of your application launcher, if any.
;; Mapped on [Space]+[P] in both navigation layers.
Expand Down

0 comments on commit b3d0337

Please sign in to comment.