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

Added support for Sequences (aka macros) #30

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 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…
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
f0e7d65
Merge remote-tracking branch 'upstream/master'
riskable Sep 22, 2021
a26a3b6
Merged upstream
riskable Dec 25, 2021
4604ec7
Added some Sequence test cases
riskable May 2, 2022
2585845
Merge remote-tracking branch 'upstream/master'
riskable May 2, 2022
c990d9d
Fixed Sequence tests to use the new syntax
riskable May 2, 2022
d93436d
Removed unused enum variant and modified to use a const generic va…
riskable May 2, 2022
8e2dfa9
Merged upstream
riskable Oct 4, 2022
883a2d1
Merge remote-tracking branch 'upstream/master' into sequences
riskable Oct 4, 2022
5e67102
Added SequenceEvent back to action.rs
riskable Oct 4, 2022
16be78a
Fixed duplicate HoldTapConfig lines
riskable Oct 4, 2022
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
33 changes: 31 additions & 2 deletions src/action.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,32 @@
//! The different actions that can be done.
//! The different actions that can be executed via any given key.

use crate::key_code::KeyCode;
use crate::layout::{StackedIter, WaitingAction};
use core::fmt::Debug;

/// Behavior configuration of HoldTap.
/// 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)
},
/// Cancels the running sequence and can be used to mark the end of a sequence
/// instead of using a number of Release() events
Complete,
}

/// The different types of actions we support for key sequences/macros
#[non_exhaustive]
#[derive(Clone, Copy)]
pub enum HoldTapConfig {
Expand Down Expand Up @@ -195,6 +217,13 @@ where
DefaultLayer(usize),
/// Perform different actions on key hold/tap (see [`HoldTapAction`]).
HoldTap(&'static HoldTapAction<T>),
/// 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