pub enum ModifierKey {
Hold(LayerIndex),
Toggle(LayerIndex),
Sticky(LayerIndex),
SetActiveLayers(LayerBitset),
Default(LayerIndex),
}
Expand description
Modifier layer key affects what layers are active.
Variants§
Hold(LayerIndex)
Activates the given layer when the held.
Toggle(LayerIndex)
Toggles whether the given layer is active when pressed.
Sticky(LayerIndex)
Sticky layer modifier, similar to sticky modifier key.
Acts the same as Hold
variant if interrupted.
If tapped, then the layer is activated for the next key tap.
SetActiveLayers(LayerBitset)
Sets the set of active layers to the given layers when the key is pressed.
Default(LayerIndex)
Sets the default layer.
Implementations§
Source§impl ModifierKey
impl ModifierKey
Sourcepub const fn hold(layer: LayerIndex) -> Self
pub const fn hold(layer: LayerIndex) -> Self
Create a new ModifierKey that activates the given layer when held.
Sourcepub const fn sticky(layer: LayerIndex) -> Self
pub const fn sticky(layer: LayerIndex) -> Self
Create a new ModifierKey that activates the layer when held, or makes it sticky when tapped.
Sourcepub const fn toggle(layer: LayerIndex) -> Self
pub const fn toggle(layer: LayerIndex) -> Self
Create a new ModifierKey that toggles the given layer.
Sourcepub const fn set_active_layers(layers: &[LayerIndex]) -> Self
pub const fn set_active_layers(layers: &[LayerIndex]) -> Self
Create a new ModifierKey that sets the active layers to the given slice of layers when pressed.
Each LayerIndex in the slice must be less than MAX_BITSET_LAYER.
Sourcepub const fn set_active_layers_from_bitset(bitset: LayerBitset) -> Self
pub const fn set_active_layers_from_bitset(bitset: LayerBitset) -> Self
Create a new ModifierKey that sets the active layers bitset.
Sourcepub const fn default(layer: LayerIndex) -> Self
pub const fn default(layer: LayerIndex) -> Self
Create a new ModifierKey that sets the default layer.
Sourcepub fn new_pressed_key(&self) -> (ModifierKeyState, Option<LayerEvent>)
pub fn new_pressed_key(&self) -> (ModifierKeyState, Option<LayerEvent>)
Create a new input::PressedKey and key::ScheduledEvent for the given keymap index.
Pressing a ModifierKey::Hold emits a LayerEvent::Activated event.
Trait Implementations§
Source§impl Clone for ModifierKey
impl Clone for ModifierKey
Source§fn clone(&self) -> ModifierKey
fn clone(&self) -> ModifierKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more