コード例 #1
0
ファイル: keymap.c プロジェクト: 0xdec/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch(keycode) {
    /* include some kind of library or header */
    case KC_INCL:
      if (record->event.pressed) {
        SEND_STRING("#include <>" SS_TAP(X_LEFT));
      }
      return false;
    case KC_PULL:
      if (record->event.pressed) {
        SEND_STRING("git pull" SS_TAP(X_ENTER));
      }
      return false;
    case KC_PUSH:
      if (record->event.pressed){
        SEND_STRING("git push" SS_TAP(X_ENTER));
      }
      return false;
    case KC_SCAP:
      if (record->event.pressed){
        layer_on(_CAPS);
        register_code(KC_CAPSLOCK);
        unregister_code(KC_CAPSLOCK);
      }
      return false;
    case KC_SCOF:
      if (record->event.pressed){
        layer_off(_CAPS);
        register_code(KC_CAPSLOCK);
        unregister_code(KC_CAPSLOCK);
      }
      return false;
  }
  return true;
};
コード例 #2
0
ファイル: keymap.c プロジェクト: Depariel/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  static uint16_t code_timer;
  switch (keycode) {
  case KC_MCBR:                                  
    if(record->event.pressed){
      code_timer= timer_read();
      SEND_STRING("{");
    } else {
      if (timer_elapsed(code_timer) > TAPPING_TERM) {
        SEND_STRING("}" SS_TAP(X_LEFT));
      } 
    }
    return false;
    break;
  case KC_MBRC:                                  
    if(record->event.pressed){
      code_timer= timer_read();
      SEND_STRING("[");
    } else {
      if (timer_elapsed(code_timer) > TAPPING_TERM) {
        SEND_STRING("]" SS_TAP(X_LEFT));
      } 
    }
    return false;
    break;
  case KC_MPRN:                                  
    if(record->event.pressed){
      code_timer= timer_read();
      SEND_STRING("(");
    } else {
      if (timer_elapsed(code_timer) > TAPPING_TERM) {
        SEND_STRING(")" SS_TAP(X_LEFT));
      } 
    }
    return false;
    break;
  case KC_MABK:                                  
    if(record->event.pressed){
      code_timer= timer_read();
      if (get_mods() & MODS_SHIFT_MASK){
        SEND_STRING("<");
      } else {
        SEND_STRING(",");
      }
    } else {
      if (timer_elapsed(code_timer) > TAPPING_TERM) {
        if (get_mods()  & MODS_SHIFT_MASK){
          SEND_STRING(">" SS_TAP(X_LEFT));
        }
      } 
    }
    return false;
    break;
  }
  return true;
}
コード例 #3
0
ファイル: keymap.c プロジェクト: UnderSampled/qmk_firmware
// GBP £ Macro (sends alt 156 - windows users only)
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    if (record->event.pressed) {
        switch(keycode) {
            case P_MACRO:
                SEND_STRING(SS_DOWN(X_LALT));
                SEND_STRING(SS_TAP(X_KP_1));
                SEND_STRING(SS_TAP(X_KP_5));
                SEND_STRING(SS_TAP(X_KP_6));
                SEND_STRING(SS_UP(X_LALT));
                return false; break;
        }
    }
    return true;
};
コード例 #4
0
ファイル: tapdances.c プロジェクト: algernon/qmk_firmware
void CAD_finished (qk_tap_dance_state_t *state, void *user_data) {
  CADtap_state.state = cur_dance(state);
  switch (CADtap_state.state) {
    case SINGLE_TAP:
		//register_code(KC_SPC);
		SEND_STRING(SS_LGUI("l"));
		#ifdef BACKLIGHT_ENABLE
    backlight_level(3);
		#endif
		break;
    case SINGLE_HOLD:
		//register_code(KC_NO);
		//take a screenshot of a single window, open Paint and paste
		SEND_STRING(SS_LALT(SS_TAP(X_PSCREEN)) SS_LGUI("r"));
        _delay_ms(500);
        SEND_STRING("mspaint" SS_TAP(X_ENTER));
        _delay_ms(700);
        SEND_STRING(SS_LCTRL("v"));
		break; //register this keycode when button is held
    case DOUBLE_TAP:
		//register_code(KC_ENT);
		SEND_STRING(SS_LCTRL(SS_LALT(SS_TAP(X_DELETE))));
		#ifdef BACKLIGHT_ENABLE
    backlight_level(0);
		#endif
		break;
    //case DOUBLE_HOLD: register_code(KC_NO); break; //register this keycode when button is tapped and then held
	case DOUBLE_HOLD:
		reset_keyboard();
		break; //register this keycode when button is tapped and then held
	case TRIPLE_TAP:
		SEND_STRING("*****@*****.**");
		break;
	case TRIPLE_HOLD:
  set_single_persistent_default_layer(1);
  #ifdef AUDIO_ENABLE
    stop_all_notes();
    PLAY_SONG(lyrup_song);
  #endif
  break;
  }
}
コード例 #5
0
ファイル: keymap.c プロジェクト: muzfuz/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case M1_STRING:
      if (record->event.pressed) {
        // when keycode QMKBEST is pressed
        SEND_STRING("Hi!" SS_TAP(X_ENTER));
      } else {
        // when keycode QMKBEST is released
      }
      break;

    case M2_URL:
      if (record->event.pressed) {
          SEND_STRING("https://ddg.gg" SS_TAP(X_ENTER));
      }
      break;

  }
  return true;
};
コード例 #6
0
ファイル: keymap.c プロジェクト: EnsuingRequiem/qmk_firmware
bool process_record_keymap(uint16_t keycode, keyrecord_t *record) {
  switch(keycode) {
    case KC_LOCK:
      if (record->event.pressed) {
        if (edvorakjp_config.enable_kc_lang) {
          SEND_STRING( SS_LCTRL(SS_LSFT(SS_TAP(X_POWER))) );
        } else {
          SEND_STRING( SS_LGUI("l") );
        }
      }
      return false;
  }
  return true;
}
コード例 #7
0
ファイル: talljoe.c プロジェクト: bellwood4486/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

