Milk 2% - Unicode Keymap Fix and Improvements (#7013)
authorCatriel Müller <catrielmuller@gmail.com>
Tue, 15 Oct 2019 22:29:33 +0000 (19:29 -0300)
committerJoel Challis <git@zvecr.com>
Tue, 15 Oct 2019 22:29:33 +0000 (23:29 +0100)
* - Enabled Unicode Feature to fix the build
- Added TapDance Feature to improve the functionality of the Keyboard
- Added the ability to switch between the Unicodes Modes
- Added more Emojis thanks to the tap dance feature

* Fix Format

keyboards/2_milk/keymaps/emoji/config.h [new file with mode: 0644]
keyboards/2_milk/keymaps/emoji/keymap.c
keyboards/2_milk/keymaps/emoji/readme.md
keyboards/2_milk/keymaps/emoji/rules.mk [new file with mode: 0644]

diff --git a/keyboards/2_milk/keymaps/emoji/config.h b/keyboards/2_milk/keymaps/emoji/config.h
new file mode 100644 (file)
index 0000000..90e4d63
--- /dev/null
@@ -0,0 +1,2 @@
+#define UNICODE_SELECTED_MODES UC_LNX, UC_OSX, UC_WIN, UC_WINC
+#define TAPPING_TERM 300
\ No newline at end of file
dissimilarity index 73%
index 9b84df5..024a6a0 100644 (file)
@@ -1,31 +1,53 @@
-#include QMK_KEYBOARD_H
-
-enum custom_keycodes {
-  DISSA,
-  SHRUG
-};
-
-const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
-      [0] = LAYOUT(
-          SHRUG,
-          DISSA
-          )
-};
-
-bool process_record_user(uint16_t keycode, keyrecord_t *record) {
-  switch (keycode) {
-    case SHRUG:
-      if (record->event.pressed) {
-        send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF");
-      } else {
-      }
-      break;
-    case DISSA:
-      if (record->event.pressed) {
-          send_unicode_hex_string("0CA0 005F 0CA0");
-      } else {
-      }
-      break;
-  }
-  return true;
-};
+#include QMK_KEYBOARD_H
+
+enum tapdance_keycodes {
+    TD_KEY_1,
+    TD_KEY_2,
+};
+
+void dance_key_one (qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        send_unicode_hex_string("00AF 005C 005F 0028 30C4 0029 005F 002F 00AF"); // ¯\_(ツ)_/¯
+        SEND_STRING(SS_TAP(X_ENTER));
+        reset_tap_dance (state);
+    } else if (state->count == 2) {
+        cycle_unicode_input_mode(+1);
+        reset_tap_dance (state);
+    }
+}
+
+void dance_key_two (qk_tap_dance_state_t *state, void *user_data) {
+    if (state->count == 1) {
+        send_unicode_hex_string("0CA0 005F 0CA0"); // ಠ_ಠ
+        SEND_STRING(SS_TAP(X_ENTER));
+        reset_tap_dance (state);
+    } else if (state->count == 2) {
+        send_unicode_hex_string("0028 30CE 0CA0 75CA 0CA0 0029 30CE 5F61 253B 2501 253B"); // (ノಠ痊ಠ)ノ彡┻━┻
+        SEND_STRING(SS_TAP(X_ENTER));
+        reset_tap_dance (state);
+    } else if (state->count == 3) {
+        send_unicode_hex_string("256D 2229 256E 0028 002D 005F 002D 0029 256D 2229 256E"); // ╭∩╮(-_-)╭∩╮
+        SEND_STRING(SS_TAP(X_ENTER));
+        reset_tap_dance (state);
+    } else if (state->count == 4) {
+        send_unicode_hex_string("0028 3065 FFE3 0020 00B3 FFE3 0029 3065"); // (づ ̄ ³ ̄)づ
+        SEND_STRING(SS_TAP(X_ENTER));
+        reset_tap_dance (state);
+    } else if (state->count == 5) {
+        send_unicode_hex_string("0028 FE3A FE39 FE3A 0029"); // (︺︹︺)
+        SEND_STRING(SS_TAP(X_ENTER));
+        reset_tap_dance (state);
+    }
+}
+
+qk_tap_dance_action_t tap_dance_actions[] = {
+    [TD_KEY_1] = ACTION_TAP_DANCE_FN(dance_key_one),
+    [TD_KEY_2] = ACTION_TAP_DANCE_FN(dance_key_two),
+};
+
+const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
+    [0] = LAYOUT(
+        TD(TD_KEY_1),
+        TD(TD_KEY_2)
+    ),
+};
index 980be7d..1d5a087 100644 (file)
@@ -1,2 +1,39 @@
 # Emoji Keymap
 ![Picture](https://i.imgur.com/1zEZ9Lq.png)
+
+# Unicode Setup
+
+Unicode input in QMK works by inputting a sequence of characters to the 
+OS, sort of like a macro. Unfortunately, the way this is done differs 
+for each platform. Specifically, each platform requires a different 
+combination of keys to trigger Unicode input. Therefore, a 
+corresponding input mode has to be set in QMK.
+
+Documentation: [Feature Unicode](https://beta.docs.qmk.fm/features/feature_unicode#input-modes)
+
+On this keymap the default unicode mode it's `UC_LNX`.
+You can change it permanently tapping 2 times the KeyOne to select the next mode.
+
+## Unicode Mode List
+- UC_LNX
+- UC_OSX
+- UC_WIN
+- UC_WINC
+
+# Keymap
+To add more functionality to this Minimal Keyboard, 
+it's implemented the tap dance feature, so pressing the same key 
+multiples times will produce different emojis.
+
+## Key One
+
+- 1 Tap: `¯\_(ツ)_/¯`
+- 2 Taps: Switch Unicode Input Type
+
+## Key Two
+
+- 1 Tap: `ಠ_ಠ`
+- 2 Taps: `(ノಠ痊ಠ)ノ彡┻━┻`
+- 3 Taps: `╭∩╮(-_-)╭∩╮`
+- 4 Taps: `(づ ̄ ³ ̄)づ`
+- 5 Taps: `(︺︹︺)`
\ No newline at end of file
diff --git a/keyboards/2_milk/keymaps/emoji/rules.mk b/keyboards/2_milk/keymaps/emoji/rules.mk
new file mode 100644 (file)
index 0000000..7a64eb9
--- /dev/null
@@ -0,0 +1,2 @@
+UNICODE_ENABLE = yes   # Unicode
+TAP_DANCE_ENABLE = yes # Tap Dance
\ No newline at end of file