diff options
Diffstat (limited to 'users')
-rw-r--r-- | users/moults31/gdb.c | 59 | ||||
-rw-r--r-- | users/moults31/gdb.h | 21 | ||||
-rw-r--r-- | users/moults31/moults31.c | 114 | ||||
-rw-r--r-- | users/moults31/moults31.h | 61 | ||||
-rw-r--r-- | users/moults31/obs.c | 80 | ||||
-rw-r--r-- | users/moults31/obs.h | 21 | ||||
-rw-r--r-- | users/moults31/readme.md | 5 | ||||
-rw-r--r-- | users/moults31/rules.mk | 10 | ||||
-rw-r--r-- | users/moults31/vscode.c | 90 | ||||
-rw-r--r-- | users/moults31/vscode.h | 21 |
10 files changed, 482 insertions, 0 deletions
diff --git a/users/moults31/gdb.c b/users/moults31/gdb.c new file mode 100644 index 0000000000..42f5513eca --- /dev/null +++ b/users/moults31/gdb.c @@ -0,0 +1,59 @@ +/* Copyright 2021 moults31 + * + * 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 "gdb.h" + +bool process_record_gdb(uint16_t keycode, keyrecord_t *record) { + bool rv = true; + switch (keycode) { + case M_GDB_PLAY: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_F5)); + } + break; + case M_GDB_PAUSE: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_F6)); + } + break; + case M_GDB_STEPOVER: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_F10)); + } + break; + case M_GDB_STEPIN: + if (record->event.pressed) { + SEND_STRING(SS_TAP(X_F11)); + } + break; + case M_GDB_STEPOUT: + if (record->event.pressed) { + SEND_STRING(SS_LSFT(SS_TAP(X_F11))); + } + break; + case M_GDB_RESTART: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LSFT(SS_TAP(X_F5)))); + } + break; + case M_GDB_STOP: + if (record->event.pressed) { + SEND_STRING(SS_LSFT(SS_TAP(X_F5))); + } + break; + } + + return rv; +} diff --git a/users/moults31/gdb.h b/users/moults31/gdb.h new file mode 100644 index 0000000000..385825692e --- /dev/null +++ b/users/moults31/gdb.h @@ -0,0 +1,21 @@ +/* Copyright 2021 moults31 + * + * 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 QMK_KEYBOARD_H +#include "moults31.h" + +bool process_record_gdb(uint16_t keycode, keyrecord_t *record); diff --git a/users/moults31/moults31.c b/users/moults31/moults31.c new file mode 100644 index 0000000000..0dbaed0bb0 --- /dev/null +++ b/users/moults31/moults31.c @@ -0,0 +1,114 @@ +/* Copyright 2021 moults31 + * + * 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 "moults31.h" + +bool moults31_tap_custom_code(uint16_t keycode) { + keyrecord_t record = { + .event = { + .pressed = 1, + }, + }; + return process_record_user(keycode, &record); +} + +bool process_record_user(uint16_t keycode, keyrecord_t *record) { + bool rv = true; + switch (keycode) { + case M_MST_CODEBLOCK: + if (record->event.pressed) { + SEND_STRING("```"); + } + break; + + case M_VSC_TERMFOCUS: + case M_VSC_SIDEBARFOCUS: + case M_VSC_SIDEBARCLOSE: + case M_VSC_FILECLOSE: + case M_VSC_FILENXT: + case M_VSC_FILEPRV: + case M_VSC_DBGCNSLFOCUS: + case M_VSC_MVEDTRNXTGRP: + case M_VSC_MVEDTRPRVGRP: + case M_VSC_EDGRPNXT: + case M_VSC_EDGRPPRV: + case M_VSC_VIEWSIZEINC: + case M_VSC_VIEWSIZEDEC: + rv = process_record_vsc(keycode, record); + break; + + case M_GDB_PLAY: + case M_GDB_PAUSE: + case M_GDB_STEPOVER: + case M_GDB_STEPIN: + case M_GDB_STEPOUT: + case M_GDB_RESTART: + case M_GDB_STOP: + rv = process_record_gdb(keycode, record); + break; + + case M_OBS_BRB: + case M_OBS_GAME: + case M_OBS_JSTCHT: + case M_OBS_DSKT_MUTE: + case M_OBS_DSKT_UNMUTE: + case M_OBS_VOICE_MUTE: + case M_OBS_VOICE_UNMUTE: + case M_OBS_MOOSIC_MUTE: + case M_OBS_MOOSIC_UNMUTE: + rv = process_record_obs(keycode, record); + break; + } + return rv; +}; + +#ifdef ENCODER_ENABLE +__attribute__((weak)) bool encoder_update_user(uint8_t index, bool clockwise) { + const layer_state_t curr_layer = get_highest_layer(layer_state); + if (index == 1) { /* Bottom encoder */ + if(curr_layer == 2 || curr_layer == 3) { + if (clockwise) { + moults31_tap_custom_code(M_VSC_FILENXT); + } else { + moults31_tap_custom_code(M_VSC_FILEPRV); + } + } + else { + if (clockwise) { + tap_code(KC_VOLU); + } else { + tap_code(KC_VOLD); + } + } + } + if (index == 0) { /* Top encoder */ + if(curr_layer == 2 || curr_layer == 3) { + if (clockwise) { + moults31_tap_custom_code(M_VSC_VIEWSIZEINC); + } else { + moults31_tap_custom_code(M_VSC_VIEWSIZEDEC); + } + } + else { + if (clockwise) { + tap_code(KC_MNXT); + } else { + tap_code(KC_MPRV); + } + } + } + return false; +} +#endif diff --git a/users/moults31/moults31.h b/users/moults31/moults31.h new file mode 100644 index 0000000000..60e317b784 --- /dev/null +++ b/users/moults31/moults31.h @@ -0,0 +1,61 @@ +/* Copyright 2021 moults31 + * + * 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 QMK_KEYBOARD_H + +#include "vscode.h" +#include "obs.h" +#include "gdb.h" + +bool moults31_tap_custom_code(uint16_t keycode); + +enum custom_keycodes { + // VSCode keycodes + M_VSC_TERMFOCUS = SAFE_RANGE, + M_VSC_SIDEBARFOCUS, + M_VSC_SIDEBARCLOSE, + M_VSC_DBGCNSLFOCUS, + M_VSC_EDGRPNXT, + M_VSC_EDGRPPRV, + M_VSC_MVEDTRNXTGRP, + M_VSC_MVEDTRPRVGRP, + M_VSC_VIEWSIZEINC, + M_VSC_VIEWSIZEDEC, + M_VSC_FILECLOSE, + M_VSC_FILENXT, + M_VSC_FILEPRV, + // GDB keycodes (for vscode debugger) + M_GDB_PLAY, + M_GDB_PAUSE, + M_GDB_STEPOVER, + M_GDB_STEPIN, + M_GDB_STEPOUT, + M_GDB_RESTART, + M_GDB_STOP, + // MS Teams keycodes + M_MST_CODEBLOCK, + // OBS keycodes + M_OBS_BRB, + M_OBS_GAME, + M_OBS_JSTCHT, + M_OBS_DSKT_MUTE, + M_OBS_DSKT_UNMUTE, + M_OBS_VOICE_MUTE, + M_OBS_VOICE_UNMUTE, + M_OBS_MOOSIC_MUTE, + M_OBS_MOOSIC_UNMUTE, +}; diff --git a/users/moults31/obs.c b/users/moults31/obs.c new file mode 100644 index 0000000000..0ae5f3deb4 --- /dev/null +++ b/users/moults31/obs.c @@ -0,0 +1,80 @@ +/* Copyright 2021 moults31 + * + * 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 "obs.h" + +bool process_record_obs(uint16_t keycode, keyrecord_t *record) { + // Apply all 4 mods for custom OBS macros + register_code(KC_LSHIFT); + register_code(KC_LCTL); + register_code(KC_LALT); + register_code(KC_LGUI); + + switch (keycode) { + case M_OBS_BRB: + if (record->event.pressed) { + SEND_STRING("1"); + } + break; + case M_OBS_GAME: + if (record->event.pressed) { + SEND_STRING("2"); + } + break; + case M_OBS_JSTCHT: + if (record->event.pressed) { + SEND_STRING("3"); + } + break; + case M_OBS_DSKT_MUTE: + if (record->event.pressed) { + SEND_STRING("4"); + } + break; + case M_OBS_DSKT_UNMUTE: + if (record->event.pressed) { + SEND_STRING("5"); + } + break; + case M_OBS_VOICE_MUTE: + if (record->event.pressed) { + SEND_STRING("6"); + } + break; + case M_OBS_VOICE_UNMUTE: + if (record->event.pressed) { + SEND_STRING("7"); + } + break; + case M_OBS_MOOSIC_MUTE: + if (record->event.pressed) { + SEND_STRING("8"); + } + break; + case M_OBS_MOOSIC_UNMUTE: + if (record->event.pressed) { + SEND_STRING("9"); + } + break; + } + + // Unpress all 4 mods for custom OBS macros + unregister_code(KC_LSHIFT); + unregister_code(KC_LCTL); + unregister_code(KC_LALT); + unregister_code(KC_LGUI); + + return true; +} diff --git a/users/moults31/obs.h b/users/moults31/obs.h new file mode 100644 index 0000000000..2a2973f802 --- /dev/null +++ b/users/moults31/obs.h @@ -0,0 +1,21 @@ +/* Copyright 2021 moults31 + * + * 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 QMK_KEYBOARD_H +#include "moults31.h" + +bool process_record_obs(uint16_t keycode, keyrecord_t *record); diff --git a/users/moults31/readme.md b/users/moults31/readme.md new file mode 100644 index 0000000000..3a5badbe5b --- /dev/null +++ b/users/moults31/readme.md @@ -0,0 +1,5 @@ +# moults31 Userspace + +## Features + +- Custom macros for VScode, OBS, GDB (Visual) diff --git a/users/moults31/rules.mk b/users/moults31/rules.mk new file mode 100644 index 0000000000..af7c11d9f8 --- /dev/null +++ b/users/moults31/rules.mk @@ -0,0 +1,10 @@ +SRC += moults31.c + +# Custom macro sources +SRC += vscode.c +SRC += obs.c +SRC += gdb.c + +ifneq ($(PLATFORM),CHIBIOS) + LTO_ENABLE = yes # Enable link time optimization +endif diff --git a/users/moults31/vscode.c b/users/moults31/vscode.c new file mode 100644 index 0000000000..a2fcf062dc --- /dev/null +++ b/users/moults31/vscode.c @@ -0,0 +1,90 @@ +/* Copyright 2021 moults31 + * + * 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 "vscode.h" + +bool process_record_vsc(uint16_t keycode, keyrecord_t *record) { + bool rv = true; + + switch (keycode) { + case M_VSC_TERMFOCUS: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL("`")); + } + break; + case M_VSC_SIDEBARFOCUS: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL("0")); + } + break; + case M_VSC_SIDEBARCLOSE: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL("b")); + } + break; + case M_VSC_FILECLOSE: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL("w")); + } + break; + case M_VSC_FILENXT: + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LCTRL) SS_TAP(X_K) SS_TAP(X_PGDOWN) SS_UP(X_LCTRL)); + } + break; + case M_VSC_FILEPRV: + if (record->event.pressed) { + SEND_STRING(SS_DOWN(X_LCTRL) SS_TAP(X_K) SS_TAP(X_PGUP) SS_UP(X_LCTRL)); + } + break; + case M_VSC_DBGCNSLFOCUS: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_D)))); + } + break; + case M_VSC_MVEDTRNXTGRP: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_RIGHT)))); + } + break; + case M_VSC_MVEDTRPRVGRP: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_LEFT)))); + } + break; + case M_VSC_EDGRPNXT: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_L)))); + } + break; + case M_VSC_EDGRPPRV: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_K)))); + } + break; + case M_VSC_VIEWSIZEINC: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_P)))); + } + break; + case M_VSC_VIEWSIZEDEC: + if (record->event.pressed) { + SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_O)))); + } + break; + } + + return rv; +} diff --git a/users/moults31/vscode.h b/users/moults31/vscode.h new file mode 100644 index 0000000000..7e88b6591a --- /dev/null +++ b/users/moults31/vscode.h @@ -0,0 +1,21 @@ +/* Copyright 2021 moults31 + * + * 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 QMK_KEYBOARD_H +#include "moults31.h" + +bool process_record_vsc(uint16_t keycode, keyrecord_t *record); |