From c8709aac45fc390e68d4259ce697f75b5f8b6fe4 Mon Sep 17 00:00:00 2001 From: Thomas Baart Date: Wed, 19 Dec 2018 22:48:24 +0100 Subject: [PATCH] Added One Shot Modifier callback documentation --- docs/feature_advanced_keycodes.md | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/docs/feature_advanced_keycodes.md b/docs/feature_advanced_keycodes.md index bda4972331..0598f329c0 100644 --- a/docs/feature_advanced_keycodes.md +++ b/docs/feature_advanced_keycodes.md @@ -161,6 +161,57 @@ For one shot mods, you need to call `set_oneshot_mods(MOD)` to set it, or `clear !> If you're having issues with OSM translating over Remote Desktop Connection, this can be fixed by opening the settings, going to the "Local Resources" tap, and in the keyboard section, change the drop down to "On this Computer". This will fix the issue and allow OSM to function properly over Remote Desktop. +## Callbacks + +When you'd like to perform custom logic when pressing an `OSM(mod)` key, there are several callbacks you can choose to implement. + +There are callbacks that will be called when one shot modifiers have been set or cleared. These can be inserted into your `.c`: + +```c +void oneshot_mods_set_kb(uint8_t mods) { + oneshot_mods_set_user(mods); +} + +void oneshot_mods_cleared_kb() { + oneshot_mods_cleared_user(); +} +``` + +or `keymap.c`: + +```c +void oneshot_mods_set_user(uint8_t mods) { + print("Oneshot mods have been set!"); +} + +void oneshot_mods_cleared_user(void) { + print("Oneshot mods have been cleared!") +} +``` + +There are also callbacks that will be called when one shot modifiers have been locked. They will only be called when `ONESHOT_TAP_TOGGLE` is defined. The callbacks can be inserted into your `.c`: + +```c +void oneshot_locked_mods_set_kb(uint8_t mods) { + oneshot_locked_mods_set_user(mods); +} + +void oneshot_locked_mods_cleared_kb(void) { + oneshot_locked_mods_cleared_user(); +} +``` + +or `keymap.c`: + +```c +void oneshot_locked_mods_set_user(uint8_t mods) { + print("Oneshot mods have been locked!"); +} +void oneshot_locked_mods_cleared_user(void) { + print("Oneshot mods have been cleared!"); +} +``` + # Tap-Hold Configuration Options While Tap-Hold options are fantastic, they are not without their issues. We have tried to configure them with reasonal defaults, but that may still cause issues for some people.