#ifdef RGBLIGHT_ENABLE
  static uint32_t savedRgbMode;
  static uint16_t savedHue;
  static uint8_t savedSat;
  static uint8_t savedVal;

  if (keycode == KC_ESC) {
    if (record->event.pressed) {
      savedRgbMode = rgblight_get_mode();
      savedHue = rgblight_get_hue();
      savedSat = rgblight_get_sat();
      savedVal = rgblight_get_val();
      rgblight_mode(1);
      rgblight_setrgb(255, 0, 0);
    } else {
      rgblight_mode(savedRgbMode);
      rgblight_sethsv(savedHue, savedSat, savedVal);
    }
  }
#endif
// If console is enabled, it will print the matrix position and status of each key pressed
#ifdef CONSOLE_ENABLE
  xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.row, record->event.key.col, record->event.pressed);
#endif //CONSOLE_ENABLE

  switch (keycode) {
    case KC_MAKE:  // Compiles the firmware, and adds the flash command based on keyboard bootloader
      if (!record->event.pressed) {
        SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP

  #if   defined(BOOTLOADER_HALFKAY)
                    ":teensy"
  #elif defined(BOOTLOADER_CATERINA)
                    ":avrdude"
  #else
                    ":dfu"
  #endif
                    SS_TAP(X_ENTER));
      }
      return false;
      break;
  }
  return process_record_keymap(keycode, record);
}
コード例 #8
0
ファイル: keymap.c プロジェクト: oli-obk/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
  case CLEAR:
    if (record->event.pressed) { SEND_STRING(SS_LCTRL("a") SS_TAP(X_DELETE)); }
    return false;

  case NUMPAD:
    if (record->event.pressed) {
      layer_invert(L_NUMPAD);
      bool num_lock = host_keyboard_leds() & 1<<USB_LED_NUM_LOCK;
      if (num_lock != (bool)IS_LAYER_ON(L_NUMPAD)) {
        tap_code(KC_NLCK); // Toggle Num Lock to match layer state.
      }
    }
    return false;

  default:
    return true;
  }
}
コード例 #9
0
ファイル: keymap.c プロジェクト: 0xdec/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  switch (keycode) {
    case QMKBEST:
      if (record->event.pressed) {
        // when keycode QMKBEST is pressed
        SEND_STRING("QMK is the best thing ever!");
      } else {
        // when keycode QMKBEST is released
      }
      break;
    case QMKURL:
      if (record->event.pressed) {
        // when keycode QMKURL is pressed
        SEND_STRING("https://qmk.fm/" SS_TAP(X_ENTER));
      } else {
        // when keycode QMKURL is released
      }
      break;
  }
  return true;
}
コード例 #10
0
ファイル: keymap.c プロジェクト: 0xdec/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
	if (record->event.pressed) {
		switch(keycode) {
			case GIT_ADD:
				SEND_STRING("git add ."SS_TAP(X_ENTER));
        break;
      case GIT_COMMIT:
        SEND_STRING("git commit -m "SS_DOWN(X_LSHIFT)SS_TAP(X_QUOTE)SS_UP(X_LSHIFT));
        break;
      case GIT_PUSH:
        SEND_STRING("git push"SS_TAP(X_ENTER));
        break;
      case MUTE:
        SEND_STRING(SS_LGUI(SS_LSFT("M")));
        break;
      case DEAFEN:
        SEND_STRING(SS_LGUI(SS_LSFT("D")));
        break;
      return false;
		}
	}
	return true;
};
コード例 #11
0
ファイル: keymap.c プロジェクト: 0xdec/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  uint8_t modifiers = get_mods();
  switch(keycode) {
    // these are our macros!
    case F_CAPS:
      /*
        Objective: write a macro that checks the current layers that are
        enabled, and activates the appropriate function layer.
      */
      if ( biton32(layer_state) == _MAC ) {
        if (record->event.pressed) {
          layer_on(_FUNCMAC);
        } else {
          layer_off(_FUNCMAC);
        }
      } else {
        if (record->event.pressed) {
          layer_on(_FUNCWIN);
        } else {
          layer_off(_FUNCWIN);
        }
      };
      return false;
      break;
    case T_L3DED:
      if (record->event.pressed) {
        SEND_STRING("lavak3DED ");
      };
      return false;
      break;
    case G_PUSH:
      if (record->event.pressed) {
        SEND_STRING("git push origin ");
      };
      return false;
      break;
    case G_FTCH:
      if (record->event.pressed) {
        SEND_STRING("git fetch upstream");
      };
      return false;
      break;
    case G_COMM:
      if (record->event.pressed) {
        SEND_STRING("git commit -m \"\"" SS_TAP(X_LEFT));
        layer_off(_MACROS);
      };
      return false;
      break;
    case G_RST:
      if (record->event.pressed) {
        SEND_STRING("git histt -n 10" SS_TAP(X_ENTER) "git reset --soft ");
        layer_off(_MACROS);
      };
      return false;
      break;
    case G_C10R:
      if (record->event.pressed) {
        SEND_STRING("cf/");
        layer_off(_MACROS);
      };
      return false;
      break;
    case G_BRCH:
      if (record->event.pressed) {
        SEND_STRING("$(git branch-name)");
        layer_off(_MACROS);
      };
      return false;
      break;
    case SIGNA:
      if (record->event.pressed) {
        SEND_STRING("\\- @noroadsleft" SS_TAP(X_ENTER));
        layer_off(_MACROS);
      };
      return false;
      break;
    case GO_Q2:
      if (record->event.pressed) {
        //default_layer_set(_QWERTY);
        layer_move(_QWERTY); // TO(_QWERTY);
        layer_on(_QUAKE2);
        //layer_off(_SYSTEM);
      };
      return false;
      break;
    case Q2_ON:
      if (record->event.pressed) {
        SEND_STRING(SS_TAP(X_ENTER));
        layer_on(_DVORAK);
        layer_on(_QUAKE2_DVORAK);
      };
      return false;
      break;
    case Q2_OFF:
      if (record->event.pressed) {
        SEND_STRING(SS_TAP(X_ENTER));
        layer_move(_QWERTY); // TO(_QWERTY);
        layer_on(_QUAKE2);
      };
      return false;
      break;
    case Q2_ESC:
      if (record->event.pressed) {
        SEND_STRING(SS_TAP(X_ESCAPE));
        layer_move(_QWERTY); // TO(_QWERTY);
        layer_on(_QUAKE2);
      };
      return false;
      break;
    case Q2_GRV:
      if (record->event.pressed) {
        SEND_STRING(SS_TAP(X_GRAVE));
        layer_on(_DVORAK);
        layer_on(_QUAKE2_DVORAK);
        layer_on(_QUAKE2_CONSOLE);
      };
      return false;
      break;
    case MC_UNDO:
      if (record->event.pressed) {
        if ( modifiers & MODS_SHIFT_MASK ) {
          SEND_STRING( SS_DOWN(X_LSHIFT) SS_DOWN(X_LGUI) SS_TAP(X_Z) SS_UP(X_LGUI) SS_UP(X_LSHIFT) );
        } else {
          SEND_STRING( SS_DOWN(X_LGUI) SS_TAP(X_Z) SS_UP(X_LGUI) );
        }
      };
      return false;
      break;
    case MC_PSTE:
      if (record->event.pressed) {
        if ( modifiers & MODS_SHIFT_MASK ) {
          SEND_STRING( SS_DOWN(X_LSHIFT) SS_DOWN(X_LGUI) SS_DOWN(X_LALT) SS_TAP(X_V) SS_UP(X_LALT) SS_UP(X_LGUI) SS_UP(X_LSHIFT) );
        } else {
          SEND_STRING( SS_DOWN(X_LGUI) SS_TAP(X_V) SS_UP(X_LGUI) );
        }
      };
      return false;
      break;
  } // switch()
  return true;
};
コード例 #12
0
ファイル: keymap.c プロジェクト: exklamationmark/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
    uint16_t kc;
    if (is_overwatch) {
        kc = KC_BSPC;
    } else {
        kc = KC_ENTER;
    }
    switch (keycode) {
#ifdef TAP_DANCE_ENABLE
    case KC_DIABLO_CLEAR:  // reset all Diable timers, disabling them
            if (record->event.pressed) {
                uint8_t dtime;

                for (dtime = 0; dtime < 4; dtime++) {
                    diablo_key_time[dtime] = diablo_times[0];
                }
            }
            return false;
            break;
#endif
        case KC_OVERWATCH:
            if (record->event.pressed) {
                is_overwatch = !is_overwatch;
            }
#ifdef RGBLIGHT_ENABLE
            is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
#endif
            return false;
            break;
        case KC_SALT:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Salt, salt, salt...");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_MORESALT:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Please sir, can I have some more salt?!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_SALTHARD:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Your salt only makes my penis that much harder, and even more aggressive!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_GOODGAME:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Good game, everyone!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_GLHF:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Good luck, have fun!!!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_SYMM:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Left click to win!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_DOOMFIST:
            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("Hey, look at me.  I'm Doomfist, and I'm overpowered!  All I do is spam punches all day!   I'm DPS, tank and defense, rolled into one! All I need is team healing to be complete!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_JUSTGAME:

            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_TORB:

            if (!record->event.pressed) {
                register_code(kc);
                unregister_code(kc);
                _delay_ms(50);
                SEND_STRING("That was positively riveting!");
                register_code(KC_ENTER);
                unregister_code(KC_ENTER);
            }
            return false;
            break;
        case KC_MAKE:
            if (!record->event.pressed) {
                SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP SS_TAP(X_ENTER));
            }
            return false;
            break;


  }
  return true;
}
コード例 #13
0
ファイル: keymap.c プロジェクト: Twey/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
#ifdef CFQ_USE_DYNAMIC_MACRO
  if (!process_record_dynamic_macro(keycode, record)) {
    return false;
  }
