Skip to content

Commit

Permalink
fix error while parsing ~{:any :key_code}~ as <from> section in rule
Browse files Browse the repository at this point in the history
  • Loading branch information
yqrashawn committed Oct 17, 2018
1 parent 79d6510 commit 4593f44
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.org
Expand Up @@ -2,6 +2,8 @@
All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/).

** Unreleased
*** Fixed
- error while parsing ~{:any :key_code}~ as <from> section in rule

[Unreleased]: https://github.com/yqrashawn/GokuRakuJoudo/compare/v0.1.10...HEAD

Expand Down
2 changes: 1 addition & 1 deletion src/karabiner_configurator/keys.clj
Expand Up @@ -131,6 +131,6 @@
result (if (and (not (:key_code result)) (nn? key)) (assoc result :key_code (name (parse-keycode key from-to))) result)
result (if (nn? ckey) (assoc result :consumer_key_code (name (parse-ckey ckey))) result)
result (if (nn? pkey) (assoc result :pointing_button (name (parse-pkey pkey))) result)
result (if (and (nn? any) (any any-key-keywords)) (assoc result :any (name any-key-keywords)) result)
result (if (and (nn? any) (any any-key-keywords)) (assoc result :any (name any)) result)
result (if (nn? mkey) (assoc result :mouse_key (parse-mkey mkey)) result)]
result))
18 changes: 16 additions & 2 deletions test/karabiner_configurator/rules_test.clj
Expand Up @@ -38,7 +38,11 @@
[:condi :chunkwm-move-mode :chunkwm-scale-mode]
[:l "/usr/local/bin/chunkc tiling::window --focus east"]]}
{:des "input source as condition"
:rules [[:a :a :us]]}])
:rules [[:a :a :us]]}
{:des "any keycode"
:rules [[{:any :key_code} :a]
[{:any :consumer_key_code} :a]
[{:any :pointing_button} :a]]}])

(def result [{:description "auto generated layer trigger key",
:manipulators [{:type "basic",
Expand Down Expand Up @@ -302,7 +306,17 @@
:input_source_id "com.apple.keylayout.US",
:language "en"}],
:type "input_source_if"}],
:type "basic"}]}])
:type "basic"}]}
{:description "any keycode",
:manipulators [{:from {:any "key_code"},
:to [{:key_code "a"}],
:type "basic"}
{:from {:any "consumer_key_code"},
:to [{:key_code "a"}],
:type "basic"}
{:from {:any "pointing_button"},
:to [{:key_code "a"}],
:type "basic"}]}])

(t/deftest generate-mains
(init-conf-data)
Expand Down

0 comments on commit 4593f44

Please sign in to comment.