most of the above file is copied from the default keymap.c file from the hifumi keymap. the above file is a full copy pasted keymap.c, ready for use on a hifumi 6-key macropad, keymaps doing:
first col | second col | third col |
---|---|---|
page down | up arrow | start steam |
left arrow | down arrow | right arrow |
- declare an enum called custom_keycodes
enum custom_keycodes {
STEAM = SAFE_RANGE, // SAFE_RANGE prevents it from using a clashing keycode
};
- create a function called process_record_user with:
- a
SEND_STRING(SS_TAP(X_LGUI) "steam" SS_DELAY(500) SS_TAP(X_ENT));
where the text in the double quotes is anything you type in your windows searchbar - this essentially taps the windows button, types your text, wait a bit for search to finish, then press ENTER. et voila! opens your program.
- a
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
switch (keycode) {
case STEAM:
if (record->event.pressed) {
SEND_STRING(SS_TAP(X_LGUI) "steam" SS_DELAY(500) SS_TAP(X_ENT));
} else {
// when keycode is released
}
break;
}
return true;
}
- use that function in your keymap
const uint16_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
[DEFAULT] = LAYOUT(
KC_PGDN, KC_UP, STEAM, // used my top right key for the 'open steam' macro
KC_LEFT, KC_DOWN, KC_RIGHT
),
// the rest of the kepmap layers if needed
Wouldn't it be quicker and more reliable to send LGUI(R) (Windows' Run command), then sending the string of the location of a program, plus any switch one wishes to add? That way no delay would be needed, as Run is executed only after enter is pressed.