Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Macro support #1

Merged
merged 22 commits into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
3a83060
Fixed description and updated the either dependency to 1.6
riskable Oct 15, 2020
6e5e068
Added support for Sequence Actions (aka macros) whereby multiple key …
riskable Oct 16, 2020
b56de4f
Added support for Sequence Actions (aka macros) whereby multiple key …
riskable Oct 16, 2020
7df7519
Modified per TeXitoi's instructions (as best I understood them) and a…
riskable Oct 19, 2020
d65daac
Merge branch 'master' of github.com:riskable/keyberon
riskable Oct 19, 2020
6067648
Removed some leftover commented-out cruft
riskable Oct 19, 2020
95650fd
Made some changes to make Clippy happy.
riskable Oct 19, 2020
255c4d3
Unit tests for sequences and improved tick start
riskable Oct 19, 2020
18fb401
Minor fixes to make Clippy happy
riskable Oct 19, 2020
37e6b31
Support for sequences of nearly limitless length!
riskable Oct 20, 2020
b7a77d3
Make Clippy happy
riskable Oct 20, 2020
999b9f2
Changed do_action() to make Clippy happy
riskable Oct 20, 2020
ab0bfe1
Fixed a bug where Delay() wasn't working properly
riskable Oct 20, 2020
0785151
Added the ability to cancel running sequences
riskable Oct 20, 2020
60b08b9
Fixed an edge case with CancelSequence
riskable Oct 20, 2020
0d89989
Added `SequenceEvent::Tap`
riskable Oct 23, 2020
0660d2b
CHANGELOG and more doc for custom actionmagnet:?xt=urn:btih:a6721ad2e…
TeXitoi Dec 11, 2020
f3ad3ff
Merge remote-tracking branch 'upstream/master'
riskable Dec 14, 2020
3fe71e5
Changed how sequences are processed (MUCH simpler).
riskable Dec 15, 2020
43ed3e5
Merge remote-tracking branch 'upstream/master'
riskable May 3, 2021
f93d8ec
Added SequenceEvent back to layout.rs (got removed with last merge of…
riskable May 3, 2021
8c0467d
Merge https://github.com/riskable/keyberon into macros
wezm Sep 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 38 additions & 1 deletion src/action.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,37 @@
//! The different actions that can be done.
//! The different actions that can be executed via any given key.

use crate::key_code::KeyCode;

/// The different types of actions we support for key sequences/macros
#[non_exhaustive]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum SequenceEvent {
/// No operation action: just do nothing (a placeholder).
NoOp,
/// A keypress/keydown
Press(KeyCode),
/// Key release/keyup
Release(KeyCode),
/// A shortcut for `Press(KeyCode), Release(KeyCode)`
Tap(KeyCode),
/// For sequences that need to wait a bit before continuing
Delay {
/// How long (in ticks) this Delay will last
duration: u32, // NOTE: This isn't a u16 because that's only max ~65 seconds (assuming 1000 ticks/sec)
},
/// A marker that indicates there's more of the macro than would fit
/// in the 'sequenced' ArrayDeque
Continue {
/// The current chunk
index: usize,
/// The full list of Sequence Events (that aren't Continue())
events: &'static [SequenceEvent],
},
/// Cancels the running sequence and can be used to mark the end of a sequence
/// instead of using a number of Release() events
Complete,
}

/// Behavior configuration of HoldTap.
#[non_exhaustive]
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
Expand Down Expand Up @@ -89,6 +119,13 @@ where
/// update, set this to 0.
tap_hold_interval: u16,
},
/// A sequence of SequenceEvents
Sequence {
/// An array of SequenceEvents that will be triggered (in order)
events: &'static [SequenceEvent],
},
/// Cancels any running sequences
CancelSequences,
/// Custom action.
///
/// Define a user defined action. This enum can be anything you
Expand Down
Loading