Dispatch the original key on press/release as well

pull/155/head
Takashi Kokubun 2 years ago
parent 4ebce8ee14
commit c38f9e9cc6
No known key found for this signature in database
GPG Key ID: 6FFC433B12EE23DD

@ -161,7 +161,7 @@ modmap:
held: KEY_YYY # Required
alone: KEY_ZZZ # Required
alone_timeout_millis: 1000 # Optional
# Trigger `keymap` action on key press/release events.
# Hook `keymap` action on key press/release events.
KEY_XXX:
press: { launch: ["xdotool", "mousemove", "0", "7200"] } # Required
release: { launch: ["xdotool", "mousemove", "0", "0"] } # Required

@ -198,14 +198,16 @@ impl EventHandler {
vec![(key, value)]
}
KeyAction::PressReleaseKey(PressReleaseKey { press, release }) => {
// Just hook actions, and then emit the original event. We might want to
// support reordering the key event and dispatched actions later.
if value == PRESS {
self.dispatch_actions(&press, &key)?;
}
if value == RELEASE {
self.dispatch_actions(&release, &key)?;
}
// While triggered by modmap, PressReleaseKey is not remapped by keymap.
vec![]
// Dispatch the original key as well
vec![(key, value)]
}
};
Ok(keys)

Loading…
Cancel
Save