#endif
  switch (keycode) {
    /* dynamically generate these. */
    case RGB_SLD:
      if (record->event.pressed) {
#ifdef RGBLIGHT_ENABLE
        rgblight_mode(1);
#endif
      }
      return false;
      break;
    case M_BRACKET_IN_CBR:  /* {} */
      if (record->event.pressed) {
        SEND_STRING("{}" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_IN_PRN:  /* () */
      if (record->event.pressed) {
        SEND_STRING("()" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_IN_BRC:  /* [] */
      if (record->event.pressed) {
        SEND_STRING("[]" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_IN_ANG:  /* <> */
      if (record->event.pressed) {
        SEND_STRING("<>" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_OUT_CBR:  /* }{ */
      if (record->event.pressed) {
        SEND_STRING("}{" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_OUT_PRN:  /* )( */
      if (record->event.pressed) {
        SEND_STRING(")(" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_OUT_BRC:  /* ][ */
      if (record->event.pressed) {
        SEND_STRING("][" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_BRACKET_OUT_ANG:  /* >< */
      if (record->event.pressed) {
        SEND_STRING("><" SS_TAP(X_LEFT));
        return false;
      }
      break;
    case M_ARROW_LMINUS:  /* <- */
      if (record->event.pressed) {
        SEND_STRING("<-");
        return false;
      }
      break;
    case M_ARROW_RMINUS:  /* -> */
      if (record->event.pressed) {
        SEND_STRING("->");
        return false;
      }
      break;
    case M_ARROW_LEQL:  /* <= */
      if (record->event.pressed) {
        SEND_STRING("<=");
        return false;
      }
      break;
    case M_ARROW_REQL:  /* => */
      if (record->event.pressed) {
        SEND_STRING("=>");
        return false;
      }
      break;
#ifdef CFQ_USE_SHIFT_QUOTES
    case KC_LSHIFT:  /* '' */
      if (record->event.pressed && (keyboard_report->mods & (MOD_BIT(KC_RSFT)))) {
        WITHOUT_MODS({
            SEND_STRING("''" SS_TAP(X_LEFT) SS_DOWN(X_RSHIFT) SS_DOWN(X_LSHIFT));
          });
        return false;
      }
コード例 #14
0
ファイル: drashna.c プロジェクト: jmatth/qmk_firmware
// Defines actions tor my global custom keycodes. Defined in drashna.h file
// Then runs the _keymap's recod handier if not processed here
bool process_record_user(uint16_t keycode, keyrecord_t *record) {

#ifdef CONSOLE_ENABLE
  xprintf("KL: row: %u, column: %u, pressed: %u\n", record->event.key.col, record->event.key.row, record->event.pressed);
#endif

#ifdef AUDIO_ENABLE
  if (faux_click_enabled) {
    if (record->event.pressed) {
      PLAY_SONG(fauxclicky_pressed);
    } else {
      stop_note(NOTE_A6);
      PLAY_SONG(fauxclicky_released);
    }
  }
#endif

  switch (keycode) {
  case KC_QWERTY:
    if (record->event.pressed) {
#ifdef AUDIO_ENABLE
      PLAY_SONG(tone_qwerty);
#endif
      persistent_default_layer_set(1UL << _QWERTY);
    }
    return false;
    break;
  case KC_COLEMAK:
    if (record->event.pressed) {
#ifdef AUDIO_ENABLE
      PLAY_SONG(tone_colemak);
#endif
      persistent_default_layer_set(1UL << _COLEMAK);
    }
    return false;
    break;
  case KC_DVORAK:
    if (record->event.pressed) {
#ifdef AUDIO_ENABLE
      PLAY_SONG(tone_dvorak);
#endif
      persistent_default_layer_set(1UL << _DVORAK);
    }
    return false;
    break;
  case KC_WORKMAN:
    if (record->event.pressed) {
#ifdef AUDIO_ENABLE
      PLAY_SONG(tone_workman);
#endif
      persistent_default_layer_set(1UL << _WORKMAN);
    }
    return false;
    break;
  case LOWER:
    if (record->event.pressed) {
      layer_on(_LOWER);
      update_tri_layer(_LOWER, _RAISE, _ADJUST);
    }
    else {
      layer_off(_LOWER);
      update_tri_layer(_LOWER, _RAISE, _ADJUST);
    }
    return false;
    break;
  case RAISE:
    if (record->event.pressed) {
      layer_on(_RAISE);
      update_tri_layer(_LOWER, _RAISE, _ADJUST);
    }
    else {
      layer_off(_RAISE);
      update_tri_layer(_LOWER, _RAISE, _ADJUST);
    }
    return false;
    break;
  case ADJUST:
    if (record->event.pressed) {
      layer_on(_ADJUST);
    }
    else {
      layer_off(_ADJUST);
    }
    return false;
    break;
#if !(defined(KEYBOARD_orthodox_rev1) || defined(KEYBOARD_orthodox_rev3) || defined(KEYBOARD_ergodox_ez))
  case KC_OVERWATCH:
    if (record->event.pressed) {
      is_overwatch = !is_overwatch;
    }
#ifdef RGBLIGHT_ENABLE
    is_overwatch ? rgblight_mode(17) : rgblight_mode(18);
#endif
    return false;
    break;
  case KC_SALT:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("Salt, salt, salt...");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_MORESALT:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("Please sir, can I have some more salt?!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_SALTHARD:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("Your salt only makes me harder, and even more aggressive!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_GOODGAME:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("Good game, everyone!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_GLHF:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("Good luck, have fun!!!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_SYMM:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("Left click to win!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_JUSTGAME:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("It may be a game, but if you don't want to actually try, please go play AI, so that people that actually want to take the game seriously and \"get good\" have a place to do so without trolls like you throwing games.");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_TORB:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("That was positively riveting!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_AIM:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("That aim is absolutely amazing. It's almost like you're a machine!" SS_TAP(X_ENTER));
      wait_ms(3000);
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      SEND_STRING("Wait! That aim is TOO good!  You're clearly using an aim hack! CHEATER!" SS_TAP(X_ENTER));
    }
    return false;
    break;
  case KC_C9:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("OMG!!!  C9!!!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
  case KC_GGEZ:
    if (!record->event.pressed) {
      register_code(is_overwatch ? KC_BSPC : KC_ENTER);
      unregister_code(is_overwatch ? KC_BSPC : KC_ENTER);
      wait_ms(50);
      SEND_STRING("That was a fantastic game, though it was a bit easy. Try harder next time!");
      register_code(KC_ENTER);
      unregister_code(KC_ENTER);
    }
    return false;
    break;
#endif
#ifdef TAP_DANCE_ENABLE
  case KC_DIABLO_CLEAR:  // reset all Diable timers, disabling them
    if (record->event.pressed) {
      uint8_t dtime;

      for (dtime = 0; dtime < 4; dtime++) {
        diablo_key_time[dtime] = diablo_times[0];
      }
    }
    return false;
    break;
#endif
  case KC_MAKE:
    if (!record->event.pressed) {
      SEND_STRING("make " QMK_KEYBOARD ":" QMK_KEYMAP
#if  (defined(BOOTLOADER_DFU) || defined(BOOTLOADER_LUFA_DFU) || defined(BOOTLOADER_QMK_DFU))
       ":dfu"
#elif defined(BOOTLOADER_HALFKAY)
      ":teensy"
//#elif defined(BOOTLOADER_CATERINA)
//       ":avrdude"
#endif
        SS_TAP(X_ENTER));
    }
    return false;
    break;
  case KC_RESET:
    if (!record->event.pressed) {
#ifdef RGBLIGHT_ENABLE
      rgblight_enable();
      rgblight_mode(1);
      rgblight_setrgb(0xff, 0x00, 0x00);
#endif
      reset_keyboard();
    }
    return false;
    break;
  case EPRM:
    if (record->event.pressed) {
      eeconfig_init();
    }
    return false;
    break;
  case VRSN:
    if (record->event.pressed) {
      SEND_STRING(QMK_KEYBOARD "/" QMK_KEYMAP " @ " QMK_VERSION);
    }
    return false;
    break;
  case KC_SECRET_1 ... KC_SECRET_5:
    if (!record->event.pressed) {
      send_string_P(secret[keycode - KC_SECRET_1]);
    }
    return false;
    break;
  case KC_FXCL:
    if (!record->event.pressed) {
      faux_click_enabled = !faux_click_enabled;
    }
    return false;
    break;
  case KC_RGB_T:  // Because I want the option to go back to normal RGB mode rather than always layer indication
#ifdef RGBLIGHT_ENABLE
    if (record->event.pressed) {
      rgb_layer_change = !rgb_layer_change;
    }
#endif
    return false;
    break;
#ifdef RGBLIGHT_ENABLE
  case RGB_MODE_FORWARD ... RGB_MODE_GRADIENT: // quantum_keycodes.h L400 for definitions
    if (record->event.pressed) { //This disrables layer indication, as it's assumed that if you're changing this ... you want that disabled
      rgb_layer_change = false;
    }
    return true;
    break;
#endif
  }
  return process_record_keymap(keycode, record);
}
コード例 #15
0
ファイル: keymap.c プロジェクト: Talljoe/qmk_firmware
bool process_record_user(uint16_t keycode, keyrecord_t *record) {
  if (record->event.pressed) {
    switch(keycode) {
      case NORMAN:
        #ifdef AUDIO_ENABLE
          PLAY_SONG(tone_norman);
        #endif
        persistent_default_layer_set(1UL<<_NORMAN);
        return false;
      case LOWER:
        layer_on(_LOWER);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
        return false;
      case RAISE:
        layer_on(_RAISE);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
        return false;
      case ADJUST:
        layer_on(_ADJUST);
        return false;
      case SH_LOG:  // Open Jira log work window
        SEND_STRING(SS_TAP(X_DOT));
        _delay_ms(100);
        SEND_STRING("log work");
        _delay_ms(100);
        SEND_STRING(SS_TAP(X_ENTER));
        return false;
      case SH_GOUP:  // Go up a directory
        SEND_STRING("cd .."SS_TAP(X_ENTER));
        return false;
      case SH_TERM:  // Open Terminal
        SEND_STRING(SS_LGUI(SS_TAP(X_SPACE)));
        _delay_ms(100);
        SEND_STRING("terminal");
        _delay_ms(100);
        SEND_STRING(SS_TAP(X_ENTER));
        return false;
      case SPOT:  // Open Spotify
        SEND_STRING(SS_LGUI(SS_TAP(X_SPACE)));
        _delay_ms(100);
        SEND_STRING("spotify app");
        _delay_ms(100);
        SEND_STRING(SS_TAP(X_ENTER));
        return false;
      case SLACK:  // Open Slack
        SEND_STRING(SS_LGUI(SS_TAP(X_SPACE)));
        _delay_ms(100);
        SEND_STRING("slack");
        _delay_ms(100);
        SEND_STRING(SS_TAP(X_ENTER));
        return false;
      case OUTLOOK:  // Open MS Outlook
        SEND_STRING(SS_LGUI(SS_TAP(X_SPACE)));
        _delay_ms(100);
        SEND_STRING("outlook");
        _delay_ms(100);
        SEND_STRING(SS_TAP(X_ENTER));
        return false;
      case CHROME:  // Open Chrome
        SEND_STRING(SS_LGUI(SS_TAP(X_SPACE)));
        _delay_ms(100);
        SEND_STRING("chrome");
        _delay_ms(100);
        SEND_STRING(SS_TAP(X_ENTER));
        return false;
    }
  } else {
    switch(keycode) {
      case LOWER:
        layer_off(_LOWER);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
        return false;
      case RAISE:
        layer_off(_RAISE);
        update_tri_layer(_LOWER, _RAISE, _ADJUST);
        return false;
      case ADJUST:
        layer_off(_ADJUST);
        return false;
    }
  }
  return true;
}
コード例 #16
0
ファイル: keymap.c プロジェクト: 0xdec/qmk_firmware
const macro_t *action_get_macro(keyrecord_t *record, uint8_t keycode, uint8_t opt) {
  // These would trigger when you hit a key mapped as M(0)
  if (record->event.pressed) {
    switch(keycode) {
      case 0: // Some custom string here
        SEND_STRING("");
        return false;

      case 1: // Word Select
        SEND_STRING(SS_DOWN(X_LCTRL) SS_TAP(X_RIGHT) SS_DOWN(X_LSHIFT) SS_TAP(X_LEFT) SS_UP(X_LSHIFT) SS_UP(X_LCTRL));
        return false;

      case 2: // Word Select Mac
        SEND_STRING(SS_DOWN(X_LALT) SS_TAP(X_RIGHT) SS_DOWN(X_LSHIFT) SS_TAP(X_LEFT) SS_UP(X_LSHIFT) SS_UP(X_LALT));
        return false;

      case 3: // Line Select
        SEND_STRING(SS_TAP(X_HOME) SS_DOWN(X_LSHIFT) SS_TAP(X_END) SS_UP(X_LSHIFT));
        return false;

      case 4: // Line Select Mac
        SEND_STRING(SS_LCTRL("a") SS_DOWN(X_LSHIFT) SS_LCTRL("e") SS_UP(X_LSHIFT));
        return false;

      case 5: // Line Delete
        SEND_STRING(SS_TAP(X_HOME) SS_DOWN(X_LSHIFT) SS_TAP(X_END) SS_UP(X_LSHIFT));
        SEND_STRING(SS_TAP(X_BSPACE));
        return false;

      case 6: // Line Delete Mac
        SEND_STRING(SS_LCTRL("a") SS_DOWN(X_LSHIFT) SS_LCTRL("e") SS_UP(X_LSHIFT));
        SEND_STRING(SS_TAP(X_BSPACE));
        return false;

      case 7: // Duplicate Selection
        SEND_STRING(SS_LCTRL("c") SS_TAP(X_RIGHT) SS_LCTRL("v"));
        return false;

      case 8: // Duplicate Selection Mac
        SEND_STRING(SS_LGUI("c") SS_TAP(X_RIGHT) SS_LGUI("v"));
        return false;

      case 9: // Join line
        SEND_STRING(SS_TAP(X_END) SS_TAP(X_DELETE));
        return false;

      case 10: // Join line Mac
        SEND_STRING(SS_LCTRL("e") SS_TAP(X_DELETE));
        return false;

      case 98: // Print mode
        SEND_STRING("PC");
        return false;

      case 99: // Print mode
        SEND_STRING("OSX");
        return false;
    }
  }
  return MACRO_NONE;
};