Skip to content

Commit f8ee56f

Browse files
committed
fix: resolve #181
1 parent f4e5183 commit f8ee56f

File tree

4 files changed

+38
-21
lines changed

4 files changed

+38
-21
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

+21-14
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,11 @@
4848
"/usr/local/bin:" ;; homebrew
4949
(get sys-env "PATH"))}))))
5050

51-
(defn exit [status & [msg]]
52-
(when msg (println msg))
53-
(when-not dev? (misc/exit status)))
51+
(defn exit
52+
([status] (exit [status nil]))
53+
([status msg]
54+
(when msg (println msg))
55+
(when-not (env :is-dev) (System/exit status))))
5456

5557
;; paths
5658
(defn json-config-file-path
@@ -82,7 +84,7 @@
8284
(let [{:keys [applications devices keyboard-type input-sources tos froms modifiers layers simlayers ;; raws
8385
main simlayer-threshold templates profiles]} conf]
8486
(if (nil? profiles)
85-
(profiles/parse-profiles (:profiles d/conf-data))
87+
(profiles/parse-profiles (:profiles @d/conf-data))
8688
(profiles/parse-profiles profiles))
8789
(update-static-conf :applications applications)
8890
(update-static-conf :devices devices)
@@ -185,6 +187,7 @@
185187
[["-h" "--help"]
186188
["-V" "--version"]
187189
["-l" "--log"]
190+
[nil "--where-is-my-config"]
188191
["-c" "--config PATH" "Config PATH"
189192
:parse-fn (comp fs/file fs/expand-home)
190193
:validate [(fn [path]
@@ -209,6 +212,9 @@
209212
{:action "exit-with-message"
210213
:ok? true
211214
:exit-message (help-message summary)}
215+
(:where-is-my-config options)
216+
{:action "show-config-path"
217+
:ok? true}
212218
;; version
213219
(:version options)
214220
{:action "exit-with-message"
@@ -237,17 +243,16 @@
237243
[& args]
238244
(let [{:keys [action ;; options
239245
exit-message ok? config dry-run dry-run-all]} (validate-args args)]
240-
(when exit-message
241-
(case action
242-
"run" (do (parse (or (and config (-> config fs/expand-home fs/file .getPath)) (edn-config-file-path)) dry-run dry-run-all)
243-
(exit (if ok? 0 1) exit-message))
244-
"log" (do (open-log-file)
245-
(exit 0))
246-
"exit-with-message" (exit (if ok? 0 1) exit-message)
247-
"errors" (exit (if ok? 0 1) exit-message)
248-
"default" (exit (if ok? 0 1) exit-message)))))
246+
(case action
247+
"run" (do (parse (or config (edn-config-file-path)) dry-run dry-run-all)
248+
(exit (if ok? 0 1) exit-message))
249+
"show-config-path" (exit 0 (or config (edn-config-file-path)))
250+
"log" (do (open-log-file) (exit 0))
251+
"exit-with-message" (exit (if ok? 0 1) exit-message)
252+
"errors" (exit (if ok? 0 1) exit-message)
253+
"default" (exit (if ok? 0 1) exit-message))))
249254

250-
;; (when-not dev? (apply -main *command-line-args*))
255+
(when-not dev? (apply -main *command-line-args*))
251256

252257
(comment
253258
(-main)
@@ -256,10 +261,12 @@
256261
(-main "-l")
257262
(-main "--log")
258263
(-main "--config" "./")
264+
(-main "--where-is-my-config")
259265
(-main "-c" "./")
260266
(-main "-dc" "./")
261267
(-main "-dc" "~/.config/karabiner.edn")
262268
(-main "-dc" "~/.config/karabiner.test.edn")
269+
(-main "-c" "~/.nixpkgs/modules/yqrashawn/home-manager/dotfiles/karabiner.edn")
263270
(-main "-d")
264271
(-main "-V")
265272
(-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)