summaryrefslogtreecommitdiffstats
path: root/users
diff options
context:
space:
mode:
authormilestogo <milestogo@users.noreply.github.com>2021-03-14 12:23:30 -0700
committerGitHub <noreply@github.com>2021-03-14 12:23:30 -0700
commit7b7689d30796c977b95197091c16e8bb97000101 (patch)
treedc81a91d109041e34a90940fdceaeede7d512e4f /users
parentaa73411c14487465d7af9d9f1ca7cb5d157e9343 (diff)
[Keymap] miles2go userspace update, add functions for babblepaste library, add prime_e keybard keymap (#9196)
Co-authored-by: Drashna Jaelre <drashna@live.com>
Diffstat (limited to 'users')
-rw-r--r--users/miles2go/babblePaste.c130
-rw-r--r--users/miles2go/babblePaste.h50
-rw-r--r--users/miles2go/babblePaste.md71
-rw-r--r--users/miles2go/babl_chromeos.c2
-rw-r--r--users/miles2go/babl_emacs.c1
-rw-r--r--users/miles2go/babl_kitty.c153
-rw-r--r--users/miles2go/babl_nano.c77
-rw-r--r--users/miles2go/babl_vi.c1
-rw-r--r--users/miles2go/config.h8
-rw-r--r--users/miles2go/milestogo.c29
-rw-r--r--users/miles2go/milestogo.h343
-rw-r--r--users/miles2go/readme.md2
-rw-r--r--users/miles2go/rules.mk2
13 files changed, 648 insertions, 221 deletions
diff --git a/users/miles2go/babblePaste.c b/users/miles2go/babblePaste.c
index 2a32024cd2..cd032882bf 100644
--- a/users/miles2go/babblePaste.c
+++ b/users/miles2go/babblePaste.c
@@ -12,13 +12,14 @@ and https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/keymaps/jee
#ifdef USE_BABBLEPASTE
# include "babblePaste.h"
-// small function that we might also want to call from a keymap.
-
// GLOBAL variable to determine mode. Sets startup default if no eeppom
uint8_t babble_mode = 0;
-// function to tell the user that the mode has changed
-__attribute__((weak)) void babble_led_user(void) {}
+// functions to tell the user that the mode has changed
+__attribute__((weak)) void babble_modeswitch_user(uint8_t mode) {}
+__attribute__((weak)) void babble_modeswitch_kb(uint8_t mode) { babble_modeswitch_user( mode); }
+
+
void set_babble_mode(uint8_t id) { babble_mode = id; }
@@ -27,6 +28,7 @@ void babble_mode_increment() {
if (babble_mode >= BABL_MODEMAX) {
babble_mode = 0;
}
+ babble_modeswitch_kb(babble_mode);
}
void babble_mode_decrement() {
@@ -35,21 +37,97 @@ void babble_mode_decrement() {
} else {
babble_mode = BABL_MODEMAX - 1;
}
+ babble_modeswitch_kb(babble_mode);
}
/* this function runs the appropriate babblepaste macro, given
the global babble_mode and a keycode defined in the babble_keycodes enum.
-This could be made faster by splitting into two functions sorted by keycode range
+This could be made faster by splitting into functions sorted by keycode range
But that makes for a *lot* of ifdefs.
*/
-bool babblePaste(uint16_t keycode) {
- // handle the OS/mode switching first
+bool babblePaste(uint16_t keycode, bool is_pressed ) {
+ // handle keys that have up & down behavior first, then OS/mode switching, then macros
+
+// This is the key used for cut & paste (Propeller on Mac, Control elsewhere)
+# ifdef BABL_MODSWAP
+ // WARNING, this assumes you have BABL_MAC_MODE defined.
+ if (keycode == BABL_PRIMARY_OS_MOD ) {
+ if (babble_mode == BABL_MAC_MODE) {
+ if (is_pressed) {
+ register_code(KC_LGUI);
+ } else {
+ unregister_code(KC_LGUI);
+ }
+ } else { // everybody else
+
+ if (is_pressed) {
+ register_code(KC_LCTL);
+ } else {
+ unregister_code(KC_LCTL);
+ }
+ }
+ }
+
+// This is the os key not used in cut & paste. (CTRL on mac, GUI elsewhere)
+ if (keycode == BABL_SECONDARY_OS_MOD ) {
+ if (babble_mode == BABL_MAC_MODE) {
+ if (is_pressed) {
+ register_code(KC_LCTL);
+ } else {
+ unregister_code(KC_LCTL);
+ }
+
+ } else { // everybody else
+ if (is_pressed) {
+ register_code(KC_LGUI);
+ } else {
+ unregister_code(KC_LGUI);
+ }
+ }
+ }
+
+// This is the alt key in most OSes. Mostly useful if you want to do hyper on one OS, Meh on another.
+ if (keycode == BABL_TERTIARY_OS_MOD ) {
+ if (babble_mode == BABL_MAC_MODE) {
+ if (is_pressed) {
+ register_code(KC_LALT);
+ } else {
+ unregister_code(KC_LALT);
+ }
+ } else { // everybody else
+
+ if (is_pressed) {
+ register_code(KC_LALT);
+ } else {
+ unregister_code(KC_LALT);
+ }
+ }
+ }
+
+# endif
+
+// below here we are only running macros - don't serve any key up events.
+ if (is_pressed == 0 ) {
+ return true;
+ }
+
+// handle increment functions.
+
+if (keycode == BABL_MODE_INCREMENT) {
+ babble_mode_increment();
+ return true;
+}
+
+if (keycode == BABL_MODE_DECREMENT) {
+ babble_mode_decrement();
+ return true;
+}
# ifdef BABL_MAC
if (keycode == BABL_DO_MAC) {
set_babble_mode(BABL_MAC_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
@@ -61,7 +139,7 @@ bool babblePaste(uint16_t keycode) {
# ifdef BABL_VI
if (keycode == BABL_DO_VI) {
set_babble_mode(BABL_VI_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
if (babble_mode == BABL_VI_MODE) {
@@ -71,7 +149,7 @@ bool babblePaste(uint16_t keycode) {
# ifdef BABL_WINDOWS
if (keycode == BABL_DO_WINDOWS) {
set_babble_mode(BABL_WINDOWS_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
if (babble_mode == BABL_WINDOWS_MODE) {
@@ -81,7 +159,7 @@ bool babblePaste(uint16_t keycode) {
# ifdef BABL_LINUX
if (keycode == BABL_DO_LINUX) {
set_babble_mode(BABL_LINUX_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
if (babble_mode == BABL_LINUX_MODE) {
@@ -91,27 +169,47 @@ bool babblePaste(uint16_t keycode) {
# ifdef BABL_EMACS
if (keycode == BABL_DO_EMACS) {
set_babble_mode(BABL_EMACS_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
if (babble_mode == BABL_EMACS_MODE) {
babblePaste_emacs(keycode);
}
# endif
-# ifdef BABL_CHROME
+# ifdef BABL_NANO
+ if (keycode == BABL_DO_NANO) {
+ set_babble_mode(BABL_NANO_MODE);
+ babble_modeswitch_kb(babble_mode);
+ return true;
+ }
+ if (babble_mode == BABL_NANO_MODE) {
+ babblePaste_nano(keycode);
+ }
+# endif
+# ifdef BABL_KITTY
+ if (keycode == BABL_DO_KITTY) {
+ set_babble_mode(BABL_KITTY_MODE);
+ babble_modeswitch_kb(babble_mode);
+ return true;
+ }
+ if (babble_mode == BABL_KITTY_MODE) {
+ babblePaste_kitty(keycode);
+ }
+# endif
+# ifdef BABL_CHROMEOS
if (keycode == BABL_DO_CHROMEOS) {
set_babble_mode(BABL_CHROMEOS_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
if (babble_mode == BABL_CHROMEOS_MODE) {
- babblePaste_readmux(keycode);
+ babblePaste_chromeos(keycode);
}
# endif
# ifdef BABL_READMUX
if (keycode == BABL_DO_READMUX) {
set_babble_mode(BABL_READMUX_MODE);
- babble_led_user();
+ babble_modeswitch_kb(babble_mode);
return true;
}
if (babble_mode == BABL_READMUX_MODE) {
diff --git a/users/miles2go/babblePaste.h b/users/miles2go/babblePaste.h
index 606640227c..8fc233e8d4 100644
--- a/users/miles2go/babblePaste.h
+++ b/users/miles2go/babblePaste.h
@@ -16,7 +16,8 @@ and jeebak & algernon's keymap
void set_babble_mode(uint8_t id);
void babble_mode_increment(void);
void babble_mode_decrement(void);
-void babble_led_user(void);
+void babble_modeswitch_user(uint8_t mode);
+void babble_modeswitch_kb(uint8_t mode);
// manually re-order these if you want to set the order or default.
enum babble_modes {
@@ -32,19 +33,24 @@ enum babble_modes {
# ifdef BABL_VI
BABL_VI_MODE,
# endif
-# ifdef BABL_LINUX
- BABL_LINUX_MODE,
-# endif
# ifdef BABL_EMACS
BABL_EMACS_MODE,
# endif
+# ifdef BABL_NANO
+ BABL_NANO_MODE,
+# endif
+# ifdef BABL_KITTY
+ BABL_KITTY_MODE,
+# endif
# ifdef BABL_CHROMEOS
BABL_CHROMEOS_MODE,
# endif
+# ifdef BABL_LINUX
+ BABL_LINUX_MODE,
+# endif
BABL_MODEMAX
};
-// void babble_led_user( uint8_t id)
/// Hacks to make it easier to create sendstring macros
@@ -79,6 +85,13 @@ enum babble_modes {
enum babble_keycodes {
FIRST = BABBLE_START,
+ BABL_MODE_INCREMENT,
+ BABL_MODE_DECREMENT,
+# ifdef BABL_MODSWAP
+ BABL_PRIMARY_OS_MOD,
+ BABL_SECONDARY_OS_MOD,
+ BABL_TERTIARY_OS_MOD,
+# endif
# ifdef BABL_MOVE
// Movement macros
// left & right
@@ -171,6 +184,7 @@ enum babble_keycodes {
# endif // BABL_APP_CELLS
# ifdef BABL_APP_EDITOR
BABL_APP_MULTI_SELECT, /* www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html */
+ BABL_APP_SET_MARK, // set editor mark
# endif // BABL_APP_EDITOR
# ifdef BABL_APP_WINDOWSPLITTING
// These aren't useful on most oses.
@@ -197,6 +211,12 @@ enum babble_keycodes {
# ifdef BABL_EMACS
BABL_DO_EMACS,
# endif
+# ifdef BABL_NANO
+ BABL_DO_NANO,
+# endif
+# ifdef BABL_KITTY
+ BABL_DO_KITTY,
+# endif
# ifdef BABL_VI
BABL_DO_VI,
# endif
@@ -210,7 +230,7 @@ enum babble_keycodes {
};
// primary function.
-bool babblePaste(uint16_t keycode);
+bool babblePaste(uint16_t keycode, bool is_pressed);
/****************************************************/
/* All per-os includes and short mode switch macros*/
@@ -230,6 +250,14 @@ bool babblePaste_linux(uint16_t keycode);
# define B_EMACS BABL_DO_EMACS
bool babblePaste_emacs(uint16_t keycode);
# endif
+# ifdef BABL_NANO
+# define B_NANO BABL_DO_NANO
+bool babblePaste_nano(uint16_t keycode);
+# endif
+# ifdef BABL_KITTY
+# define B_KITTY BABL_DO_KITTY
+bool babblePaste_kitty(uint16_t keycode);
+# endif
# ifdef BABL_VI
# define B_VI BABL_DO_VI
bool babblePaste_vi(uint16_t keycode);
@@ -243,12 +271,17 @@ bool babblePaste_readmux(uint16_t keycode);
bool babblePaste_chromeos(uint16_t keycode);
# endif
-# define BABL_INC babble_mode_increment();
-# define BABL_DEC babble_mode_decrement();
/****************************************************
** All keyboard macros for Babble Actions
*****************************************************/
+# define B_INC BABL_MODE_INCREMENT
+# define B_DEC BABL_MODE_DECREMENT
+# ifdef BABL_MODSWAP
+# define B_1ME BABL_PRIMARY_OS_MOD
+# define B_2ME BABL_SECONDARY_OS_MOD
+# define B_3ME BABL_TERTIARY_OS_MOD
+# endif
# ifdef BABL_MOVE
# define B_L1C BABL_GO_LEFT_1C
@@ -334,6 +367,7 @@ bool babblePaste_chromeos(uint16_t keycode);
# endif // BABL_APP_CELLS
# ifdef BABL_APP_EDITOR
# define B_MSEL BABL_APP_MULTI_SELECT
+# define B_MARK BABL_APP_SET_MARK
/* www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html */
# endif // BABL_APP_EDITOR
# ifdef BABL_APP_WINDOWSPLITTING
diff --git a/users/miles2go/babblePaste.md b/users/miles2go/babblePaste.md
index cc1c31bd0d..4f68cc4ae8 100644
--- a/users/miles2go/babblePaste.md
+++ b/users/miles2go/babblePaste.md
@@ -26,6 +26,7 @@ To switch modes, run the switch_babble_mode() function, or a pre defined BABL_DO
#define BABL_MAC
#define BABL_LINUX
#define BABL_EMACS
+ #define BABL_NANO
#define BABL_CHROMEOS
//// These enable subsets of babble macros. Disable options to save space
@@ -56,22 +57,22 @@ To switch modes, run the switch_babble_mode() function, or a pre defined BABL_DO
Add the following to your keymap in process_record_user, before the main switch statement.
```
- #ifdef USE_BABBLEPASTE
- if( keycode > BABBLE_START && keycode < BABBLE_END_RANGE ) {
- if (record->event.pressed) { // is there a case where this isn't desired?
- babblePaste ( keycode );
- } else{
- return true;
- }
+#ifdef USE_BABBLEPASTE
+ if (keycode > BABBLE_START && keycode < BABBLE_END_RANGE) {
+ if (record->event.pressed) {
+ babblePaste(keycode, 1);
+ } else {
+ babblePaste(keycode, 0);
}
- #endif
+ }
+#endif
```
#### Add makefile rules
Update your rules.mk to include the modes you want.
- `SRC += babblePaste.c babl_windows.c babl_mac.c babl_vi.c babl_readmux.c babl_chromeos.c babl_emacs.c babl_linux.c`
+ `SRC += babblePaste.c babl_windows.c babl_mac.c babl_nano babl_vi.c babl_readmux.c babl_chromeos.c babl_emacs.c babl_linux.c`
#### Custom Keycodes
@@ -97,9 +98,18 @@ See the full list in babblePaste.h, or the list below
B_LNX // switch to linux
B_VI // switch to Vi mode
B_EMAX // switch mode to emacs
+ B_NANO // switch mode to emacs
B_READ // switch to readline /tmux mode
B_CROM // switch to chromeos mode.
-
+
+ // Swap meaning of modifier key in most ergonomic location based on babble
+ // mode. Eg Thumb gets CTL on Win/Linux, pinky gets Windows key. Reverse for
+ // OS X. See first line in babblepaste function.
+ #define B_1ME BABL_PRIMARY_OS_MOD
+ #define B_2ME BABL_SECONDARY_OS_MOD
+ #define B_3ME BABL_TERTIARY_OS_MOD
+
+// Macros
#define B_L1C BABL_GO_LEFT_1C
#define B_R1C BABL_GO_RIGHT_1C
#define B_L1W BABL_GO_LEFT_WORD
@@ -137,6 +147,10 @@ See the full list in babblePaste.h, or the list below
#define B_PAPP BABL_SWITCH_APP_LAST // previous
#define B_CAPP BABL_CLOSE_APP
#define B_HELP BABL_HELP
+ #define B_HELP BABL_HELP
+ #define B_LOCK BABL_LOCK
+ #define B_SCAP BABL_SCREENCAPTURE
+ #define B_KEYB BABL_SWITCH_KEYBOARD_LAYOUT
#define B_NTAB BABL_BROWSER_NEW_TAB
#define B_CTAB BABL_BROWSER_CLOSE_TAB
@@ -151,9 +165,10 @@ See the full list in babblePaste.h, or the list below
#define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember
#define B_BRLD BABL_BROWSER_RELOAD
#define B_BFULL BABL_BROWSER_FULLSCREEN
- #define B_ZIN BABL_BROWSER_ZOOM_IN
+ #define B_ZIN BABL_BROWSER_ZOOM_IN
#define B_ZOUT BABL_BROWSER_ZOOM_OUT
+ #define B_SAVE BABL_APP_SAVE
#define B_PASTV BABL_APP_PASTE_VALUES
#define B_CALN BABL_APP_CENTER_ALIGN
#define B_CFMT BABL_APP_CLEAR_FORMATTING
@@ -167,6 +182,7 @@ See the full list in babblePaste.h, or the list below
#define B_SELR BABL_SELECT_ROW
#define B_MSEL BABL_APP_MULTI_SELECT
+ #define B_MARK BABL_APP_SET_MARK
#define B_VSPLIT BABL_SPLIT_FRAME_VERT
#define B_VUNSPT BABL_UNSPLIT_FRAME_VERT
#define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL
@@ -175,27 +191,48 @@ See the full list in babblePaste.h, or the list below
#define B_PRVFM BABL_PREV_FRAME
```
+####Add babblepaste functions to your keyboard or userspace
+Functions babble_led_user() and babble_led_kb() are called when babble mode is changed.
+```
+void babble_modeswitch_kb(uint8_t mode){
+ #ifdef USE_BABBLEPASTE
+ writePinLow(B3); writePinLow(B2);
+ switch(mode) {
+ case(BABL_LINUX_MODE):
+ writePinHigh(B2);
+ backlight_level(1);
+ break;
+ case(BABL_MAC_MODE):
+ writePinHigh(B3);
+ backlight_level(4);
+ break;
+ }
+ // call the user function
+ babble_modeswitch_user(mode);
+ #endif
+```
+
+
## Development FAQs
**Todos**
-eeprom store state of babble_mode? or update docs so that people can change the order of the enum in
-babblespace.h?
+eeprom store state of babble_mode? or update docs so that people can change the order of the enum in babblespace.h?
**You have huge ifdef stanzas instead of functions**
This fails gracefully if you don't have all options defined. Patch if you can think how to use fewer defines.
-** Why not an array of arrays as a lookup instead of a function?**
+**Why not an array of arrays as a lookup instead of a function?**
This would allow you to store the lookup table in PROGMEM.
True, but that takes more pre-processor skill than I have, and may be less portable to ARM or other flash mappings.
-** Have you tested every key on every platform?**
+**Have you tested every key on every platform?**
No. Be careful, submit a patch.
-** Why not update Apps at the same global level as the OS? **
+**Why not change apps App babble modes at the same global level as the OS?**
This is only a good thing if it doesn't confuse the user. If you can show state of OS vs App, it's probably a good thing.
-** Can the OS tell the keyboard what mode to use? **
+**Can the OS tell the keyboard what mode to use?**
The keyboard side is easy to do with virtser_recv & a function that updates babble_mode. It still needs a PC side app to track where the keyboard focus is.
One could use a keyboard macro to launch an app & switch modes for that app.
diff --git a/users/miles2go/babl_chromeos.c b/users/miles2go/babl_chromeos.c
index a0c461f24e..fd644fc5c5 100644
--- a/users/miles2go/babl_chromeos.c
+++ b/users/miles2go/babl_chromeos.c
@@ -14,7 +14,7 @@ https://support.google.com/docs/answer/181110?co=GENIE.Platform%3DDesktop&hl=en
# ifdef BABL_CHROMEOS
-bool babblepaste_chromeos(uint16_t keycode) {
+bool babblePaste_chromeos(uint16_t keycode) {
# ifdef BABL_MOVE
BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
diff --git a/users/miles2go/babl_emacs.c b/users/miles2go/babl_emacs.c
index 201da0d1a3..87560b6eb8 100644
--- a/users/miles2go/babl_emacs.c
+++ b/users/miles2go/babl_emacs.c
@@ -69,6 +69,7 @@ bool babblePaste_emacs(uint16_t keycode) {
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_LCTL("x") SS_LCTL("s"));
+ BABLM(BABL_APP_SET_MARK, IMCTL(X_SPACE));
/// BABLM( BABL_APP_MULTI_SELECT, SS_LCTRL("x") "rt" ); // arguably
BABLM(BABL_SPLIT_FRAME_VERT, SS_LCTRL("x") "3");
BABLM(BABL_UNSPLIT_FRAME_VERT, SS_LCTRL("u") SS_LCTRL("x") "0");
diff --git a/users/miles2go/babl_kitty.c b/users/miles2go/babl_kitty.c
new file mode 100644
index 0000000000..44fd87e5ed
--- /dev/null
+++ b/users/miles2go/babl_kitty.c
@@ -0,0 +1,153 @@
+/* Keyboard mappings for Kitty terminal
+https://sw.kovidgoyal.net/kitty/index.html#
+
+ 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 QMK_KEYBOARD_H
+
+// #define TAB_MEANS TAB
+/* #define TAB_MEANS_TAB to keep the meaning of "tab" and "window" used in kitty documentation. .
+ * Leaving tab undefined will mean that each babble window command applies to a tab,
+ * and each babble tab command applies to a window inside the kitty OS window.
+ */
+//#define TAB_MEANS_TAB
+
+#ifdef USE_BABBLEPASTE
+# include "babblePaste.h"
+
+# ifdef BABL_KITTY
+
+bool babblePaste_kitty(uint16_t keycode) {
+# ifdef BABL_MOVE
+ BABLM(BABL_GO_LEFT_1C, SS_TAP(X_LEFT));
+ BABLM(BABL_GO_RIGHT_1C, SS_TAP(X_RIGHT));
+ BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
+ BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
+ BABLM(BABL_GO_START_LINE, SS_TAP(X_HOME));
+ BABLM(BABL_GO_END_LINE, SS_TAP(X_END));
+ BABLM(BABL_GO_START_DOC, OMSFT(IMCTL(X_HOME)));
+ BABLM(BABL_GO_END_DOC, OMSFT(IMCTL(X_END)));
+ // leaving these for command line editing.
+ BABLM(BABL_GO_NEXT_LINE, SS_TAP(X_DOWN));
+ BABLM(BABL_GO_PREV_LINE, SS_TAP(X_UP));
+ // These are for kitty scrolling by one line
+ // BABLM(BABL_GO_NEXT_LINE, OMSFT(IMCTL(X_DOWN)));
+ // BABLM(BABL_GO_PREV_LINE, OMSFT(IMCTL(X_UP)));
+ // passthrough
+ BABLM(BABL_PGDN, OMSFT(IMCTL(X_PGDOWN))); // kitty pagedown
+ BABLM(BABL_PGUP, OMSFT(IMCTL(X_PGUP))); // kitty pageup
+ // passthrough to commanrd line/shell.
+ BABLM(BABL_DEL_RIGHT_1C, SS_LCTL("d"));
+ BABLM(BABL_DEL_LEFT_WORD, SS_LCTL("w")); // meta-DEL instead?
+ BABLM(BABL_DEL_RIGHT_WORD, SS_LALT("d"));
+ BABLM(BABL_DEL_TO_LINE_END, SS_LCTL("k"));
+ BABLM(BABL_DEL_TO_LINE_START, SS_LCTL("u"));
+ BABLM(BABL_GO_PARA_START, IMCTL(X_UP));
+ BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN));
+ BABLM(BABL_MODE, "Kitty! ");
+# endif
+# ifdef BABL_OSKEYS
+ // cut isn't real, undo/redo are passthrough.
+ BABLM(BABL_UNDO, SS_LCTL("z"));
+ BABLM(BABL_REDO, SS_LCTL("y"));
+ BABLM(BABL_CUT, OMSFT(IMCTL(X_X)));
+ BABLM(BABL_COPY, OMSFT(IMCTL(X_C)));
+ BABLM(BABL_PASTE, OMSFT(IMCTL(X_V)));
+ BABLM(BABL_SELECT_ALL, SS_LCTL("a"));
+ BABLM(BABL_FIND, SS_LCTL("f")); // passthrough.
+ // BABLM(BABL_CLOSE_APP, IMALT(X_F4)); // gnome.
+ // BABLM(BABL_HELP, SS_TAP(X_F1)); // script to pop open kitty web page?
+ // 2 passthrough.
+ BABLM(BABL_FIND_NEXT, SS_LCTL("g")); // Gnome*/
+ BABLM(BABL_FIND_PREV, OMSFT(IMCTL(X_G))); // Gnome*/
+ // BABLM(BABL_FIND_NEXT (SS_LALT(X_F3)) ); //KDE */
+ /* BABLM( BABL_FIND_REPLACE , (SS_LCTL("r")) ); // KDE */
+ // BABLM(BABL_FIND_REPLACE, SS_LCTL("h")); // Gnome*/
+ BABLM(BABL_RUNAPP, OMSFT(IMCTL(X_O))); // pass current selection to program.
+ BABLM(BABL_SWITCH_APP_NEXT, IMGUI(X_TAB));
+ // BABLM(BABL_SWITCH_APP_LAST, OMSFT(IMALT(X_TAB)));
+ BABLM(BABL_WINDOW_NEXT, IMGUI(X_GRAVE)); // next OS window of kitty.
+ BABLM(BABL_WINDOW_PREV, OMSFT(IMGUI(X_GRAVE))); // NA?
+# ifdef TAB_MEANS_TAB
+ BABLM(BABL_WINDOW_NEW, OMSFT(IMCTL(X_ENTER))); // a window is a window
+# else
+ BABLM(BABL_WINDOW_NEW, OMSFT(IMCTL(X_T))); // a window is a tab
+# endif
+ // KITTY - missing close window.
+ // BABLM( BABL_HELP, (SS_TAP(X_F1)) ); // NA?
+ // BABLM(BABL_LOCK, OMCTL(IMALT(X_L))); // NA passthrough
+ // BABLM(BABL_SCREENCAPTURE, IMSFT(X_PSCREEN)); // NA passthrough
+# endif
+# ifdef BABL_BROWSER
+
+# ifdef TAB_MEANS_TAB
+ // option A - do tab when I say tab.
+ BABLM(BABL_BROWSER_NEW_TAB, OMSFT(IMCTL(X_T)));
+ BABLM(BABL_BROWSER_CLOSE_TAB, OMSFT(IMCTL(X_Q)));
+ BABLM(BABL_BROWSER_NEXT_TAB, OMSFT(IMCTL(X_RIGHT)));
+ BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_LEFT)));
+ // ok, this is a bit of a stretch, overloading meaning of forwards/backwards
+ BABLM(BABL_BROWSER_FORWARD, OMSFT(IMCTL(X_DOT))); // move current kitty tab forwards
+ BABLM(BABL_BROWSER_BACK, OMSFT(IMCTL(X_COMMA))); // move current kitty tab back
+ // requires kitty config of "map ctrl+shift+f7 detach_window"
+ BABLM(BABL_BROWSER_REOPEN_LAST_TAB, IMCTL(X_F7)); // pop current frame into a window
+# else // tab means window/frame.
+ // option B - do Kitty window (frame) when I say tab
+ BABLM(BABL_BROWSER_NEW_TAB, OMSFT(IMCTL(X_ENTER)));
+ BABLM(BABL_BROWSER_NEXT_TAB, OMSFT(IMCTL(X_LBRC)));
+ BABLM(BABL_BROWSER_PREV_TAB, OMSFT(IMCTL(X_RBRC)));
+ // ok, this is a bit of a stretch, overloading meaning of forwards/backwards
+ BABLM(BABL_BROWSER_FORWARD, OMSFT(IMCTL(X_F)));
+ BABLM(BABL_BROWSER_BACK, OMSFT(IMCTL(X_B)));
+ // kitty - questionable mental model - reopen current frame as a window
+ // requires kitty config of "map ctrl+shift+f6 detach_frame"
+ BABLM(BABL_BROWSER_REOPEN_LAST_TAB, IMCTL(X_F6)); // pop current frame into a window
+# endif // tab means tab
+
+ // BABLM(BABL_BROWSER_FIND, SS_LCTL("f"));
+ BABLM(BABL_BROWSER_BOOKMARK, SS_LCTL(SS_LSFT(SS_LALT("t")))); // bookmark == set tab title.
+ BABLM(BABL_BROWSER_DEV_TOOLS, OMSFT(IMCTL(X_F2))); // edit kitty config.
+ BABLM(BABL_BROWSER_RELOAD, OMSFT(IMCTL(X_DEL))); // reset terminal
+ BABLM(BABL_BROWSER_FULLSCREEN, OMSFT(IMCTL(X_F11)));
+ BABLM(BABL_BROWSER_ZOOM_IN, OMSFT(IMCTL(X_EQUAL)));
+ BABLM(BABL_BROWSER_ZOOM_OUT, OMSFT(IMCTL(X_MINUS)));
+ // Again, breaking model to overload "view source"
+ BABLM(BABL_BROWSER_VIEWSRC, OMSFT(IMCTL(X_O))); // open URL in browser
+
+# endif
+# ifdef BABL_APP
+ BABLM(BABL_APP_SAVE, SS_LCTL("s")); // passthrough.
+# ifdef TAB_MEANS_TAB // frames are called windows.
+ BABLM(BABL_SPLIT_FRAME_VERT, OMSFT(IMCTL(X_ENTER))); // add new frame in kitty window
+ BABLM(BABL_UNSPLIT_FRAME_VERT, OMSFT(IMCTL(X_W))); // close window
+ // BUG, this breaks the mental model. move the current frame forward/back in rotation
+ BABLM(BABL_SPLIT_FRAME_HORIZONTAL, OMSFT(IMCTL(X_F)));
+ BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, OMSFT(IMCTL(X_B)));
+ // KITTY - missing ctrl shift ` = move frame to top.
+ BABLM(BABL_NEXT_FRAME, OMSFT(IMCTL(X_RBRC)));
+ BABLM(BABL_PREV_FRAME, OMSFT(IMCTL(X_LBRC)));
+# else // splits are tabs
+ BABLM(BABL_SPLIT_FRAME_VERT, OMSFT(IMCTL(X_T)));
+ BABLM(BABL_UNSPLIT_FRAME_VERT, OMSFT(IMCTL(X_Q))); // close Tab
+ BABLM(BABL_NEXT_FRAME, OMSFT(IMCTL(X_RIGHT)));
+ BABLM(BABL_PREV_FRAME, OMSFT(IMCTL(X_LEFT)));
+ // ok, this is a bit of a stretch, overloading meaning of forwards/backwards
+ BABLM(BABL_SPLIT_FRAME_HORIZONTAL, OMSFT(IMCTL(X_DOT))); // move current kitty tab forwards
+ BABLM(BABL_UNSPLIT_FRAME_HORIZONTAL, OMSFT(IMCTL(X_COMMA))); // move current kitty tab back
+# endif // tab means tab
+# endif
+
+ // Todo, ring bell, flash light, show user this isn't supported
+ return false;
+}
+
+# endif /* kitty mode */
+#endif
diff --git a/users/miles2go/babl_nano.c b/users/miles2go/babl_nano.c
new file mode 100644
index 0000000000..ebbe9b2bc5
--- /dev/null
+++ b/users/miles2go/babl_nano.c
@@ -0,0 +1,77 @@
+/* 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.
+
+Nano mode is probably most useful for people who don't usually use Nano, but
+sometimes find themselves using it.
+
+https://www.nano-editor.org/dist/latest/cheatsheet.html
+*/
+
+#include QMK_KEYBOARD_H
+
+#ifdef USE_BABBLEPASTE
+# include "babblePaste.h"
+
+# ifdef BABL_NANO
+
+// probably should allow meta to not be ALT
+# define DMETA IMALT
+
+bool babblePaste_nano(uint16_t keycode) {
+# ifdef BABL_MOVE
+ BABLM(BABL_GO_LEFT_1C, SS_LCTRL("b"));
+ BABLM(BABL_GO_RIGHT_1C, SS_LCTL("f"));
+ BABLM(BABL_GO_LEFT_WORD, IMCTL(X_LEFT));
+ BABLM(BABL_GO_RIGHT_WORD, IMCTL(X_RIGHT));
+ BABLM(BABL_GO_START_LINE, SS_LCTRL("a"));
+ BABLM(BABL_GO_END_LINE, SS_LCTRL("e"));
+ BABLM(BABL_GO_START_DOC, IMALT(X_BSLS));
+ BABLM(BABL_GO_END_DOC, IMALT(X_SLASH));
+ BABLM(BABL_GO_NEXT_LINE, SS_LCTRL("n"));
+ BABLM(BABL_GO_PREV_LINE, SS_LCTRL("p"));
+ BABLM(BABL_GO_PARA_START, IMCTL(X_UP));
+ BABLM(BABL_GO_PARA_END, IMCTL(X_DOWN));
+ BABLM(BABL_PGDN, SS_LCTRL("v"));
+ BABLM(BABL_PGUP, SS_LCTRL("y"));
+ BABLM(BABL_DEL_RIGHT_1C, SS_LCTRL("d"));
+ BABLM(BABL_DEL_LEFT_WORD, IMCTL(X_BSPC));
+ BABLM(BABL_DEL_RIGHT_WORD, IMCTL(X_DEL));
+ // BABLM(BABL_DEL_TO_LINE_END, SS_LCTRL("k"));
+ // BABLM(BABL_DEL_TO_LINE_START, SS_TAP(X_ESCAPE) "0" SS_LCTRL("k"));
+ BABLM(BABL_MODE, "Nano ");
+# endif
+# ifdef BABL_OSKEYS
+ BABLM(BABL_UNDO, SS_LALT("u"));
+ BABLM(BABL_REDO, SS_LALT("e"));
+ BABLM(BABL_CUT, SS_LCTRL("k")); // arguably b/c line based, not selection
+ BABLM(BABL_COPY, SS_LALT("6")); // arguably
+ BABLM(BABL_PASTE, SS_LCTRL("u"));
+ // BABLM(BABL_SELECT_ALL, SS_LCTRL("x") "h");
+ BABLM(BABL_FIND, SS_LCTRL("w"));
+ BABLM(BABL_FIND_NEXT, SS_LALT("w"));
+ BABLM(BABL_FIND_PREV, SS_LALT("q"));
+ BABLM(BABL_FIND_REPLACE, SS_LALT("r"));
+ BABLM(BABL_RUNAPP, SS_LCTL("t"));
+ BABLM(BABL_WINDOW_NEXT, OMALT(IMSFT(X_DOT)));
+ BABLM(BABL_WINDOW_PREV, OMALT(IMSFT(X_COMMA)));
+ BABLM(BABL_WINDOW_NEW, IMCTL(X_R) IMALT(X_F)); //
+ BABLM(BABL_CLOSE_APP, SS_LCTRL("x"));
+ BABLM(BABL_HELP, SS_LCTRL("g"));
+
+ // BABLM( BABL_LOCK, () ); // lock buffer? Too many options.
+ // BABLM( BABL_SCREENCAPTURE, () ); // requires plugin?
+
+# endif
+
+# ifdef BABL_APP
+ BABLM(BABL_APP_SAVE, SS_LCTRL("s")); // save file blurs app & os. Move?
+ BABLM(BABL_APP_SET_MARK, SS_LALT("a"));
+# endif
+
+ // Todo, ring bell, flash light, show user this isn't supported
+ return false;
+}
+# endif /* nano mode*/
+#endif
diff --git a/users/miles2go/babl_vi.c b/users/miles2go/babl_vi.c
index 7eebc0b208..f4b1d39d99 100644
--- a/users/miles2go/babl_vi.c
+++ b/users/miles2go/babl_vi.c
@@ -59,6 +59,7 @@ bool babblePaste_vi(uint16_t keycode) {
# ifdef BABL_APP
BABLM(BABL_APP_SAVE, SS_TAP(X_ESCAPE) ":w");
+ BABLM(BABL_APP_SET_MARK, SS_TAP(X_ESCAPE) "ma"); // real vi people probably want multiple marks,not just a
# ifdef BABL_APP_WINDOWSPLITTING
BABLM(BABL_SPLIT_FRAME_VERT, SS_TAP(X_ESCAPE) ":vsplit");
BABLM(BABL_UNSPLIT_FRAME_VERT, SS_TAP(X_ESCAPE) ":hide"); // debatable.
diff --git a/users/miles2go/config.h b/users/miles2go/config.h
index 3fb52b8a59..a704df4b55 100644
--- a/users/miles2go/config.h
+++ b/users/miles2go/config.h
@@ -34,6 +34,7 @@
#define USE_BABBLEPASTE
// All options
+#define BABL_MODSWAP
#define BABL_MOVE // Uncomment to add basic cursor movement
#define BABL_OSKEYS // This adds Cut, paste, window movement and common OS shortcuts
#define BABL_BROWSER // Browser shortcuts, with Chrome/Firefox as the default.
@@ -44,10 +45,11 @@
#define BABL_APP_WINDOWSPLITTING // splitting frames & windows
//All OSes
-#define BABL_WINDOWS
+
+//#define BABL_WINDOWS
#define BABL_READMUX
-#define BABL_VI
+//#define BABL_VI
#define BABL_MAC
#define BABL_LINUX
-#define BABL_EMACS
+//#define BABL_EMACS
#define BABL_CHROMEOS
diff --git a/users/miles2go/milestogo.c b/users/miles2go/milestogo.c
index f1da2f4d7a..1c7f174e4a 100644
--- a/users/miles2go/milestogo.c
+++ b/users/miles2go/milestogo.c
@@ -9,6 +9,8 @@ __attribute__((weak)) bool process_record_keymap(uint16_t keycode, keyrecord_t *
bool move_is_on = false; // track if we are in _MOV layer
bool sym_is_on = false; // track if we are in _SYM layer
+
+
// Defines actions for global custom keycodes
// Then runs the _keymap's record handier if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
@@ -16,24 +18,26 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef USE_BABBLEPASTE
if (keycode > BABBLE_START && keycode < BABBLE_END_RANGE) {
- if (record->event.pressed) { // is there a case where this isn't desired?
- babblePaste(keycode);
+ if (record->event.pressed) {
+ babblePaste(keycode, 1);
} else {
- return true;
+ babblePaste(keycode, 0);
}
}
#endif
switch (keycode) {
- case _QWERTY:
+ case KC_QWERTY:
if (record->event.pressed) {
- set_single_persistent_default_layer(_QWERTY);
+ layer_off(_CDH);
+ default_layer_set(_QWERTY);
}
break;
- case _CDH:
+ case KC_CDH:
if (record->event.pressed) {
- set_single_persistent_default_layer(_CDH);
+ layer_on(_CDH);
+ default_layer_set(_CDH);
}
break;
@@ -71,9 +75,9 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) {
return process_record_keymap(keycode, record);
}
-void babble_led_user(void) {
+void babble_modeswitch_user(uint8_t mode) {
#ifdef USE_BABLPASTE
- extern uint8_t babble_mode;
+ extern uint8_t babble_mode; // still using global. why?
# ifdef BABL_WINDOWS
if (babble_mode == BABL_WINDOWS_MODE) {
@@ -140,3 +144,10 @@ void babble_led_user(void) {
# endif
#endif // bablepaste
}
+
+
+// we always return true here, so that each keyboard can use it's own
+// led_update_kb() function
+bool led_update_user(led_t led_state ) {
+ return true;
+} \ No newline at end of file
diff --git a/users/miles2go/milestogo.h b/users/miles2go/milestogo.h
index dfb344212e..3a99f6d2a8 100644
--- a/users/miles2go/milestogo.h
+++ b/users/miles2go/milestogo.h
@@ -1,4 +1,4 @@
-/* Modified from
+/* Modified from
Copyright 2017 Christopher Courtney <drashna@live.com> @drashna
This program is free software: you can redistribute it and/or modify
@@ -15,117 +15,99 @@ 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 "quantum.h"
#include "version.h"
#include "eeprom.h"
-
#ifdef USE_BABBLEPASTE
-#include "babblePaste.h"
-#endif
+# include "babblePaste.h"
+#endif
#ifdef RGB_MATRIX_ENABLE
-#include "rgb_matrix.h"
+# include "rgb_matrix.h"
#endif
#define USERSPACE_ACTIVE
/* Define layer names */
-enum userspace_layers {