Last active
January 11, 2019 03:58
-
-
Save juno/05f735f71a11f22bc12f8878ffb1f5dd to your computer and use it in GitHub Desktop.
qmk macro definition for refocusing to page from omnibar (Chrome): https://docs.qmk.fm/#/feature_macros
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/keyboards/crkbd/keymaps/juno/keymap.c b/keyboards/crkbd/keymaps/juno/keymap.c | |
index 487850951..4893837e9 100644 | |
--- a/keyboards/crkbd/keymaps/juno/keymap.c | |
+++ b/keyboards/crkbd/keymaps/juno/keymap.c | |
@@ -32,7 +32,8 @@ enum custom_keycodes { | |
RAISE, | |
ADJUST, | |
BACKLIT, | |
- RGBRST | |
+ RGBRST, | |
+ REFOCUS, | |
}; | |
enum macro_keycodes { | |
@@ -63,6 +64,7 @@ enum macro_keycodes { | |
#define KC_LSES LSFT_T(KC_ESC) // Tap to ESC, Hold to Shift | |
#define KC_LOCK LCTL(LSFT(KC_POWER)) | |
#define KC_SLP LGUI(LALT(KC_POWER)) | |
+#define KC_RFC REFOCUS | |
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
[_QWERTY] = LAYOUT_kc( | |
@@ -103,7 +105,7 @@ const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = { | |
[_ADJUST] = LAYOUT_kc( | |
//|----+----+----+----+----+----| |----+----+----+----+----+----| | |
- RST , , , , , , , , , , , , | |
+ RST , , , , , , , , , , RFC, , | |
//|----+----+----+----+----+----| |----+----+----+----+----+----| | |
LTOG,LHUI,LSAI,LVAI, ,LOCK, , , , , , , | |
//|----+----+----+----+----+----| |----+----+----+----+----+----| | |
@@ -247,6 +249,16 @@ bool process_record_user(uint16_t keycode, keyrecord_t *record) { | |
} | |
#endif | |
break; | |
+ case REFOCUS: | |
+ if (record->event.pressed) { | |
+ // when keycode QMKBEST is pressed | |
+ SEND_STRING(SS_LGUI("l")); // Cmd+L | |
+ SEND_STRING("javascript:" SS_TAP(X_ENTER)); // "javascript:" + ENTER | |
+ } else { | |
+ // when keycode QMKBEST is released | |
+ } | |
+ return false; | |
+ break; | |
} | |
return true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
TIP: If you use qmk QWERTY keymap with macOS's Dvorak Input Source, you need to modify
SEND_STRING
arguments like this: