Fix handwired/ms_sculpt_mobile default keymap (#16032)
This commit is contained in:
@@ -0,0 +1,460 @@
|
||||
/* A library to output the right key shortcut in any common app.
|
||||
Given a global variable babble_mode to show the environment and a
|
||||
key that calls the paste macro, do the right type of paste.
|
||||
Setting the context is done by another macro, or TBD interaction with the host.
|
||||
|
||||
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
|
||||
and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
|
||||
*/
|
||||
|
||||
#include "babblePaste.h"
|
||||
|
||||
#include "action_macro.h"
|
||||
|
||||
#ifdef USE_BABLPASTE
|
||||
|
||||
// GLOBAL variable to determine mode. Sets startup default if no eeppom
|
||||
uint8_t babble_mode =0 ;
|
||||
|
||||
// small function that we might also want to call from a keymap.
|
||||
|
||||
macro_t* switch_babble_mode( uint8_t id) {
|
||||
babble_mode= id;
|
||||
return MACRO_NONE; //less typing where called
|
||||
}
|
||||
|
||||
|
||||
// Today I learned that the preprocessor can not create a switch statement label from an argument
|
||||
// And else statements have problems, see https://gcc.gnu.org/onlinedocs/gcc-3.0.1/cpp_3.html#SEC15
|
||||
#define BABLM(ent, macro...) \
|
||||
if ( ent == shortcut ) \
|
||||
{ action_macro_play( MACRO(macro)); return MACRO_NONE; }
|
||||
|
||||
|
||||
/* this function runs the appropriate babblepaste macro, given
|
||||
the global babble_mode, and a shortcut from the ENUM in babblePaste.h
|
||||
TODO, the pointers in this function should be stored in a PROGMEM array, not ram.
|
||||
But that requires even more clever preprocessor foo.
|
||||
*/
|
||||
const macro_t *babblePaste (keyrecord_t *record, uint8_t shortcut) {
|
||||
/*
|
||||
if ( shortcut < BABL_START_NUM || \
|
||||
shortcut >= (BABL_START_NUM + BABL_NUM_MACROS ) ) {
|
||||
return MACRO_NONE;
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
#ifdef MS_MODE
|
||||
if ( BABL_WINDOWS == shortcut ) { return switch_babble_mode(MS_MODE); }
|
||||
#endif
|
||||
#ifdef MAC_MODE
|
||||
if ( BABL_MAC == shortcut) { return switch_babble_mode(MAC_MODE); }
|
||||
#endif
|
||||
#ifdef LINUX_MODE
|
||||
if ( BABL_LINUX == shortcut ) { return switch_babble_mode(LINUX_MODE); }
|
||||
#endif
|
||||
#ifdef READMUX_MODE
|
||||
if ( BABL_READLINE == shortcut ) { switch_babble_mode(READMUX_MODE); return MACRO_NONE; }
|
||||
#endif
|
||||
#ifdef VI_MODE
|
||||
if ( BABL_VI == shortcut ) { return switch_babble_mode(VI_MODE); }
|
||||
#endif
|
||||
#ifdef EMACS_MODE
|
||||
if ( BABL_EMACS == shortcut ) { return switch_babble_mode(EMACS_MODE); }
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
switch(babble_mode) {
|
||||
|
||||
#ifdef MS_MODE
|
||||
|
||||
case MS_MODE:
|
||||
BABLM( BABL_GO_LEFT_1C, T(LEFT), END );
|
||||
BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END );
|
||||
BABLM( BABL_GO_LEFT_WORD, D(LCTL), T(LEFT), U(LCTL), END );
|
||||
BABLM( BABL_GO_RIGHT_WORD, D(LCTL), T(RIGHT), U(LCTL), END );
|
||||
BABLM( BABL_GO_START_LINE, T(HOME), END );
|
||||
BABLM( BABL_GO_END_LINE, T(END), END );
|
||||
BABLM( BABL_GO_START_DOC, D(LCTL),T(HOME), U(LCTL),END );
|
||||
BABLM( BABL_GO_END_DOC, D(LCTL),T(END), U(LCTL),END );
|
||||
BABLM( BABL_GO_NEXT_LINE, T(DOWN), END );
|
||||
BABLM( BABL_GO_PREV_LINE, T(UP), END );
|
||||
BABLM( BABL_PGDN, T(PGDN), END );
|
||||
BABLM( BABL_PGUP, T(PGUP), END );
|
||||
BABLM( BABL_DEL_RIGHT_1C, T(DEL), END );
|
||||
BABLM( BABL_DEL_LEFT_WORD, D(LCTL), T(BSPACE), U(LCTL), END );
|
||||
BABLM( BABL_DEL_RIGHT_WORD, D(LCTL), T(DEL), U(LCTL), END );
|
||||
BABLM( BABL_DEL_TO_LINE_END, D(RSFT), T(HOME), U(RSFT), T(DEL), END);
|
||||
BABLM( BABL_DEL_TO_LINE_START, D(RSFT), T(END), U(RSFT), T(DEL), END );
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
BABLM( BABL_UNDO, D(LCTL), T(Z), U(LCTL), END );
|
||||
BABLM( BABL_REDO, D(LCTL), T(Y), U(LCTL), END );
|
||||
BABLM( BABL_CUT, D(LCTL), T(X), U(LCTL), END );
|
||||
BABLM( BABL_COPY, D(LCTL), T(C), U(LCTL), END );
|
||||
BABLM( BABL_PASTE, D(LCTL), T(V), U(LCTL), END );
|
||||
BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END );
|
||||
BABLM( BABL_FIND, D(LCTL),T(F), U(LCTL),END );
|
||||
BABLM( BABL_FIND_NEXT, T(F3),END );
|
||||
BABLM( BABL_FIND_REPLACE, D(LCTL),T(H), U(LCTL),END );
|
||||
BABLM( BABL_RUNAPP, D(LGUI),T(R), U(LGUI),END );
|
||||
BABLM( BABL_SWITCH_APP_NEXT, D(LALT),T(TAB), U(LALT),END );
|
||||
BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LALT),T(TAB), U(LALT), U(LSFT),END );
|
||||
BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END );
|
||||
BABLM( BABL_HELP, T(F1),END );
|
||||
#ifndef BABL_NOBROWSER
|
||||
BABLM( BABL_BROWSER_NEW_TAB, D(LCTL), T(T), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_CLOSE_TAB, D(LCTL), T(W), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_NEXT_TAB, D(LCTL), T(TAB), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_PREV_TAB, D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_URL_BAR, D(LCTL), T(L), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_FORWARD, D(LALT), T(RIGHT), U(LALT),END );
|
||||
BABLM( BABL_BROWSER_BACK, D(LALT), T(LEFT), U(LALT),END );
|
||||
BABLM( BABL_BROWSER_FIND, D(LCTL), T(F), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_BOOKMARK, D(LCTL), T(D), U(LCTL),END );
|
||||
//BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LCTL),END ); // EDGE
|
||||
BABLM( BABL_BROWSER_DEV_TOOLS, D(LCTL), T(T), U(LCTL),END ); // Chrome
|
||||
// Chrome
|
||||
BABLM( BABL_BROWSER_RELOAD, D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache
|
||||
BABLM( BABL_BROWSER_FULLSCREEN, T(F11),END ); //command shift F
|
||||
BABLM( BABL_BROWSER_ZOOM_IN, D(LCTL), D(RSFT), T(EQL), U(RSFT), U(LCTL),END ); // ctr+ +
|
||||
BABLM( BABL_BROWSER_ZOOM_OUT, D(LCTL), T(MINS), U(LCTL),END );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Todo, ring bell, flash light, show user this isn't supported
|
||||
return MACRO_NONE;
|
||||
|
||||
|
||||
#endif /* MS_MODE*/
|
||||
|
||||
|
||||
#ifdef LINUX_MODE
|
||||
|
||||
case LINUX_MODE:
|
||||
BABLM( BABL_GO_LEFT_1C , T(LEFT), END );
|
||||
BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END );
|
||||
BABLM( BABL_GO_LEFT_WORD , D(LCTL), T(LEFT), U(LCTL), END );
|
||||
BABLM( BABL_GO_RIGHT_WORD , D(LCTL), T(RIGHT), U(LCTL), END );
|
||||
BABLM( BABL_GO_START_LINE , T(HOME), END );
|
||||
BABLM( BABL_GO_END_LINE , T(END), END );
|
||||
BABLM( BABL_GO_START_DOC , D(LCTL),T(HOME), U(LCTL),END );
|
||||
BABLM( BABL_GO_END_DOC , D(LCTL),T(END), U(LCTL),END );
|
||||
BABLM( BABL_GO_NEXT_LINE , T(DOWN), END );
|
||||
BABLM( BABL_GO_PREV_LINE , T(UP), END );
|
||||
BABLM( BABL_PGDN , T(PGDN), END );
|
||||
BABLM( BABL_PGUP , T(PGUP), END );
|
||||
BABLM( BABL_DEL_RIGHT_1C , D(DEL), END );
|
||||
BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(BSPACE), U(LCTL), END );
|
||||
BABLM( BABL_DEL_RIGHT_WORD , D(LCTL), T(DEL), U(LCTL), END );
|
||||
BABLM( BABL_DEL_TO_LINE_END, D(RSFT), T(HOME), U(RSFT), T(DEL), END);
|
||||
BABLM( BABL_DEL_TO_LINE_START, D(RSFT), T(END), U(RSFT), T(DEL), END );
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
BABLM( BABL_UNDO , D(LCTL), T(Z), U(LCTL), END );
|
||||
BABLM( BABL_REDO , D(LCTL), T(Y), U(LCTL), END );
|
||||
BABLM( BABL_CUT , D(LCTL), T(X), U(LCTL), END );
|
||||
BABLM( BABL_COPY , D(LCTL), T(C), U(LCTL), END );
|
||||
BABLM( BABL_PASTE , D(LCTL), T(V), U(LCTL), END );
|
||||
BABLM( BABL_SELECT_ALL, D(LCTL), T(A), U(LCTL), END );
|
||||
BABLM( BABL_FIND, D(LCTL),T(F), U(LCTL),END );
|
||||
/* BABLM(BABL_FIND_NEXT , T(F3),END ); KDE */
|
||||
BABLM( BABL_FIND_NEXT, D(LCTL),T(G), U(LCTL),END ); // Gnome*/
|
||||
/* BABLM( , D(LCTL),T(R), U(LCTL),END ); KDE */
|
||||
BABLM( BABL_FIND_REPLACE, D(LCTL),T(H), U(LCTL),END ); // Gnome*/
|
||||
BABLM( BABL_RUNAPP, D(LALT),T(F2), U(LALT),END );
|
||||
BABLM( BABL_SWITCH_APP_NEXT, D(LCTL),T(TAB), U(LCTL),END );
|
||||
BABLM( BABL_SWITCH_APP_LAST, D(LSFT),D(LCTL),T(TAB), U(LCTL), U(LSFT),END );
|
||||
BABLM( BABL_CLOSE_APP, D(LALT),T(F4), U(LALT),END );
|
||||
//BABLM( BABL_HELP, END );
|
||||
|
||||
#ifndef BABL_NOBROWSER
|
||||
BABLM( BABL_BROWSER_NEW_TAB, D(LCTL), T(T), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_CLOSE_TAB, D(LCTL), T(W), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LCTL), D(RSFT),T(T), U(RSFT),U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_NEXT_TAB, D(LCTL), T(TAB), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_PREV_TAB, D(LCTL), D(RSFT), T(TAB), U(RSFT), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_URL_BAR, D(LCTL), T(L), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_FORWARD, D(LALT), T(RIGHT), U(LALT),END );
|
||||
BABLM( BABL_BROWSER_BACK, D(LALT), T(LEFT), U(LALT),END );
|
||||
BABLM( BABL_BROWSER_FIND, D(LCTL), T(F), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_BOOKMARK, D(LCTL), T(D), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_DEV_TOOLS, D(LCTL), T(T), U(LCTL),END ); // Chrome
|
||||
BABLM( BABL_BROWSER_RELOAD, D(LCTL), T(F5), U(LCTL),END ); // hard reload w/o cache
|
||||
BABLM( BABL_BROWSER_FULLSCREEN, T(F11),END ); //command shift F
|
||||
BABLM( BABL_BROWSER_ZOOM_IN, D(LCTL), T(PLUS), U(LCTL),END );
|
||||
BABLM( BABL_BROWSER_ZOOM_OUT, D(LCTL), T(MINS), U(LCTL),END );
|
||||
#endif
|
||||
#endif
|
||||
return MACRO_NONE;
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef MAC_MODE
|
||||
|
||||
case MAC_MODE:
|
||||
BABLM( BABL_GO_LEFT_1C , T(LEFT), END );
|
||||
BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END );
|
||||
BABLM( BABL_GO_LEFT_WORD , D(LALT), T(LEFT), U(LALT), END );
|
||||
BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(RIGHT), U(LALT), END );
|
||||
BABLM( BABL_GO_START_LINE , D(LGUI), T(LEFT), U(LGUI), END );
|
||||
BABLM( BABL_GO_END_LINE , D(LGUI), T(RIGHT), U(LGUI), END );
|
||||
BABLM( BABL_GO_START_DOC , D(LGUI),T(UP), U(LGUI),END );
|
||||
BABLM( BABL_GO_END_DOC , D(LGUI),T(DOWN), U(LGUI),END );
|
||||
BABLM( BABL_GO_NEXT_LINE , T(DOWN), END );
|
||||
BABLM( BABL_GO_PREV_LINE , T(UP), END );
|
||||
BABLM( BABL_PGDN , D(LALT),T(DOWN), U(LALT), END );
|
||||
BABLM( BABL_PGUP , D(LALT),T(UP), U(LALT), END );
|
||||
BABLM( BABL_DEL_RIGHT_1C , D(DEL), END );
|
||||
BABLM( BABL_DEL_LEFT_WORD , D(LALT), T(BSPACE), U(LALT), END );
|
||||
BABLM( BABL_DEL_RIGHT_WORD, D(LALT), T(DEL), U(LALT), END );
|
||||
BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END );// there must be another way
|
||||
BABLM( BABL_DEL_TO_LINE_START, D(LGUI), T(BSPACE), U(LGUI), END );
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
BABLM( BABL_UNDO , D(1), D(LGUI), T(Z), U(LGUI), END );
|
||||
BABLM( BABL_REDO , D(LSFT),D(LGUI), T(Z), U(LSFT),U(LGUI), END );
|
||||
BABLM( BABL_CUT , D(LGUI), T(X), U(LGUI), END );
|
||||
BABLM( BABL_COPY , D(LGUI), T(C), U(LGUI), END );
|
||||
BABLM( BABL_PASTE , D(LGUI), T(V), U(LGUI), END );
|
||||
BABLM( BABL_SELECT_ALL , D(LGUI), T(A), U(LGUI), END );
|
||||
BABLM( BABL_FIND , D(LGUI),T(F), U(LGUI),END );
|
||||
BABLM( BABL_FIND_NEXT, D(LGUI),T(G), U(LGUI),END );
|
||||
BABLM( BABL_FIND_REPLACE, D(LGUI),T(F), U(LGUI),END );
|
||||
BABLM( BABL_RUNAPP , D(LGUI),T(R), U(LGUI),END );
|
||||
BABLM( BABL_SWITCH_APP_NEXT , D(LGUI),T(TAB), U(LGUI),END );
|
||||
BABLM( BABL_SWITCH_APP_LAST , D(LSFT),D(LGUI),T(TAB), U(LGUI), U(LSFT),END );
|
||||
BABLM( BABL_CLOSE_APP , D(LGUI),T(Q), U(LGUI),END );
|
||||
BABLM( BABL_HELP , D(LSFT),D(LGUI),T(SLASH), U(LGUI), U(LSFT),END );
|
||||
|
||||
#ifndef BABL_NOBROWSER
|
||||
BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END );
|
||||
//BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE
|
||||
BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome
|
||||
// Chrome
|
||||
BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
|
||||
BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
|
||||
BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ +
|
||||
BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END );
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return MACRO_NONE;
|
||||
#endif
|
||||
|
||||
#ifdef EMACS_MODE
|
||||
|
||||
case EMACS_MODE:
|
||||
switch(shortcut) {
|
||||
//probably should allow meta to not be ALT
|
||||
|
||||
BABLM( BABL_GO_LEFT_1C, T(LEFT), END );
|
||||
BABLM( BABL_GO_RIGHT_1C, T(RIGHT), END );
|
||||
BABLM( BABL_GO_LEFT_WORD, D(LALT), T(B), U(LALT), END );
|
||||
BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END );
|
||||
BABLM( BABL_GO_START_LINE , D(LCTL), T(A), U(LCTL), END );
|
||||
BABLM( BABL_GO_END_LINE , D(LCTL), T(E), U(LCTL), END );
|
||||
BABLM( BABL_GO_START_DOC , D(LALT), D(LSFT), T(COMM),U(LSFT), U(LALT) ,END );
|
||||
BABLM( BABL_GO_END_DOC , D(LALT), D(LSFT), T(DOT), U(LSFT), U(LALT) ,END );
|
||||
BABLM( BABL_GO_NEXT_LINE , D(LCTL), T(N), U(LCTL), END );
|
||||
BABLM( BABL_GO_PREV_LINE , D(LCTL), T(P), U(LCTL), END );
|
||||
BABLM( BABL_PGDN , D(LCTL), T(V), U(LCTL), END );
|
||||
BABLM( BABL_PGUP , D(LALT), T(V), U(LALT), END );
|
||||
BABLM( BABL_DEL_RIGHT_1C, D(LCTL), T(D), U(LCTL),END );
|
||||
BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(BSPACE), U(LCTL), END );
|
||||
BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END );
|
||||
BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END );
|
||||
BABLM( BABL_DEL_TO_LINE_START, T(ESC), T(0), D(LCTL), T(K), U(LCTL), END );
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
BABLM( BABL_UNDO , D(LCTL), T(X), U(LCTL),T(C), END );
|
||||
BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
|
||||
BABLM( BABL_CUT , D(LCTL), T(W), U(LCTL), END );
|
||||
BABLM( BABL_COPY , D(LALT), T(W), U(LALT), END ); //really?
|
||||
BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END );
|
||||
BABLM( BABL_SELECT_ALL ,D(LCTL), T(X), U(LCTL),T(H), END );
|
||||
BABLM( BABL_FIND , D(LCTL), T(S), U(LCTL),END );
|
||||
BABLM( BABL_FIND_NEXT , D(LCTL), T(S), U(LCTL),END );
|
||||
BABLM( BABL_FIND_REPLACE , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END );
|
||||
BABLM( BABL_RUNAPP , D(LALT), T(X), U(LALT),T(S),T(H),T(E),T(L),T(L),END );// arguably
|
||||
BABLM( BABL_SWITCH_APP_NEXT , D(LCTL), T(X), U(LCTL),T(RIGHT), END ); // arguably
|
||||
BABLM( BABL_SWITCH_APP_LAST , D(LCTL), T(X), U(LCTL),T(LEFT), END ); // arguably
|
||||
BABLM( BABL_CLOSE_APP , D(LCTL), T(X), U(LCTL),T(C),END );
|
||||
BABLM( BABL_HELP , D(LCTL),T(H), U(LCTL),T(A),END); // start search in help
|
||||
#ifndef BABL_NOBROWSER
|
||||
/* you get to figure w3 out
|
||||
BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END );
|
||||
//BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE
|
||||
BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome
|
||||
// Chrome
|
||||
BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
|
||||
BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
|
||||
BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), D(RSFT), T(EQL), U(RSFT), U(LGUI),END ); // ctr+ +
|
||||
BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END );
|
||||
*/
|
||||
#endif
|
||||
#endif
|
||||
break;
|
||||
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef VI_MODE
|
||||
case VI_MODE:
|
||||
// you have to track the modes yourself. Otherwise motion is awful (bell, bell, bell)
|
||||
|
||||
|
||||
BABLM( BABL_GO_LEFT_1C , T(H), END );
|
||||
BABLM( BABL_GO_RIGHT_1C , T(L), END );
|
||||
BABLM( BABL_GO_LEFT_WORD , T(B),END );
|
||||
BABLM( BABL_GO_RIGHT_WORD , T(W), END );
|
||||
BABLM( BABL_GO_START_LINE , D(LSFT), T(6),U(LSFT), END ); //^
|
||||
BABLM( BABL_GO_END_LINE , D(LSFT), T(4),U(LSFT) , END ); //$
|
||||
BABLM( BABL_GO_START_DOC , T(G),T(G) ,END );
|
||||
BABLM( BABL_GO_END_DOC , D(LSFT), T(G),U(LSFT),END );
|
||||
BABLM( BABL_GO_NEXT_LINE , T(J), END );
|
||||
BABLM( BABL_GO_PREV_LINE, T(K), END );
|
||||
BABLM( BABL_PGDN ,D(LCTL), T(F), U(LCTL), END );
|
||||
BABLM( BABL_PGUP , D(LCTL), T(B), U(LCTL), END );
|
||||
BABLM( BABL_DEL_RIGHT_1C , T(X),END );
|
||||
BABLM( BABL_DEL_LEFT_WORD , T(D),T(G),T(E),END );
|
||||
BABLM( BABL_DEL_RIGHT_WORD , T(D),T(W),END );
|
||||
BABLM( BABL_DEL_TO_LINE_END, T(D),D(LSFT), T(4),U(LSFT) ,END ); // d$
|
||||
BABLM( BABL_DEL_TO_LINE_START, T(D),D(LSFT), T(6),U(LSFT) ,END );
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
BABLM( BABL_UNDO , T(U), END );
|
||||
BABLM( BABL_REDO , D(LCTL), T(R), U(LCTL), END );
|
||||
BABLM( BABL_CUT , T(X), END );
|
||||
BABLM( BABL_COPY , T(Y),END );
|
||||
BABLM( BABL_PASTE , T(P), END );
|
||||
BABLM( BABL_SELECT_ALL , D(LSFT), T(SCLN),U(LSFT),D(LSFT), T(5),U(LSFT),T(Y), END ); // wrong but helpful?
|
||||
BABLM( BABL_FIND , T(SLASH),END );
|
||||
BABLM( BABL_FIND_NEXT , T(N),END );
|
||||
BABLM( BABL_FIND_REPLACE , D(LALT),D(LSFT), T(5),U(LSFT), U(LALT), END );
|
||||
BABLM( BABL_RUNAPP,END );
|
||||
BABLM( BABL_SWITCH_APP_NEXT ,END );
|
||||
BABLM( BABL_SWITCH_APP_LAST ,END );
|
||||
BABLM(BABL_CLOSE_APP, D(LSFT), T(SCLN),U(LSFT), T(Q), D(RSFT), T(1),U(RSFT), END );
|
||||
BABLM(BABL_HELP, D(LSFT), T(SCLN),U(LSFT),T(H),END); // start search in help
|
||||
#ifndef BABL_NOBROWSER
|
||||
/* you get to figure this out
|
||||
BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END );
|
||||
//BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE
|
||||
BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome
|
||||
// Chrome
|
||||
BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
|
||||
BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
|
||||
BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), T(PLUS), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END );
|
||||
*/
|
||||
#endif
|
||||
#endif
|
||||
return MACRO_NONE;
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef READMUX_MODE
|
||||
// Readline command line editing + tmux windowing
|
||||
// I havent decided how much to do readline and how much tmux
|
||||
|
||||
|
||||
case READMUX_MODE:
|
||||
|
||||
BABLM( BABL_GO_LEFT_1C , T(LEFT), END );
|
||||
BABLM( BABL_GO_RIGHT_1C , T(RIGHT), END );
|
||||
BABLM( BABL_GO_LEFT_WORD , D(LALT), T(B), U(LALT), END );
|
||||
BABLM( BABL_GO_RIGHT_WORD , D(LALT), T(F), U(LALT), END );
|
||||
BABLM( BABL_GO_START_LINE , D(LCTL), T(A), U(LCTL), END );
|
||||
BABLM( BABL_GO_END_LINE , D(LCTL), T(E), U(LCTL), END );
|
||||
//BABLM( BABL_GO_START_DOC ,END );// tmux?
|
||||
//BABLM( BABL_GO_END_DOC ,END ); // tmux?
|
||||
BABLM( BABL_GO_NEXT_LINE , D(LCTL), T(N), U(LCTL), END );
|
||||
BABLM( BABL_GO_PREV_LINE , D(LCTL), T(P), U(LCTL), END );
|
||||
BABLM( BABL_PGDN , T(PGDN), END );
|
||||
BABLM( BABL_PGUP , T(PGUP), END );
|
||||
BABLM( BABL_DEL_RIGHT_1C , D(LCTL), T(D), U(LCTL),END );
|
||||
BABLM( BABL_DEL_LEFT_WORD , D(LCTL), T(W), U(LCTL), END );
|
||||
BABLM( BABL_DEL_RIGHT_WORD , D(LALT), T(D), U(LALT), END );
|
||||
BABLM( BABL_DEL_TO_LINE_END, D(LCTL), T(K), U(LCTL), END );
|
||||
BABLM( BABL_DEL_TO_LINE_START, D(LCTL), T(U), U(LCTL), END );
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
BABLM( BABL_UNDO , D(LALT), T(R), U(LALT) , END );
|
||||
BABLM( BABL_REDO , D(LCTL), T(X), U(LCTL),T(C), END ); // arguably
|
||||
BABLM( BABL_CUT , D(LCTL), T(K), U(LCTL), END ); // wrong half the time
|
||||
//BABLM( BABL_COPY ,END );
|
||||
BABLM( BABL_PASTE , D(LCTL), T(Y), U(LCTL), END );
|
||||
BABLM( BABL_SELECT_ALL , D(LCTL), T(A), T(K), T(Y), U(LCTL) , END );
|
||||
BABLM( BABL_FIND , D(LCTL), T(R), U(LCTL), END ); // search history
|
||||
BABLM(BABL_FIND_NEXT, D(LCTL), T(S), U(LCTL), END );
|
||||
//BABLM( BABL_FIND_REPLACE ,END );
|
||||
BABLM( BABL_RUNAPP , D(LCTL), T(B), U(LCTL), T(C),END ); //tmux
|
||||
BABLM( BABL_SWITCH_APP_NEXT , D(LCTL), T(B), U(LCTL), T(N),END ); //tmux
|
||||
BABLM( BABL_SWITCH_APP_LAST , D(LCTL), T(B), U(LCTL), T(P),END ); //tmux
|
||||
BABLM( BABL_CLOSE_APP , D(LCTL), T(B), U(LCTL), T(D),END); // usually what I want
|
||||
// BABLM( BABL_HELP ,END );
|
||||
#ifndef BABL_NOBROWSER
|
||||
/* Add lynx shortcuts?
|
||||
BABLM( BABL_BROWSER_NEW_TAB, D(LGUI), T(T), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_CLOSE_TAB, D(LGUI), T(W), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_REOPEN_LAST_TAB, D(LGUI), D(RSFT),T(T), U(RSFT),U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_NEXT_TAB, D(LGUI),D(LALT), T(RIGHT),U(LALT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_PREV_TAB, D(LGUI), D(RSFT), T(LEFT), U(RSFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_URL_BAR, D(LGUI), T(L), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FORWARD, D(LGUI), T(RIGHT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BACK, D(LGUI), T(LEFT), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_FIND, D(LGUI), T(F), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_BOOKMARK, D(LGUI), T(D), U(LGUI),END );
|
||||
//BABLM( BABL_BROWSER_DEV_TOOLS, T(F12), U(LGUI),END ); // EDGE
|
||||
BABLM( BABL_BROWSER_DEV_TOOLS, D(LGUI), D(LALT), T(I), U(LALT),U(LGUI),END ); // Chrome
|
||||
// Chrome
|
||||
BABLM( BABL_BROWSER_RELOAD, D(LGUI), T(R), U(LGUI),END ); // add shift for reload w/o cache
|
||||
BABLM( BABL_BROWSER_FULLSCREEN, D(LGUI), D(LCTL), T(P), U(LCTL), U(LGUI),END ); //command shift F
|
||||
BABLM( BABL_BROWSER_ZOOM_IN, D(LGUI), T(PLUS), U(LGUI),END );
|
||||
BABLM( BABL_BROWSER_ZOOM_OUT, D(LGUI), T(MINS), U(LGUI),END );
|
||||
*/
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return MACRO_NONE;
|
||||
|
||||
#endif
|
||||
|
||||
default:
|
||||
return MACRO_NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,238 @@
|
||||
/* A library to output the right key shortcut in any common app.
|
||||
Given a global variable babble_mode to show the environment and a
|
||||
key that calls the paste macro, do the right type of paste.
|
||||
|
||||
Setting the bable_mode is done by another macro, or TBD interaction with the host.
|
||||
|
||||
Huge thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
|
||||
and jeebak & algernon's keymap
|
||||
*/
|
||||
#ifndef _babblePaste_h_included__
|
||||
#define _babblePaste_h_included__
|
||||
#include "config.h"
|
||||
#include "action_layer.h"
|
||||
#include "quantum_keycodes.h"
|
||||
|
||||
#ifdef USE_BABLPASTE
|
||||
|
||||
/* ***************************
|
||||
|
||||
// Uncomment any modes you want. Whatever mode = 0 will be the default on boot
|
||||
// Expect to get errors if you comment a feature out and leave it in your keymap.
|
||||
|
||||
#define USE_BABLPASTE
|
||||
|
||||
//#define MS_MODE 0 // Windows.
|
||||
//#define MAC_MODE 1
|
||||
//#define LINUX_MODE 2 //aka gnome+KDE
|
||||
//#define EMACS_MODE 3
|
||||
//#define VI_MODE 4
|
||||
//#define WORDSTAR_MODE 5
|
||||
//#define READMUX 6 // Readline and tmux
|
||||
|
||||
// This removes everything but cursor movement
|
||||
//#define BABL_MOVEMENTONLY
|
||||
// and this just removes browser shortcuts
|
||||
//#define BABL_NOBROWSER
|
||||
****************************/
|
||||
|
||||
|
||||
// Uncomment if you need more free flash space
|
||||
// It removes everything but cursor movement
|
||||
//#define BABL_MOVEMENTONLY
|
||||
|
||||
|
||||
// Define starting number for BABL macros in the macro range.
|
||||
// Probably can start the default even lower
|
||||
#define BABL_START_NUM 50
|
||||
|
||||
/* Macros handled by babblepaste. Most should be available for all platforms.
|
||||
Whatever isn't defined will NOP */
|
||||
enum {
|
||||
// Movement macros
|
||||
// left & right
|
||||
BABL_GO_LEFT_1C= BABL_START_NUM,
|
||||
BABL_GO_RIGHT_1C,
|
||||
BABL_GO_LEFT_WORD,
|
||||
BABL_GO_RIGHT_WORD,
|
||||
BABL_GO_START_LINE,
|
||||
BABL_GO_END_LINE,
|
||||
// now up & down
|
||||
BABL_GO_START_DOC,
|
||||
BABL_GO_END_DOC,
|
||||
BABL_GO_NEXT_LINE,
|
||||
BABL_GO_PREV_LINE,
|
||||
BABL_PGDN,
|
||||
BABL_PGUP,
|
||||
// And the delete options
|
||||
//BABL_DEL_LEFT_1C == backspace, so why bother.
|
||||
BABL_DEL_RIGHT_1C, // usually = Del
|
||||
BABL_DEL_LEFT_WORD,
|
||||
BABL_DEL_RIGHT_WORD,
|
||||
BABL_DEL_TO_LINE_END, // delete from cursor to end of line
|
||||
BABL_DEL_TO_LINE_START, // delete from cursor to begining line
|
||||
#ifndef BABL_MOVEMENTONLY
|
||||
// Cut & Paste
|
||||
BABL_UNDO,
|
||||
BABL_REDO,
|
||||
BABL_CUT,
|
||||
BABL_COPY,
|
||||
BABL_PASTE,
|
||||
BABL_SELECT_ALL,
|
||||
/* not yet implemented
|
||||
BABL_SWAP_LAST2C // swap last characters before the cursor
|
||||
BABL_SWAP_LAST2W // Swap the last two words before the cursor
|
||||
*/
|
||||
// find & replace
|
||||
BABL_FIND,
|
||||
BABL_FIND_NEXT,
|
||||
BABL_FIND_REPLACE,
|
||||
// GUI or app
|
||||
BABL_RUNAPP,
|
||||
BABL_SWITCH_APP_NEXT,
|
||||
BABL_SWITCH_APP_LAST, // previous
|
||||
BABL_CLOSE_APP,
|
||||
BABL_HELP,
|
||||
|
||||
#ifndef BABL_NOBROWSER
|
||||
BABL_BROWSER_NEW_TAB,
|
||||
BABL_BROWSER_CLOSE_TAB,
|
||||
BABL_BROWSER_REOPEN_LAST_TAB,
|
||||
BABL_BROWSER_NEXT_TAB,
|
||||
BABL_BROWSER_PREV_TAB,
|
||||
BABL_BROWSER_URL_BAR,
|
||||
BABL_BROWSER_FORWARD,
|
||||
BABL_BROWSER_BACK,
|
||||
BABL_BROWSER_FIND,
|
||||
BABL_BROWSER_BOOKMARK,
|
||||
BABL_BROWSER_DEV_TOOLS, // hard one to remember
|
||||
BABL_BROWSER_RELOAD,
|
||||
BABL_BROWSER_FULLSCREEN,
|
||||
BABL_BROWSER_ZOOM_IN,
|
||||
BABL_BROWSER_ZOOM_OUT,
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
// Macros for mode switching
|
||||
#ifdef MS_MODE
|
||||
BABL_WINDOWS,
|
||||
#endif
|
||||
#ifdef MAC_MODE
|
||||
BABL_MAC,
|
||||
#endif
|
||||
#ifdef LINUX_MODE
|
||||
BABL_LINUX,
|
||||
#endif
|
||||
#ifdef EMACS_MODE
|
||||
BABL_EMACS,
|
||||
#endif
|
||||
#ifdef VI_MODE
|
||||
BABL_VI,
|
||||
#endif
|
||||
#ifdef READMUX_MODE
|
||||
BABL_READLINE,
|
||||
#endif
|
||||
|
||||
|
||||
};
|
||||
|
||||
// BUG, used to jump to babble functiion. Surely there is a way to calculate size of enum?
|
||||
#define BABL_NUM_MACROS 48+4 // 48 + # of defined modes.
|
||||
|
||||
/* And all the shorthand keymap ready versions */
|
||||
// First the mode switching macros
|
||||
#ifdef MS_MODE
|
||||
#define B_WIN M(BABL_WINDOWS)
|
||||
#endif
|
||||
#ifdef MAC_MODE
|
||||
#define B_MAC M(BABL_MAC)
|
||||
#endif
|
||||
#ifdef LINUX_MODE
|
||||
#define B_LNX M(BABL_LINUX)
|
||||
#endif
|
||||
#ifdef EMACS_MODE
|
||||
#define B_EMAX M(BABL_EMACS)
|
||||
#endif
|
||||
#ifdef VI_MODE
|
||||
#define B_VI M(BABL_VI)
|
||||
#endif
|
||||
#ifdef READMUX_MODE
|
||||
#define B_READ M(BABL_READLINE)
|
||||
#endif
|
||||
|
||||
// and all the movement & action.
|
||||
|
||||
#define B_L1C M(BABL_GO_LEFT_1C)
|
||||
#define B_R1C M(BABL_GO_RIGHT_1C)
|
||||
#define B_L1W M(BABL_GO_LEFT_WORD)
|
||||
#define B_R1W M(BABL_GO_RIGHT_WORD)
|
||||
#define B_GSOL M(BABL_GO_START_LINE)
|
||||
#define B_GEOL M(BABL_GO_END_LINE)
|
||||
#define B_GTOP M(BABL_GO_START_DOC)
|
||||
#define B_GEND M(BABL_GO_END_DOC)
|
||||
#define B_DOWN M(BABL_GO_NEXT_LINE)
|
||||
#define B_UP M(BABL_GO_PREV_LINE)
|
||||
#define B_PGDN M(BABL_PGDN)
|
||||
#define B_PGUP M(BABL_PGUP)
|
||||
//#define B_BKSP M(BABL_DEL_LEFT_1C) == backspace so why bother.
|
||||
#define B_DEL M(BABL_DEL_RIGHT_1C) // usually = Del
|
||||
#define B_DLW M(BABL_DEL_LEFT_WORD)
|
||||
#define B_DRW M(BABL_DEL_RIGHT_WORD)
|
||||
#define B_DEOL M(BABL_DEL_TO_LINE_END) // delete from cursor to end of line
|
||||
#define B_DSOL M(BABL_DEL_TO_LINE_START) // delete from cursor to begining line
|
||||
#define B_UNDO M(BABL_UNDO)
|
||||
#define B_REDO M(BABL_REDO)
|
||||
#define B_CUT M(BABL_CUT)
|
||||
#define B_COPY M(BABL_COPY)
|
||||
#define B_PAST M(BABL_PASTE)
|
||||
#define B_SELA M(BABL_SELECT_ALL)
|
||||
#define B_FIND M(BABL_FIND)
|
||||
#define B_FINDN M(BABL_FIND_NEXT)
|
||||
#define B_FINDR M(BABL_FIND_REPLACE)
|
||||
#define B_RAPP M(BABL_RUNAPP)
|
||||
#define B_NAPP M(BABL_SWITCH_APP_NEXT)
|
||||
#define B_PAPP M(BABL_SWITCH_APP_LAST) // previous
|
||||
#define B_CAPP M(BABL_CLOSE_APP)
|
||||
#define B_HELP M(BABL_HELP)
|
||||
#define B_NTAB M(BABL_BROWSER_NEW_TAB)
|
||||
#define B_CTAB M(BABL_BROWSER_CLOSE_TAB)
|
||||
#define B_ROTB M(BABL_BROWSER_REOPEN_LAST_TAB)
|
||||
#define B_NXTB M(BABL_BROWSER_NEXT_TAB)
|
||||
#define B_PTAB M(BABL_BROWSER_PREV_TAB)
|
||||
#define B_NURL M(BABL_BROWSER_URL_BAR)
|
||||
#define B_BFWD M(BABL_BROWSER_FORWARD)
|
||||
#define B_BBAK M(BABL_BROWSER_BACK)
|
||||
#define B_BFND M(BABL_BROWSER_FIND)
|
||||
#define B_BOOK M(BABL_BROWSER_BOOKMARK)
|
||||
#define B_BDEV M(BABL_BROWSER_DEV_TOOLS) // hard one to remember
|
||||
#define B_BRLD M(BABL_BROWSER_RELOAD)
|
||||
#define B_BFUlL M(BABL_BROWSER_FULLSCREEN)
|
||||
#define B_ZMIN M(BABL_BROWSER_ZOOM_IN)
|
||||
#define B_ZMOT M(BABL_BROWSER_ZOOM_OUT)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* from action_macro.h
|
||||
typedef uint8_t macro_t;
|
||||
|
||||
#define MACRO_NONE (macro_t*)0
|
||||
#define MACRO(...) ({ static const macro_t __m[] PROGMEM = { __VA_ARGS__ }; &__m[0]; })
|
||||
#define MACRO_GET(p) pgm_read_byte(p)
|
||||
|
||||
#define BABL_MSTART (entry, os, macro...) ( const macro_t bablDict[entry][os] PROGMEM = { macro... }; )
|
||||
|
||||
*/
|
||||
|
||||
const macro_t *babblePaste(keyrecord_t *record, uint8_t shortcut);
|
||||
|
||||
macro_t* switch_babble_mode( uint8_t id);
|
||||
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
BabblePaste is a library of common macros used to make sure that
|
||||
you can have one "paste" button on one layer, and it will do the
|
||||
right thing on any OS or app. Windows=Ctrl-V. Mac = Command-V and so on.
|
||||
|
||||
The babblepaste library looks for the current status in a babble_mode global variable.
|
||||
To switch modes, run the switch_babble_mode() function, or a pre defined macro.
|
||||
Currently supported are Windows, OS X, Gnome/kde, Emacs, VI and readline,
|
||||
across 42+ common macro actions.
|
||||
|
||||
|
||||
###To use the library
|
||||
1) Paste the following into your config.h.
|
||||
|
||||
//////Begin//////
|
||||
#define USE_BABLPASTE 1
|
||||
|
||||
#ifdef USE_BABLPASTE
|
||||
/* define BabblePaste maps. Whatever = 0 will be the default. */
|
||||
// MAC_MODE 0
|
||||
// MS_MODE 1
|
||||
// LINUX_MODE 2
|
||||
// EMACS_MODE 3
|
||||
// VI_MODE 3
|
||||
// Readline and tmux
|
||||
// READMUX_MODE 2
|
||||
// WORDSTAR_MODE 5
|
||||
#endif
|
||||
|
||||
// Uncomment these to remove options an free up flash space
|
||||
|
||||
// This removes everything but cursor movement
|
||||
// BABL_MOVEMENTONLY
|
||||
// and this just removes browser shortcuts
|
||||
// BABL_NOBROWSER
|
||||
///////End///////
|
||||
|
||||
2) Add the following to your keymap in the action_get_macro
|
||||
|
||||
//////Begin//////
|
||||
#ifdef USE_BABLPASTE
|
||||
|
||||
if( id >= BABL_START_NUM && id < (BABL_START_NUM + BABL_NUM_MACROS ) ) {
|
||||
if (record->event.pressed) { // is there a case where this isn't desired?
|
||||
|
||||
babblePaste ( record, id );
|
||||
return MACRO_NONE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
///////End///////
|
||||
|
||||
3) add Babbelpaste actions to your keymap. See the full list in babblePaste.h, or the
|
||||
list below
|
||||
B_L1C // go left 1 char
|
||||
B_R1C // go Right 1 char
|
||||
B_L1W //GO_LEFT_1 WORD
|
||||
B_R1W //BABL_GO_RIGHT_1 WORD
|
||||
B_GSOL // BABL_GOTO_START of _LINE
|
||||
B_GEOL // BABL_GOTO_END_LINE
|
||||
B_GTOP //BABL_GOTO_START_DOC
|
||||
B_GEND //BABL_GO_END_DOC
|
||||
B_DOWN //BABL_GO_NEXT_LINE
|
||||
B_UP // BABL_GO_PREV_LINE
|
||||
B_PGDN //PGDN
|
||||
B_PGUP //PGUP
|
||||
// B_BKSP //backspace so why bother.
|
||||
B_DEL // DEL_RIGHT_1 Char // usually = Del
|
||||
B_DLW // DEL_LEFT_ 1 WORD)
|
||||
B_DRW //DEL_RIGHT_1 WORD
|
||||
B_DEOL // delete from cursor to end of line
|
||||
B_DSOL // delete from cursor to begining line
|
||||
B_UNDO //UNDO
|
||||
B_REDO // REDO
|
||||
B_CUT // CUT)
|
||||
B_COPY // COPY)
|
||||
B_PAST // PASTE)
|
||||
B_SELA // SELECT_ALL
|
||||
B_FIND // FIND)
|
||||
B_FINDN //FIND_NEXT)
|
||||
B_FINDR // FIND_REPLACE)
|
||||
B_RAPP // open application launcher
|
||||
B_NAPP // switch to next app
|
||||
B_PAPP // switch to previous app
|
||||
B_CAPP // CLOSE_APP)
|
||||
B_HELP // HELP)
|
||||
B_NTAB // BROWSER_NEW_TAB)
|
||||
B_CTAB //BROWSER_CLOSE_TAB)
|
||||
B_ROTB //BROWSER_REOPEN_LAST_TAB)
|
||||
B_NXTB //BROWSER_NEXT_TAB)
|
||||
B_PTAB //BROWSER_PREV_TAB)
|
||||
B_NURL //BROWSER_jump to URL_BAR)
|
||||
B_BFWD // BROWSER_FORWARD (in history)
|
||||
B_BBAK //BROWSER_BACK (in history)
|
||||
B_BFND // BROWSER_FIND)
|
||||
B_BOOK //BROWSER_New BOOKMARK)
|
||||
B_BDEV //BROWSER_ Open DEV_TOOLS) // hard one to remember
|
||||
B_BRLD // BROWSER_RELOAD Page
|
||||
B_BFUlL // BROWSER_FULLSCREEN)
|
||||
B_ZMIN // BROWSER_ZOOM_IN)
|
||||
B_ZMOT //BROWSER_ZOOM_OUT)
|
||||
|
||||
|
||||
#### Development notes
|
||||
-Why a new function? Because it would make the keymap too ugly to put it there.
|
||||
-Why not return the macro to action_get_macro? Because I kept running into scope problems
|
||||
and pointers to the wrong type.
|
||||
-Why not an array of arrays as a lookup instead of a function? That would allow you
|
||||
to store the lookup table in PROGMEM. True, but that takes more pre-processor skill
|
||||
than I had.
|
||||
|
||||
-Have you tested this on every platform? No. Submit a patch.
|
||||
|
||||
|
||||
### Next steps for someone.
|
||||
Make it easier to pair macros with modifiers. So key foo will jump to start of line, and
|
||||
Shift(foo) will jump to the first tab in a browser.
|
||||
|
||||
## Thanks
|
||||
|
||||
Thanks to https://en.wikipedia.org/wiki/Table_of_keyboard_shortcuts
|
||||
and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jeebak/keymap.c
|
||||
And of course QMK...
|
||||
|
||||
@@ -15,3 +15,6 @@ UNICODE_ENABLE = no # Unicode
|
||||
BLUETOOTH_ENABLE = no # Enable Bluetooth with the Adafruit EZ-Key HID
|
||||
RGBLIGHT_ENABLE = no # Enable WS2812 RGB underlight.
|
||||
SLEEP_LED_ENABLE = no # Breathing sleep LED during USB suspend
|
||||
|
||||
# Keymap specific files
|
||||
SRC = babblePaste.c
|
||||
|
||||
Reference in New Issue
Block a user