summaryrefslogtreecommitdiff
path: root/keyboards/z12
diff options
context:
space:
mode:
authorSergi Meseguer <zigotica@gmail.com>2021-12-27 11:24:14 +0100
committerGitHub <noreply@github.com>2021-12-27 21:24:14 +1100
commit07465c0ebbabf35079fed70a58e73da1e9419444 (patch)
treee208711b0d007f4f2f96777100188783176ea6ad /keyboards/z12
parent6ec9cd511df29a0bf788818e3cecf636d836af3c (diff)
downloadqmk_firmware-07465c0ebbabf35079fed70a58e73da1e9419444.tar.gz
qmk_firmware-07465c0ebbabf35079fed70a58e73da1e9419444.zip
zigotica userspace add raw_hid_receive (#14869)
* zigotica userspace add raw_hid_receive * add 3 keys to figma keymap * add 2 keys to vim keymap * improve vim keys * add 3 keys to browser keymap * comment typo * shorten SEND_STRING Co-authored-by: Ryan <fauxpark@gmail.com> Co-authored-by: Ryan <fauxpark@gmail.com>
Diffstat (limited to 'keyboards/z12')
-rw-r--r--keyboards/z12/keymaps/zigotica/encoder.c12
-rw-r--r--keyboards/z12/keymaps/zigotica/keymap.c116
-rw-r--r--keyboards/z12/keymaps/zigotica/oled.c10
-rw-r--r--keyboards/z12/keymaps/zigotica/readme.md3
4 files changed, 94 insertions, 47 deletions
diff --git a/keyboards/z12/keymaps/zigotica/encoder.c b/keyboards/z12/keymaps/zigotica/encoder.c
index 49a3d859b6..f55b9b5ae9 100644
--- a/keyboards/z12/keymaps/zigotica/encoder.c
+++ b/keyboards/z12/keymaps/zigotica/encoder.c
@@ -48,12 +48,8 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
// Cycle through Tabs
if (clockwise) {
tap_code16(C(KC_TAB));
- /* register_code16(G(KC_RCBR)); */
- /* unregister_code16(G(KC_RCBR)); */
} else {
tap_code16(S(C(KC_TAB)));
- /* register_code16(G(KC_LCBR)); */
- /* unregister_code16(G(KC_LCBR)); */
}
} else { // RIGHT
// Scroll up/down
@@ -68,11 +64,11 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
break;
case _FIGMA:
if (index == 0) { // LEFT
- // Volume control.
+ // Cycle through Tabs
if (clockwise) {
- tap_code(KC_VOLU);
+ tap_code16(C(KC_TAB));
} else {
- tap_code(KC_VOLD);
+ tap_code16(S(C(KC_TAB)));
}
} else { // RIGHT
// Zoom in/out
@@ -89,7 +85,7 @@ bool encoder_update_user(uint8_t index, bool clockwise) {
}
}
break;
- case _TERMINAL:
+ case _BASE:
default:
if (index == 0) { // LEFT
// Volume control.
diff --git a/keyboards/z12/keymaps/zigotica/keymap.c b/keyboards/z12/keymaps/zigotica/keymap.c
index 7e969de96e..ef01561f1a 100644
--- a/keyboards/z12/keymaps/zigotica/keymap.c
+++ b/keyboards/z12/keymaps/zigotica/keymap.c
@@ -16,25 +16,73 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "zigotica.h"
+#include "raw_hid.h"
+
+#ifdef RAW_ENABLE
+void raw_hid_receive(uint8_t* data, uint8_t length) {
+ layer_clear();
+ if (data[0] == 99) {
+ layer_on(_BASE);
+ }
+ else {
+ layer_on(data[0]);
+ }
+}
+#endif
// Custom Keycodes
-#define MODE_1 TO(_TERMINAL)
+#define MODE_1 TO(_BASE)
#define MODE_2 TO(_FIGMA)
#define MODE_3 TO(_BROWSER)
#define MODE_4 TO(_VIM)
enum custom_keycodes {
- VIM_SIP = SAFE_RANGE
+ VIM_SIF = SAFE_RANGE,
+ VIM_SIP,
+ VIM_RIF,
+ VIM_RIP,
+ VIM_NEW
};
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
- case VIM_SIP:
+ case VIM_SIF:// Search in File
+ if (record->event.pressed) {
+ register_code(KC_ESC);
+ tap_code(KC_SLASH);
+ } else { // released
+ unregister_code(KC_ESC);
+ }
+ break;
+ case VIM_SIP:// Search in Project
if (record->event.pressed) {
register_code(KC_ESC);
SEND_STRING(":Ag ");
- } else {
- // released
+ } else { // released
+ unregister_code(KC_ESC);
+ }
+ break;
+ case VIM_RIF:// Replace in File
+ if (record->event.pressed) {
+ register_code(KC_ESC);
+ SEND_STRING(":%s/a/b/g");
+ } else { // released
+ unregister_code(KC_ESC);
+ }
+ break;
+ case VIM_RIP:// Replace in Project
+ if (record->event.pressed) {
+ register_code(KC_ESC);
+ SEND_STRING(":cdo %s/a/b/g");
+ } else { // released
+ unregister_code(KC_ESC);
+ }
+ break;
+ case VIM_NEW:// New buffer
+ if (record->event.pressed) {
+ SEND_STRING("\e:vnew\n");
+ } else { // released
+ unregister_code(KC_ENT);
unregister_code(KC_ESC);
}
break;
@@ -44,83 +92,83 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/*
- * TERMINAL Layer
+ * BASE Layer
*
* ,-----------------------------.
- * | | TERM | FIGM | |
+ * | | BASE | FIGM | |
* |-------+------+------+-------|
- * | VOL | BROW | VIM | SCROLL|
+ * |VOL/PLY| BROW | VIM | SCROLL|
* |-------+------+------+-------|
* |-------+-------+-------|
- * | MEDIA | o | o |
+ * | o | o | o |
* |-------+-------+-------|
* | o | o | o |
* |-------+-------+-------|
*/
- [_TERMINAL] = LAYOUT(
+ [_BASE] = LAYOUT(
MODE_1, MODE_2,
ZK_MEDIA, MODE_3, MODE_4, _______,
_______, _______, _______,
_______, _______, _______
),
/*
- * VIM Layer
+ * FIGMA Layer
*
* ,-----------------------------.
- * | | TERM | FIGM | |
+ * | | BASE | FIGM | |
* |-------+------+------+-------|
- * |BUFFER | BROW | VIM | SCROLL|
+ * | TABS | BROW | VIM | ZOOM |
* |-------+------+------+-------|
* |-------+-------+-------|
- * |SEARCH | o | o |
+ * |ZOOMFIT| GRIDS | FULL |
* |-------+-------+-------|
- * | o | o | o |
+ * |ZOOM100| NEXT | COLOR |
* |-------+-------+-------|
*/
- [_VIM] = LAYOUT(
+ [_FIGMA] = LAYOUT(
_______, _______,
_______, _______, _______, _______,
- VIM_SIP, _______, _______,
- _______, _______, _______
+ LSFT(KC_1), LCTL(KC_G), LGUI(KC_BSLS),
+ LSFT(KC_0), KC_N, LCTL(KC_C)
),
/*
- * FIGMA Layer
+ * BROWSER Layer
*
* ,-----------------------------.
- * | | TERM | FIGM | |
+ * | | BASE | FIGM | |
* |-------+------+------+-------|
- * | VOL | BROW | VIM | ZOOM |
+ * | TABS | BROW | VIM | SCROLL|
* |-------+------+------+-------|
* |-------+-------+-------|
- * | ZOOM | GRIDS | FULL |
+ * |SEARCH | BOOKM | DEVTL |
* |-------+-------+-------|
- * | o | o | o |
+ * |ZOOM100| MUTE | READ |
* |-------+-------+-------|
*/
- [_FIGMA] = LAYOUT(
+ [_BROWSER] = LAYOUT(
_______, _______,
_______, _______, _______, _______,
- LSFT(KC_1), LCTL(KC_G), LGUI(KC_BSLS),
- _______, _______, _______
+ G(KC_F), G(KC_D), G(A(KC_I)),
+ G(KC_0), C(KC_M), G(A(KC_R))
),
/*
- * BROWSER Layer
+ * VIM Layer
*
* ,-----------------------------.
- * | | TERM | FIGM | |
+ * | | BASE | FIGM | |
* |-------+------+------+-------|
- * | TABS | BROW | VIM | SCROLL|
+ * |BUFFER | BROW | VIM | SCROLL|
* |-------+------+------+-------|
* |-------+-------+-------|
- * |SEARCH | BOOKM | DEVTL |
+ * |SRCH FL|REPL FL|NEW BUF|
* |-------+-------+-------|
- * | o | o | o |
+ * |SRCH PR|REPL PR| o |
* |-------+-------+-------|
*/
- [_BROWSER] = LAYOUT(
+ [_VIM] = LAYOUT(
_______, _______,
_______, _______, _______, _______,
- G(KC_F), G(KC_D), G(A(KC_I)),
- _______, _______, _______
+ VIM_SIF, VIM_RIF, VIM_NEW,
+ VIM_SIP, VIM_RIP, _______
),
};
diff --git a/keyboards/z12/keymaps/zigotica/oled.c b/keyboards/z12/keymaps/zigotica/oled.c
index fa11a3d6c6..c96fc0f708 100644
--- a/keyboards/z12/keymaps/zigotica/oled.c
+++ b/keyboards/z12/keymaps/zigotica/oled.c
@@ -21,16 +21,16 @@ static void render_status(void) {
oled_write_P(PSTR("Layer: "), false);
switch (get_highest_layer(layer_state)) {
case _VIM:
- oled_write_P(PSTR("VIM\n\nBUFFER SCROLL"), false);
+ oled_write_P(PSTR("VIM \n\nBUFFER SCROLL"), false);
break;
case _FIGMA:
- oled_write_P(PSTR("FIGMA\n\nVOLUME ZOOM"), false);
+ oled_write_P(PSTR("FIGMA \n\nTABS ZOOM"), false);
break;
case _BROWSER:
- oled_write_P(PSTR("BROWSER\n\nTABS SCROLL"), false);
+ oled_write_P(PSTR("BROWSER \n\nTABS SCROLL"), false);
break;
- case _TERMINAL:
- oled_write_P(PSTR("TERMINAL\n\nVOLUME SCROLL"), false);
+ case _BASE:
+ oled_write_P(PSTR("BASE \n\nVOLUME SCROLL"), false);
break;
default:
oled_write_P(PSTR("Undef\n"), false);
diff --git a/keyboards/z12/keymaps/zigotica/readme.md b/keyboards/z12/keymaps/zigotica/readme.md
new file mode 100644
index 0000000000..a3746a88d2
--- /dev/null
+++ b/keyboards/z12/keymaps/zigotica/readme.md
@@ -0,0 +1,3 @@
+# zigotica's z12 Layout
+
+This layout uses `RAW_ENABLE = yes`, and benefits from [active-app-qmk-layer-updater](https://github.com/zigotica/active-app-qmk-layer-updater) node script (run by the host system) to change layers programmatically depending on the current active app.