diff options
Diffstat (limited to 'users/miles2go/babblePaste.md')
| -rw-r--r-- | users/miles2go/babblePaste.md | 71 |
1 files changed, 54 insertions, 17 deletions
diff --git a/users/miles2go/babblePaste.md b/users/miles2go/babblePaste.md index cc1c31bd0..4f68cc4ae 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 | |||
| 26 | #define BABL_MAC | 26 | #define BABL_MAC |
| 27 | #define BABL_LINUX | 27 | #define BABL_LINUX |
| 28 | #define BABL_EMACS | 28 | #define BABL_EMACS |
| 29 | #define BABL_NANO | ||
| 29 | #define BABL_CHROMEOS | 30 | #define BABL_CHROMEOS |
| 30 | 31 | ||
| 31 | //// These enable subsets of babble macros. Disable options to save space | 32 | //// 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 | |||
| 56 | 57 | ||
| 57 | Add the following to your keymap in process_record_user, before the main switch statement. | 58 | Add the following to your keymap in process_record_user, before the main switch statement. |
| 58 | ``` | 59 | ``` |
| 59 | #ifdef USE_BABBLEPASTE | 60 | #ifdef USE_BABBLEPASTE |
| 60 | if( keycode > BABBLE_START && keycode < BABBLE_END_RANGE ) { | 61 | if (keycode > BABBLE_START && keycode < BABBLE_END_RANGE) { |
| 61 | if (record->event.pressed) { // is there a case where this isn't desired? | 62 | if (record->event.pressed) { |
| 62 | babblePaste ( keycode ); | 63 | babblePaste(keycode, 1); |
| 63 | } else{ | 64 | } else { |
| 64 | return true; | 65 | babblePaste(keycode, 0); |
| 65 | } | ||
| 66 | } | 66 | } |
| 67 | #endif | 67 | } |
| 68 | #endif | ||
| 68 | ``` | 69 | ``` |
| 69 | 70 | ||
| 70 | #### Add makefile rules | 71 | #### Add makefile rules |
| 71 | 72 | ||
| 72 | Update your rules.mk to include the modes you want. | 73 | Update your rules.mk to include the modes you want. |
| 73 | 74 | ||
| 74 | `SRC += babblePaste.c babl_windows.c babl_mac.c babl_vi.c babl_readmux.c babl_chromeos.c babl_emacs.c babl_linux.c` | 75 | `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` |
| 75 | 76 | ||
| 76 | 77 | ||
| 77 | #### Custom Keycodes | 78 | #### Custom Keycodes |
| @@ -97,9 +98,18 @@ See the full list in babblePaste.h, or the list below | |||
| 97 | B_LNX // switch to linux | 98 | B_LNX // switch to linux |
| 98 | B_VI // switch to Vi mode | 99 | B_VI // switch to Vi mode |
| 99 | B_EMAX // switch mode to emacs | 100 | B_EMAX // switch mode to emacs |
| 101 | B_NANO // switch mode to emacs | ||
| 100 | B_READ // switch to readline /tmux mode | 102 | B_READ // switch to readline /tmux mode |
| 101 | B_CROM // switch to chromeos mode. | 103 | B_CROM // switch to chromeos mode. |
| 102 | 104 | ||
| 105 | // Swap meaning of modifier key in most ergonomic location based on babble | ||
| 106 | // mode. Eg Thumb gets CTL on Win/Linux, pinky gets Windows key. Reverse for | ||
| 107 | // OS X. See first line in babblepaste function. | ||
| 108 | #define B_1ME BABL_PRIMARY_OS_MOD | ||
| 109 | #define B_2ME BABL_SECONDARY_OS_MOD | ||
| 110 | #define B_3ME BABL_TERTIARY_OS_MOD | ||
| 111 | |||
| 112 | // Macros | ||
| 103 | #define B_L1C BABL_GO_LEFT_1C | 113 | #define B_L1C BABL_GO_LEFT_1C |
| 104 | #define B_R1C BABL_GO_RIGHT_1C | 114 | #define B_R1C BABL_GO_RIGHT_1C |
| 105 | #define B_L1W BABL_GO_LEFT_WORD | 115 | #define B_L1W BABL_GO_LEFT_WORD |
| @@ -137,6 +147,10 @@ See the full list in babblePaste.h, or the list below | |||
| 137 | #define B_PAPP BABL_SWITCH_APP_LAST // previous | 147 | #define B_PAPP BABL_SWITCH_APP_LAST // previous |
| 138 | #define B_CAPP BABL_CLOSE_APP | 148 | #define B_CAPP BABL_CLOSE_APP |
| 139 | #define B_HELP BABL_HELP | 149 | #define B_HELP BABL_HELP |
| 150 | #define B_HELP BABL_HELP | ||
| 151 | #define B_LOCK BABL_LOCK | ||
| 152 | #define B_SCAP BABL_SCREENCAPTURE | ||
| 153 | #define B_KEYB BABL_SWITCH_KEYBOARD_LAYOUT | ||
| 140 | 154 | ||
| 141 | #define B_NTAB BABL_BROWSER_NEW_TAB | 155 | #define B_NTAB BABL_BROWSER_NEW_TAB |
| 142 | #define B_CTAB BABL_BROWSER_CLOSE_TAB | 156 | #define B_CTAB BABL_BROWSER_CLOSE_TAB |
| @@ -151,9 +165,10 @@ See the full list in babblePaste.h, or the list below | |||
| 151 | #define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember | 165 | #define B_BDEV BABL_BROWSER_DEV_TOOLS // hard one to remember |
| 152 | #define B_BRLD BABL_BROWSER_RELOAD | 166 | #define B_BRLD BABL_BROWSER_RELOAD |
| 153 | #define B_BFULL BABL_BROWSER_FULLSCREEN | 167 | #define B_BFULL BABL_BROWSER_FULLSCREEN |
| 154 | #define B_ZIN BABL_BROWSER_ZOOM_IN | 168 | #define B_ZIN BABL_BROWSER_ZOOM_IN |
| 155 | #define B_ZOUT BABL_BROWSER_ZOOM_OUT | 169 | #define B_ZOUT BABL_BROWSER_ZOOM_OUT |
| 156 | 170 | ||
| 171 | #define B_SAVE BABL_APP_SAVE | ||
| 157 | #define B_PASTV BABL_APP_PASTE_VALUES | 172 | #define B_PASTV BABL_APP_PASTE_VALUES |
| 158 | #define B_CALN BABL_APP_CENTER_ALIGN | 173 | #define B_CALN BABL_APP_CENTER_ALIGN |
| 159 | #define B_CFMT BABL_APP_CLEAR_FORMATTING | 174 | #define B_CFMT BABL_APP_CLEAR_FORMATTING |
| @@ -167,6 +182,7 @@ See the full list in babblePaste.h, or the list below | |||
| 167 | #define B_SELR BABL_SELECT_ROW | 182 | #define B_SELR BABL_SELECT_ROW |
| 168 | 183 | ||
| 169 | #define B_MSEL BABL_APP_MULTI_SELECT | 184 | #define B_MSEL BABL_APP_MULTI_SELECT |
| 185 | #define B_MARK BABL_APP_SET_MARK | ||
| 170 | #define B_VSPLIT BABL_SPLIT_FRAME_VERT | 186 | #define B_VSPLIT BABL_SPLIT_FRAME_VERT |
| 171 | #define B_VUNSPT BABL_UNSPLIT_FRAME_VERT | 187 | #define B_VUNSPT BABL_UNSPLIT_FRAME_VERT |
| 172 | #define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL | 188 | #define B_HSPLIT BABL_SPLIT_FRAME_HORIZONTAL |
| @@ -175,27 +191,48 @@ See the full list in babblePaste.h, or the list below | |||
| 175 | #define B_PRVFM BABL_PREV_FRAME | 191 | #define B_PRVFM BABL_PREV_FRAME |
| 176 | ``` | 192 | ``` |
| 177 | 193 | ||
| 194 | ####Add babblepaste functions to your keyboard or userspace | ||
| 195 | Functions babble_led_user() and babble_led_kb() are called when babble mode is changed. | ||
| 196 | ``` | ||
| 197 | void babble_modeswitch_kb(uint8_t mode){ | ||
| 198 | #ifdef USE_BABBLEPASTE | ||
| 199 | writePinLow(B3); writePinLow(B2); | ||
| 200 | switch(mode) { | ||
| 201 | case(BABL_LINUX_MODE): | ||
| 202 | writePinHigh(B2); | ||
| 203 | backlight_level(1); | ||
| 204 | break; | ||
| 205 | case(BABL_MAC_MODE): | ||
| 206 | writePinHigh(B3); | ||
| 207 | backlight_level(4); | ||
| 208 | break; | ||
| 209 | } | ||
| 210 | // call the user function | ||
| 211 | babble_modeswitch_user(mode); | ||
| 212 | #endif | ||
| 213 | ``` | ||
| 214 | |||
| 215 | |||
| 178 | 216 | ||
| 179 | ## Development FAQs | 217 | ## Development FAQs |
| 180 | 218 | ||
| 181 | **Todos** | 219 | **Todos** |
| 182 | eeprom store state of babble_mode? or update docs so that people can change the order of the enum in | 220 | eeprom store state of babble_mode? or update docs so that people can change the order of the enum in babblespace.h? |
| 183 | babblespace.h? | ||
| 184 | 221 | ||
| 185 | **You have huge ifdef stanzas instead of functions** | 222 | **You have huge ifdef stanzas instead of functions** |
| 186 | This fails gracefully if you don't have all options defined. Patch if you can think how to use fewer defines. | 223 | This fails gracefully if you don't have all options defined. Patch if you can think how to use fewer defines. |
| 187 | 224 | ||
| 188 | ** Why not an array of arrays as a lookup instead of a function?** | 225 | **Why not an array of arrays as a lookup instead of a function?** |
| 189 | This would allow you to store the lookup table in PROGMEM. | 226 | This would allow you to store the lookup table in PROGMEM. |
| 190 | True, but that takes more pre-processor skill than I have, and may be less portable to ARM or other flash mappings. | 227 | True, but that takes more pre-processor skill than I have, and may be less portable to ARM or other flash mappings. |
| 191 | 228 | ||
| 192 | ** Have you tested every key on every platform?** | 229 | **Have you tested every key on every platform?** |
| 193 | No. Be careful, submit a patch. | 230 | No. Be careful, submit a patch. |
| 194 | 231 | ||
| 195 | ** Why not update Apps at the same global level as the OS? ** | 232 | **Why not change apps App babble modes at the same global level as the OS?** |
| 196 | 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. | 233 | 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. |
| 197 | 234 | ||
| 198 | ** Can the OS tell the keyboard what mode to use? ** | 235 | **Can the OS tell the keyboard what mode to use?** |
| 199 | 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. | 236 | 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. |
| 200 | One could use a keyboard macro to launch an app & switch modes for that app. | 237 | One could use a keyboard macro to launch an app & switch modes for that app. |
| 201 | 238 | ||
