summary refs log tree commit diff stats
path: root/src
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-30 23:04:51 +0100
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-12-30 23:04:51 +0100
commit07723b9a69217e822f63e0bb10b767f15b9847df (patch)
tree216ae3c584ed632e5b5d349af5617a752915a700 /src
parentfix(package): Add a `bin` extension to the final output file (diff)
downloadqmk_layout-07723b9a69217e822f63e0bb10b767f15b9847df.zip
feat(soispha/keymap): Actually send a keycode to start the application
Diffstat (limited to 'src')
-rw-r--r--src/keymaps/soispha/keymap.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/keymaps/soispha/keymap.c b/src/keymaps/soispha/keymap.c
index 2b6c16f..7b8c14d 100644
--- a/src/keymaps/soispha/keymap.c
+++ b/src/keymaps/soispha/keymap.c
@@ -10,12 +10,12 @@
  * If not, see <https://www.gnu.org/licenses/agpl.txt>.
  */
 
+#include "hid/hid.h"
 #include "layout/layout.h"
 #include "macros.h"
 #include "version.h"
 #include <stdbool.h>
 #include <stdint.h>
-#include "hid/hid.h"
 
 bool process_record_user(uint16_t keycode, keyrecord_t *record) {
   switch (keycode) {
@@ -82,8 +82,38 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
     return false;
   }
 
-  if (keycode >= UK_UNICODE && keycode <= UK_UNICODE_MAX) {
+  uint8_t unicode_saved_mods;
+  // led_t unicode_saved_led_state;
+  if (keycode >= UK_UNICODE && keycode <= UK_UNICODE_MAX &&
+      record->event.pressed) {
+
+    // unicode_saved_led_state = host_keyboard_led_state();
+    //
+    // // Note the order matters here!
+    // // Need to do this before we mess around with the mods, or else
+    // // UNICODE_KEY_LNX (which is usually Ctrl-Shift-U) might not work
+    // // correctly in the shifted case.
+    // if (unicode_saved_led_state.caps_lock) {
+    //   tap_code(KC_CAPS_LOCK);
+    // }
+
+    unicode_saved_mods = get_mods(); // Save current mods
+    clear_mods(); // Unregister mods to start from a clean state
+    clear_weak_mods();
+
+    tap_code16(HYPR(KC_Z));
+
+    // Give the pc time to start our application
+    wait_ms(10);
+
     hid_send(QK_UNICODE_GET_CODE_POINT(keycode));
+
+    // if (unicode_saved_led_state.caps_lock) {
+    //   tap_code(KC_CAPS_LOCK);
+    // }
+    set_mods(unicode_saved_mods); // Reregister previously set mods
+
+    return false;
   }
 
   return true;