[Keymap] zigotica userspace (#14670)
Co-authored-by: Drashna Jaelre <drashna@live.com> Co-authored-by: Ryan <fauxpark@gmail.com>
This commit is contained in:
30
keyboards/z12/keymaps/zigotica/config.h
Normal file
30
keyboards/z12/keymaps/zigotica/config.h
Normal file
@@ -0,0 +1,30 @@
|
||||
/* Copyright 2020 Sergi Meseguer <zigotica@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "config_common.h"
|
||||
|
||||
#ifdef OLED_ENABLE
|
||||
#define OLED_DISPLAY_128X32
|
||||
#endif
|
||||
|
||||
// EC11 encoders' resolution.
|
||||
// Reduce the value to 2 if you feel missing values:
|
||||
#define ENCODER_RESOLUTION 4
|
||||
|
||||
// Allows correct registered values by rotary encoder:
|
||||
#define TAP_CODE_DELAY 10
|
114
keyboards/z12/keymaps/zigotica/encoder.c
Normal file
114
keyboards/z12/keymaps/zigotica/encoder.c
Normal file
@@ -0,0 +1,114 @@
|
||||
/* Copyright 2020 Sergi Meseguer <zigotica@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "zigotica.h"
|
||||
|
||||
bool encoder_update_user(uint8_t index, bool clockwise) {
|
||||
switch(get_highest_layer(layer_state)){
|
||||
case _VIM:
|
||||
if (index == 0) { // LEFT
|
||||
// Cycle through buffers
|
||||
if (clockwise) {
|
||||
register_code(KC_ESC);
|
||||
SEND_STRING(":bprevious");
|
||||
register_code(KC_ENT);
|
||||
unregister_code(KC_ESC);
|
||||
unregister_code(KC_ENT);
|
||||
} else {
|
||||
register_code(KC_ESC);
|
||||
SEND_STRING(":bnext");
|
||||
register_code(KC_ENT);
|
||||
unregister_code(KC_ESC);
|
||||
unregister_code(KC_ENT);
|
||||
}
|
||||
} else { // RIGHT
|
||||
// Scroll
|
||||
if (clockwise) {
|
||||
tap_code(KC_PGDN);
|
||||
} else {
|
||||
tap_code(KC_PGUP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _BROWSER:
|
||||
if (index == 0) { // LEFT
|
||||
// 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
|
||||
if (clockwise) {
|
||||
register_code(KC_WH_U);
|
||||
unregister_code(KC_WH_U);
|
||||
} else {
|
||||
register_code(KC_WH_D);
|
||||
unregister_code(KC_WH_D);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _FIGMA:
|
||||
if (index == 0) { // LEFT
|
||||
// Volume control.
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
} else { // RIGHT
|
||||
// Zoom in/out
|
||||
if (clockwise) {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_WH_D);
|
||||
unregister_code(KC_WH_D);
|
||||
unregister_code(KC_LGUI);
|
||||
} else {
|
||||
register_code(KC_LGUI);
|
||||
register_code(KC_WH_U);
|
||||
unregister_code(KC_WH_U);
|
||||
unregister_code(KC_LGUI);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case _TERMINAL:
|
||||
default:
|
||||
if (index == 0) { // LEFT
|
||||
// Volume control.
|
||||
if (clockwise) {
|
||||
tap_code(KC_VOLU);
|
||||
} else {
|
||||
tap_code(KC_VOLD);
|
||||
}
|
||||
} else { // RIGHT
|
||||
// Scroll
|
||||
if (clockwise) {
|
||||
tap_code(KC_PGDN);
|
||||
} else {
|
||||
tap_code(KC_PGUP);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
18
keyboards/z12/keymaps/zigotica/encoder.h
Normal file
18
keyboards/z12/keymaps/zigotica/encoder.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/* Copyright 2020 Sergi Meseguer <zigotica@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "zigotica.h"
|
126
keyboards/z12/keymaps/zigotica/keymap.c
Normal file
126
keyboards/z12/keymaps/zigotica/keymap.c
Normal file
@@ -0,0 +1,126 @@
|
||||
/* Copyright 2020
|
||||
Sergi Meseguer <zigotica@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "zigotica.h"
|
||||
|
||||
// Custom Keycodes
|
||||
#define MODE_1 TO(_TERMINAL)
|
||||
#define MODE_2 TO(_FIGMA)
|
||||
#define MODE_3 TO(_BROWSER)
|
||||
#define MODE_4 TO(_VIM)
|
||||
|
||||
enum custom_keycodes {
|
||||
VIM_SIP = SAFE_RANGE
|
||||
};
|
||||
|
||||
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
|
||||
switch (keycode) {
|
||||
case VIM_SIP:
|
||||
if (record->event.pressed) {
|
||||
register_code(KC_ESC);
|
||||
SEND_STRING(":Ag ");
|
||||
} else {
|
||||
// released
|
||||
unregister_code(KC_ESC);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
|
||||
/*
|
||||
* TERMINAL Layer
|
||||
*
|
||||
* ,-----------------------------.
|
||||
* | | TERM | FIGM | |
|
||||
* |-------+------+------+-------|
|
||||
* | VOL | BROW | VIM | SCROLL|
|
||||
* |-------+------+------+-------|
|
||||
* |-------+-------+-------|
|
||||
* | MEDIA | o | o |
|
||||
* |-------+-------+-------|
|
||||
* | o | o | o |
|
||||
* |-------+-------+-------|
|
||||
*/
|
||||
[_TERMINAL] = LAYOUT(
|
||||
MODE_1, MODE_2,
|
||||
ZK_MEDIA, MODE_3, MODE_4, _______,
|
||||
_______, _______, _______,
|
||||
_______, _______, _______
|
||||
),
|
||||
/*
|
||||
* VIM Layer
|
||||
*
|
||||
* ,-----------------------------.
|
||||
* | | TERM | FIGM | |
|
||||
* |-------+------+------+-------|
|
||||
* |BUFFER | BROW | VIM | SCROLL|
|
||||
* |-------+------+------+-------|
|
||||
* |-------+-------+-------|
|
||||
* |SEARCH | o | o |
|
||||
* |-------+-------+-------|
|
||||
* | o | o | o |
|
||||
* |-------+-------+-------|
|
||||
*/
|
||||
[_VIM] = LAYOUT(
|
||||
_______, _______,
|
||||
_______, _______, _______, _______,
|
||||
VIM_SIP, _______, _______,
|
||||
_______, _______, _______
|
||||
),
|
||||
/*
|
||||
* FIGMA Layer
|
||||
*
|
||||
* ,-----------------------------.
|
||||
* | | TERM | FIGM | |
|
||||
* |-------+------+------+-------|
|
||||
* | VOL | BROW | VIM | ZOOM |
|
||||
* |-------+------+------+-------|
|
||||
* |-------+-------+-------|
|
||||
* | ZOOM | GRIDS | FULL |
|
||||
* |-------+-------+-------|
|
||||
* | o | o | o |
|
||||
* |-------+-------+-------|
|
||||
*/
|
||||
[_FIGMA] = LAYOUT(
|
||||
_______, _______,
|
||||
_______, _______, _______, _______,
|
||||
LSFT(KC_1), LCTL(KC_G), LGUI(KC_BSLS),
|
||||
_______, _______, _______
|
||||
),
|
||||
/*
|
||||
* BROWSER Layer
|
||||
*
|
||||
* ,-----------------------------.
|
||||
* | | TERM | FIGM | |
|
||||
* |-------+------+------+-------|
|
||||
* | TABS | BROW | VIM | SCROLL|
|
||||
* |-------+------+------+-------|
|
||||
* |-------+-------+-------|
|
||||
* |SEARCH | BOOKM | DEVTL |
|
||||
* |-------+-------+-------|
|
||||
* | o | o | o |
|
||||
* |-------+-------+-------|
|
||||
*/
|
||||
[_BROWSER] = LAYOUT(
|
||||
_______, _______,
|
||||
_______, _______, _______, _______,
|
||||
G(KC_F), G(KC_D), G(A(KC_I)),
|
||||
_______, _______, _______
|
||||
),
|
||||
};
|
43
keyboards/z12/keymaps/zigotica/oled.c
Normal file
43
keyboards/z12/keymaps/zigotica/oled.c
Normal file
@@ -0,0 +1,43 @@
|
||||
/* Copyright 2020 Sergi Meseguer <zigotica@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "zigotica.h"
|
||||
|
||||
static void render_status(void) {
|
||||
oled_write_P(PSTR("z12 v1.0\n"), false);
|
||||
oled_write_P(PSTR("Layer: "), false);
|
||||
switch (get_highest_layer(layer_state)) {
|
||||
case _VIM:
|
||||
oled_write_P(PSTR("VIM\n\nBUFFER SCROLL"), false);
|
||||
break;
|
||||
case _FIGMA:
|
||||
oled_write_P(PSTR("FIGMA\n\nVOLUME ZOOM"), false);
|
||||
break;
|
||||
case _BROWSER:
|
||||
oled_write_P(PSTR("BROWSER\n\nTABS SCROLL"), false);
|
||||
break;
|
||||
case _TERMINAL:
|
||||
oled_write_P(PSTR("TERMINAL\n\nVOLUME SCROLL"), false);
|
||||
break;
|
||||
default:
|
||||
oled_write_P(PSTR("Undef\n"), false);
|
||||
}
|
||||
}
|
||||
|
||||
void oled_task_user(void) {
|
||||
render_status();
|
||||
}
|
||||
|
18
keyboards/z12/keymaps/zigotica/oled.h
Normal file
18
keyboards/z12/keymaps/zigotica/oled.h
Normal file
@@ -0,0 +1,18 @@
|
||||
/* Copyright 2020 Sergi Meseguer <zigotica@gmail.com>
|
||||
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
#include "zigotica.h"
|
4
keyboards/z12/keymaps/zigotica/rules.mk
Normal file
4
keyboards/z12/keymaps/zigotica/rules.mk
Normal file
@@ -0,0 +1,4 @@
|
||||
OLED_ENABLE = yes # Enables the use of OLED displays
|
||||
RAW_ENABLE = yes
|
||||
TAP_DANCE_ENABLE = yes
|
||||
MOUSEKEY_ENABLE = yes
|
@@ -18,22 +18,6 @@
|
||||
|
||||
#ifdef ENCODER_ENABLE
|
||||
bool encoder_update_kb(uint8_t index, bool clockwise) {
|
||||
if (!encoder_update_user(index, clockwise)) { return false; }
|
||||
if (index == 0) { // LEFT
|
||||
// Scroll
|
||||
if (clockwise) {
|
||||
tap_code_delay(KC_PGDN, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_PGUP, 10);
|
||||
}
|
||||
} else { // RIGHT
|
||||
// Volume control.
|
||||
if (clockwise) {
|
||||
tap_code_delay(KC_VOLU, 10);
|
||||
} else {
|
||||
tap_code_delay(KC_VOLD, 10);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
return encoder_update_user(index, clockwise);
|
||||
}
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user