Skip to content

Commit 3106498

Browse files
committed
fix: resolve #181
1 parent 2295ee4 commit 3106498

File tree

4 files changed

+43
-27
lines changed

4 files changed

+43
-27
lines changed

CHANGELOG.org

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ All notable changes to this project will be documented in this file. This change
33

44
** Unreleased
55

6-
[Unreleased Commits]: https://github.com/yqrashawn/GokuRakuJoudo/compare/v0.5.5...HEAD
6+
[Unreleased Commits]: https://github.com/yqrashawn/GokuRakuJoudo/compare/v0.5.6...HEAD
7+
8+
** 0.5.6 - 2022-07-17
9+
*** Added
10+
~goku --where-is-my-config- shows detected config path
11+
*** Fixed
12+
- fix https://github.com/yqrashawn/GokuRakuJoudo/issues/181
13+
14+
[commits in 0.5.6]: https://github.com/yqrashawn/GokuRakuJoudo/compare/v0.5.5...v0.5.6
715

816
** 0.5.5 - 2022-07-12
917
*** Fixed

src/karabiner_configurator/core.clj

+26-20
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,11 @@
3737
"/usr/local/bin:" ;; homebrew
3838
(get sys-env "PATH"))}))))
3939

40-
(defn exit [status & [msg]]
41-
(when msg (println msg))
42-
(when-not (env :is-dev) (System/exit status)))
40+
(defn exit
41+
([status] (exit [status nil]))
42+
([status msg]
43+
(when msg (println msg))
44+
(when-not (env :is-dev) (System/exit status))))
4345

4446
;; paths
4547
(defn json-config-file-path
@@ -71,7 +73,7 @@
7173
(let [{:keys [applications devices keyboard-type input-sources tos froms modifiers layers simlayers ;; raws
7274
main simlayer-threshold templates profiles]} conf]
7375
(if (nil? profiles)
74-
(profiles/parse-profiles (:profiles d/conf-data))
76+
(profiles/parse-profiles (:profiles @d/conf-data))
7577
(profiles/parse-profiles profiles))
7678
(update-static-conf :applications applications)
7779
(update-static-conf :devices devices)
@@ -177,13 +179,13 @@
177179
[["-h" "--help"]
178180
["-V" "--version"]
179181
["-l" "--log"]
182+
[nil "--where-is-my-config"]
180183
["-c" "--config PATH" "Config PATH"
181184
:parse-fn abs-path
182185
:validate [(fn [path]
183-
(let [path (abs-path path)]
184-
(and (fs/exists? path)
185-
(fs/file? path)
186-
(fs/readable? path))))
186+
(and (fs/exists? path)
187+
(fs/file? path)
188+
(fs/readable? path)))
187189
"Make sure the file is exits and readable"]]
188190
["-d" "--dry-run"]
189191
["-A" "--dry-run-all"]])
@@ -201,11 +203,14 @@
201203
{:action "exit-with-message"
202204
:ok? true
203205
:exit-message (help-message summary)}
206+
(:where-is-my-config options)
207+
{:action "show-config-path"
208+
:ok? true}
204209
;; version
205210
(:version options)
206-
{:action "exit-with-message"
207-
:ok? true
208-
:exit-message "0.5.3"}
211+
{:action "exit-with-message"
212+
:ok? true
213+
:exit-message "0.5.6"}
209214
;; log
210215
(:log options)
211216
{:action "log"
@@ -229,15 +234,14 @@
229234
[& args]
230235
(let [{:keys [action ;; options
231236
exit-message ok? config dry-run dry-run-all]} (validate-args args)]
232-
(when exit-message
233-
(case action
234-
"run" (do (parse (or config (edn-config-file-path)) dry-run dry-run-all)
235-
(exit (if ok? 0 1) exit-message))
236-
"log" (do (open-log-file)
237-
(exit 0))
238-
"exit-with-message" (exit (if ok? 0 1) exit-message)
239-
"errors" (exit (if ok? 0 1) exit-message)
240-
"default" (exit (if ok? 0 1) exit-message)))))
237+
(case action
238+
"run" (do (parse (or config (edn-config-file-path)) dry-run dry-run-all)
239+
(exit (if ok? 0 1) exit-message))
240+
"show-config-path" (exit 0 (or config (edn-config-file-path)))
241+
"log" (do (open-log-file) (exit 0))
242+
"exit-with-message" (exit (if ok? 0 1) exit-message)
243+
"errors" (exit (if ok? 0 1) exit-message)
244+
"default" (exit (if ok? 0 1) exit-message))))
241245

242246
(comment
243247
(-main)
@@ -246,10 +250,12 @@
246250
(-main "-l")
247251
(-main "--log")
248252
(-main "--config" "./")
253+
(-main "--where-is-my-config")
249254
(-main "-c" "./")
250255
(-main "-dc" "./")
251256
(-main "-dc" "~/.config/karabiner.edn")
252257
(-main "-dc" "~/.config/karabiner.test.edn")
258+
(-main "-c" "~/.nixpkgs/modules/yqrashawn/home-manager/dotfiles/karabiner.edn")
253259
(-main "-d")
254260
(-main "-V")
255261
(-main "--version"))

src/karabiner_configurator/modifiers.clj

+7-6
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,13 @@
6767

6868
(defn generate
6969
[modifiers]
70-
(assoc @d/conf-data :modifiers
71-
(into
72-
{}
73-
(for [[modifier-name modifier-info] modifiers]
74-
{modifier-name
75-
(parse-single-modifier-definition modifier-info modifier-name)}))))
70+
(d/assoc-conf-data
71+
:modifiers
72+
(into
73+
{}
74+
(for [[modifier-name modifier-info] modifiers]
75+
{modifier-name
76+
(parse-single-modifier-definition modifier-info modifier-name)}))))
7677

7778
(defn parse-modifiers
7879
"parse modifires to string"

src/karabiner_configurator/profiles.clj

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
:basic.to_delayed_action_delay_milliseconds delay
2222
:basic.to_if_alone_timeout_milliseconds alone
2323
:basic.to_if_held_down_threshold_milliseconds held}}}))))
24+
2425
(defn parse-rules
2526
"Parse generated rules into profiles"
2627
[rules]

0 commit comments

Comments
 (0)