Commit 117aedb 1 parent 8e14550 commit 117aedb Copy full SHA for 117aedb
File tree 5 files changed +30
-10
lines changed
src/karabiner_configurator
test/karabiner_configurator
5 files changed +30
-10
lines changed Original file line number Diff line number Diff line change 5
5
api_key :
6
6
secure : 3xIPPkDWvHaD7Fnc/g/mmPoYb4pxcS+iZ5PtcH421Sulfuk5b8+dG64uZ+YfKpyUTuGgvnI2Fe70Ne1kku/+AJuljBBCivqb8LED4cO4+5eJYQa95YUyhtIWpxdykdexYCzLa7AFWGx1UsFvk+XU5O7WKLJxNvPKmaJ9bcWrnhm4XH94u5qICQqav4PAoSoWqRF2gK/hBqQSNDW7Voz5VS1YQUEmxoX0OoSHQGaDn0juxJzprFi/W/0aapEOPSd+G7OQ6D34ShRVQ6DBxI8t+1urm3prz0kNqum/5u+KFKXKfBkH17MmWiQIn0cQsNS/UV6T2j61XHjA3+g5HRX4Jwm7mBV3UMDASaeNvMdb3i/3zLosX74jgVDjRrm0P10U7N3UTOORmMrRI3YzOjPWluQFabGU0yplOnQ36Gw3K/++VTPmBXdY3UukATOsZ7ymO6KTAIOleOQlsqVr1sB6IrDViuCzVGpYEXNk5FaM0B13T1svY3ObANxlPITDSKgtv+cmbbzV6WHKYfBetpQV2h3Ske5LADAF4hswaNiRH7njE3ARoEBqz8nZ7pBM9gtAbzxABXyPmTjVYMZn6KekZcvqCyPHHxe0j/PzxLLbkOcFfY3Il6iNLSAAMZj+yszT4Fh/ibM3UQmDoy8zQCcfIWTF5ACXWzCw9cjn6/0Sc+M=
7
7
file : goku
8
+ skip_cleanup : true
8
9
on :
9
10
tags : true
10
11
repo : yqrashawn/GokuRakuJoudo
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. This change
8
8
- ~:mission_control~ to normal key
9
9
*** Fixed
10
10
- karabiner error while using ~:mission_control~
11
+ - multiple devices condition bug
11
12
12
13
** 0.1.0 - 2018-09-07
13
14
*** Added
Original file line number Diff line number Diff line change 38
38
" device_if" )
39
39
result (if (and (keyword? condi) (nn? (condi (:devices conf-data))))
40
40
{:identifiers
41
- (condi (:devices conf-data))
41
+ (into [] ( condi (:devices conf-data) ))
42
42
:type condi-type}
43
43
result)
44
44
condi-type (if condi!?
58
58
(do
59
59
(update-used-simlayers-config (condi (:simlayers conf-data)))
60
60
(update-used-simlayers-config (assoc-in used-simlayers-config [:from :sim ]
61
- (conj (:sim (:from used-simlayers-config))
62
- (keyword (:key_code from)))))))
61
+ (conj (:sim (:from used-simlayers-config))
62
+ (keyword (:key_code from)))))))
63
63
{:name (name condi)
64
64
:value 1
65
65
:type condi-type})
Original file line number Diff line number Diff line change 138
138
:else result)]
139
139
result))
140
140
141
+ (defn merge-multiple-device-conditions
142
+ [vec]
143
+ (update-conf-data (assoc conf-data :devices (dissoc (:devices conf-data) :temp-device )))
144
+ (let [devices-list (for [item vec
145
+ :when (and (keyword? item) (devices? item))
146
+ :let [this-device-vec (item (:devices conf-data))
147
+ temp-device-vec (if (devices? :temp-device )
148
+ (into [] (concat (:temp-device (:devices conf-data)) this-device-vec))
149
+ this-device-vec)
150
+ update-temp-device-into-conf-data (update-conf-data (assoc-in conf-data [:devices :temp-device ] temp-device-vec))]]
151
+ item)
152
+ use-temp-device? (> (count devices-list) 0 )
153
+ new-conditions (if use-temp-device? (conj (into [] (reduce #(remove #{%2 } %1 ) vec devices-list)) :temp-device )
154
+ vec)]
155
+ new-conditions))
156
+
141
157
; ; conditions
142
158
; ; :vi-mode or [:vi-mode]
143
159
(defn conditions-key
144
160
[des conditions prev-result]
145
- (if (conditions/is-simple-set-variable? conditions)
146
- {:conditions (conditions/parse-conditions [conditions] (:from prev-result) (:to prev-result))}
147
- {:conditions (conditions/parse-conditions conditions (:from prev-result) (:to prev-result))}))
161
+ (let [conditions (merge-multiple-device-conditions conditions)]
162
+ (if (conditions/is-simple-set-variable? conditions)
163
+ {:conditions (conditions/parse-conditions [conditions] (:from prev-result) (:to prev-result))}
164
+ {:conditions (conditions/parse-conditions conditions (:from prev-result) (:to prev-result))})))
148
165
149
166
; ; to_if_alone | :alone
150
167
; ; to_if_held_down | :held
Original file line number Diff line number Diff line change 3
3
[karabiner-configurator.data :refer :all ]
4
4
[clojure.test :as t]))
5
5
6
- (def example-mains [{:des " a to 1" :rules [[:a :1 ]]} ; ; a to 1
6
+ (def example-mains [
7
+ {:des " a to 1" :rules [[:a :1 ]]} ; ; a to 1
7
8
{:des " command a to control 1" :rules [[:!C#Pa :!T1 ]]} ; ; command a to control 1
8
9
{:des " my spacebar to control 1" :rules [[:my-spacebar :!T1 ]]} ; ; my-spacebar to control 1
9
10
{:des " press b to insert 12" :rules [[:b [:1 :2 ]]]} ; ; key to key
12
13
{:des " simultaneous e f to 3" :rules [[[:e :f ] :3 ]]} ; ; simultaneous key to key
13
14
{:des " g to 4 when variable vi-mode is 1" :rules [[:g :4 :vi-mode ]]} ; ; vi-mode is 1
14
15
{:des " h to 5 when variable vi-mode is not 1" :rules [[:h :5 :!vi-mode ]]} ; ; vi-mode is not 1
15
- {:des " i to 6 only for device hhkb-bt" :rules [[:i :6 :hhkb-bt ]]} ; ; key to key in layer b (in layer a) specific to hhkb-bt device
16
+ {:des " i to 6 only for device hhkb-bt" :rules [[:i :6 [ :hhkb-bt :hhkb ] ]]} ; ; key to key in layer b (in layer a) specific to hhkb-bt device
16
17
{:des " j to 7 on hhkb-bt when variable vi-mode is 1" :rules [[:j :7 [:vi-mode :hhkb-bt ]]]} ; ; multiple condition
17
18
{:des " press h insert 8 then set variable some-mode to 0" :rules [[:h [:8 {:set [" some-mode" 0 ]}]]]}
18
19
{:des " capslock to control as modifier to escape when press alone" :rules [[:##caps_lock :left_control nil {:alone :escape }]]}
92
93
{:description " i to 6 only for device hhkb-bt" ,
93
94
:manipulators [{:from {:key_code " i" },
94
95
:to [{:key_code " 6" }],
95
- :conditions [{:identifiers [{:vendor_id 1278 ,
96
- :product_id 51966 }],
96
+ :conditions [{:identifiers [{:vendor_id 1278 :product_id 51966 }
97
+ { :vendor_id 2131 :product_id 256 }],
97
98
:type " device_if" }],
98
99
:type " basic" }]}
99
100
{:description " j to 7 on hhkb-bt when variable vi-mode is 1" ,
You can’t perform that action at this time.
0 commit comments