Subject: [PATCH 11/22] gnu: Add qmk-firmware-ergodox-ez-hacker-dvorak.

From: Maxim Cournoyer <[email-masked]>
Date: Tue, 26 Sep 2023 15:04:34 -0400

* gnu/packages/firmware.scm (qmk-firmware-ergodox-ez-hacker-dvorak): New
variable.
* gnu/packages/patches/qmk-firmware-fix-hacker-dvorak.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
---

 gnu/local.mk                                  |  1 +
 gnu/packages/firmware.scm                     | 25 ++++++++++++++++++-
 .../qmk-firmware-fix-hacker-dvorak.patch      | 15 +++++++++++
 3 files changed, 40 insertions(+), 1 deletion(-)
 create mode 100644 gnu/packages/patches/qmk-firmware-fix-hacker-dvorak.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index bfa816d717c..c04c4196cdf 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1893,6 +1893,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/quagga-reproducible-build.patch          \
   %D%/packages/patches/quickswitch-fix-dmenu-check.patch	\
   %D%/packages/patches/quilt-grep-compat.patch 			\
+  %D%/packages/patches/qmk-firmware-fix-hacker-dvorak.patch 	\
   %D%/packages/patches/qtwayland-dont-recreate-callbacks.patch	\
   %D%/packages/patches/qtwayland-cleanup-callbacks.patch	\
   %D%/packages/patches/ragel-char-signedness.patch		\
diff --git a/gnu/packages/firmware.scm b/gnu/packages/firmware.scm
index 22be7ee62dd..6a488d672ff 100644
--- a/gnu/packages/firmware.scm
+++ b/gnu/packages/firmware.scm
@@ -1340,7 +1340,9 @@ (define* (make-qmk-firmware/implementation keyboard keymap
               (file-name (git-file-name "qmk-firmware" version))
               (sha256
                (base32
-                "0s1lcnv7cddpn768p7mrc5bkxhx0ba5p77ya007dnkbk36c33d0w"))))
+                "0s1lcnv7cddpn768p7mrc5bkxhx0ba5p77ya007dnkbk36c33d0w"))
+              (patches
+               (search-patches "qmk-firmware-fix-hacker-dvorak.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list
@@ -1444,6 +1446,27 @@ (define-public qmk-firmware-ergodox-ez-dvorak-42-key
 See the @file{keyboards/atreus/keymaps/dvorak_42_key/keymap.c} source file for
 the keymap definition."))
 
+(define-public qmk-firmware-ergodox-ez-hacker-dvorak
+  (make-qmk-firmware "ergodox_ez" "hacker_dvorak" #:description "\
+This is a Dvorak layout for the ErgoDox EZ.  It is inspired by the
+@url{https://www.kaufmann.no/roland/dvorak, Programmer Dvorak}.  The operating
+system keyboard layout should be set to US for this keymap to function
+normally.  It defines 10 layers:
+@enumerate
+@item Dvorak
+@item Querty
+@item Gaming
+@item Arrows
+@item Mouse
+@item Numpad
+@item Hyper Fn
+@item Media Fn
+@item Meh Fn
+@item Meh Fn +
+@end enumerate
+The complete keymap can be inspected at the ErgoDox EZ Configurator web site:
+@url{https://configure.ergodox-ez.com/ergodox-ez/layouts/Wadz/latest/0}."))
+
 (define-public qmk-udev-rules
   (package
     (inherit qmk-firmware-ergodox-ez-default)
diff --git a/gnu/packages/patches/qmk-firmware-fix-hacker-dvorak.patch b/gnu/packages/patches/qmk-firmware-fix-hacker-dvorak.patch
new file mode 100644
index 00000000000..69e68cc8e12
--- /dev/null
+++ b/gnu/packages/patches/qmk-firmware-fix-hacker-dvorak.patch
@@ -0,0 +1,15 @@
+Submitted upstream: https://github.com/qmk/qmk_firmware/pull/22102
+
+diff --git a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c
+index bd4fd10ad1..5ce5f5298f 100644
+--- a/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c
++++ b/keyboards/ergodox_ez/keymaps/hacker_dvorak/user/layer_set_state_user.c
+@@ -4,7 +4,7 @@ layer_state_t layer_state_set_user(layer_state_t state) {
+ 
+     switch (layer) {
+         case DVORAK:
+-            rgblight_sethsv_noeeprom(GREEN);
++            rgblight_sethsv_noeeprom(HSV_GREEN);
+             rgblight_mode_noeeprom(RGBLIGHT_MODE_STATIC_LIGHT);
+ 
+             if (PLOVER_MODE) {
-- 
2.41.0