Skip to content

Commit

Permalink
Merge pull request #1042 from kachick/kanata-escape
Browse files Browse the repository at this point in the history
Implement escape hatch for caps lock troubles
  • Loading branch information
kachick authored Jan 15, 2025
2 parents 14e191a + 17e174f commit 7424418
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
15 changes: 14 additions & 1 deletion config/keyboards/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,23 @@

## HWDB

TODO: UPDATE ME with extracting from NixOS Config
See [the definitions](https://github.com/search?q=repo%3Akachick%2Fdotfiles+extraHwdb&type=code)

## Kanata

Force exiting if I have faced to similar problems like GH-963

`Left Control` + `Space` + `Esc`

Then the process will die. You can restart it with `systemctl start kanata-all`.
Not just the `kanata`. You can check it with `systemctl list-unit-files "kanata*`.

```console
> systemctl list-unit-files "kanata*"
UNIT FILE STATE PRESET
kanata-all.service enabled ignored
```

## NixOS

It generates whole config from [partial config file](kanata.kbd).
Expand Down
11 changes: 8 additions & 3 deletions config/keyboards/kanata.kbd
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
;; (defcfg) ;; Enable this line except use via nix
(defcfg concurrent-tap-hold yes)

;; Required to specify keys which should be considered in tap-hold-press (=spc, tab for alt-spc, alt-tab)
;; See https://github.com/jtroo/kanata/blob/fc850fab9da7d0bf377e215f0b923062e037ff64/docs/config.adoc?plain=1#L142-L143
(defsrc caps lalt ralt spc tab)
(defsrc caps lalt ralt spc tab f1 a c)

(defvar
tap-timeout 200
Expand All @@ -13,8 +13,13 @@

(deflayermap (base)
;; Avoiding tap-hold for caps to make stable behavior
;; TODO: Add escape hatch for use of caps. See GH-963
caps lctl
lalt (tap-hold-press $tt $ht muhenkan lalt)
ralt (tap-hold-press $tt $ht henkan ralt)
)

;; Escape hatch for use of caps. See GH-963
(defchordsv2-experimental
;; Don't use caps for inputs combination
(f1 c a) caps 500 all-released ()
)
4 changes: 3 additions & 1 deletion nixos/desktop/kanata.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
# https://github.com/NixOS/nixpkgs/pull/354894
# https://github.com/NixOS/nixpkgs/pull/351675#issuecomment-2440047546
package = pkgs.unstable.kanata; # TODO: Use stable since nixos-25.05

keyboards = {
# Intentionally setting alt to henkan and muhenkan even in JIS layouts to consider my mis-typing
# tap-hold-press: tap-next in kmonad. See https://github.com/jtroo/kanata/issues/7#issuecomment-1196236726
all = {
config = builtins.readFile ../../config/keyboards/kanata.kbd;
# Don't use extraDefCfg to share same config with Windows and darwin
configFile = ../../config/keyboards/kanata.kbd;
};
};
};
Expand Down

0 comments on commit 7424418

Please sign in to comment.