Enum ModifierKey
pub enum ModifierKey {
Hold(u32, KeyboardModifiers),
Toggle(u32),
Sticky(u32),
SetActiveLayers(ModifierBitset),
Default(u32),
Lock(LayerLockTarget),
}Expand description
Modifier layer key affects what layers are active.
Variants§
Hold(u32, KeyboardModifiers)
Activates the given layer when held.
Toggle(u32)
Toggles whether the given layer is active when pressed.
Sticky(u32)
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(ModifierBitset)
Sets the set of active layers to the given layers when the key is pressed.
Default(u32)
Sets the default layer.
Lock(LayerLockTarget)
Layer lock key.
Inverts lock on the LayerLockTarget: if unlocked, lock and activate; if locked, unlock and deactivate.
While a layer is locked, releasing a ModifierKey::Hold that activated it leaves the
layer active. Pressing that ModifierKey::Hold again unlocks and turns the layer off.
Implementations§
§impl ModifierKey
impl ModifierKey
pub const fn hold(layer: u32) -> ModifierKey
pub const fn hold(layer: u32) -> ModifierKey
Create a new ModifierKey that activates the given layer when held.
pub const fn with_keyboard_modifiers(
self,
mods: KeyboardModifiers,
) -> ModifierKey
pub const fn with_keyboard_modifiers( self, mods: KeyboardModifiers, ) -> ModifierKey
Adds keyboard modifiers to a Hold modifier key.
pub const fn sticky(layer: u32) -> ModifierKey
pub const fn sticky(layer: u32) -> ModifierKey
Create a new ModifierKey that activates the layer when held, or makes it sticky when tapped.
pub const fn toggle(layer: u32) -> ModifierKey
pub const fn toggle(layer: u32) -> ModifierKey
Create a new ModifierKey that toggles the given layer.
pub const fn set_active_layers(layers: &[u32]) -> ModifierKey
pub const fn set_active_layers(layers: &[u32]) -> ModifierKey
Create a new ModifierKey that sets the active layers to the given slice of layers when pressed.
Each LayerIndex in the slice must be at most MAX_BITSET_LAYER.
pub const fn set_active_layers_from_bitset(bitset: LayerBitset) -> ModifierKey
pub const fn set_active_layers_from_bitset(bitset: LayerBitset) -> ModifierKey
Create a new ModifierKey that sets the active layers bitset.
pub const fn set_active_layers_from_bitset_with_mask(
layers: LayerBitset,
mask: LayerBitset,
) -> ModifierKey
pub const fn set_active_layers_from_bitset_with_mask( layers: LayerBitset, mask: LayerBitset, ) -> ModifierKey
Create a new ModifierKey that sets the active layers bitset.
pub const fn default(layer: u32) -> ModifierKey
pub const fn default(layer: u32) -> ModifierKey
Create a new ModifierKey that sets the default layer.
pub const fn lock() -> ModifierKey
pub const fn lock() -> ModifierKey
Create a ModifierKey::Lock that targets the highest currently active layer.
pub const fn lock_layer(layer: u32) -> ModifierKey
pub const fn lock_layer(layer: u32) -> ModifierKey
Create a ModifierKey::Lock that targets a specific layer.
pub 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§
§impl Clone for ModifierKey
impl Clone for ModifierKey
§fn clone(&self) -> ModifierKey
fn clone(&self) -> ModifierKey
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more