MCPcopy Create free account
hub / github.com/TyberiusPrime/KeyToKey / space_cadet_handler

Function space_cadet_handler

src/premade.rs:227–233  ·  view source on GitHub ↗

A space cadet (pass through on tap, on/off on pressed+other keys) that turns a handler on/off. Note that this needs to be before the handler it toggles in the handler order, so you need to use keyboard.add_handler(space_cadet_handler(trigger, keyboard.future_handler_id(2))); keyboard.add_handler(Box::new(Layer(...)))

(
    trigger: impl AcceptsKeycode,
    action: KeyCode,
    id: HandlerID,
)

Source from the content-addressed store, hash-verified

225/// keyboard.add_handler(Box::new(Layer(...)))
226///
227pub fn space_cadet_handler(
228 trigger: impl AcceptsKeycode,
229 action: KeyCode,
230 id: HandlerID,
231) -> Box<SpaceCadet<KeyCode, ActionHandler>> {
232 Box::new(SpaceCadet::new(trigger, action, ActionHandler { id }))
233}
234/// Handler for turing Copy/Paste/Cut Keycodes into 'universal'
235/// Ctrl-Insert, Shift-insert, shift-delete keystrokes
236/// for dedicated copy paste keys

Callers 1

test_space_cadet_layerFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_space_cadet_layerFunction · 0.68