Skip to content

Instantly share code, notes, and snippets.

@juno juno/keymap.diff
Last active Jan 11, 2019

Embed
What would you like to do?
qmk macro definition for refocusing to page from omnibar (Chrome): https://docs.qmk.fm/#/feature_macros
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;
}
@juno

This comment has been minimized.

Copy link
Owner Author

juno commented Jan 11, 2019

TIP: If you use qmk QWERTY keymap with macOS's Dvorak Input Source, you need to modify SEND_STRING arguments like this:

        SEND_STRING(SS_LGUI("p")); // Cmd+L
        SEND_STRING("ca.a;iogrkZ" SS_TAP(X_ENTER)); // "javascript:" + ENTER
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.