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§
Source§impl ModifierKey
impl ModifierKey
Sourcepub const fn hold(layer: u32) -> ModifierKey
pub const fn hold(layer: u32) -> ModifierKey
Create a new ModifierKey that activates the given layer when held.
Sourcepub 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.
Sourcepub 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.
Sourcepub const fn toggle(layer: u32) -> ModifierKey
pub const fn toggle(layer: u32) -> ModifierKey
Create a new ModifierKey that toggles the given layer.
Sourcepub 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.
Sourcepub 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.
Sourcepub 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.
Sourcepub const fn default(layer: u32) -> ModifierKey
pub const fn default(layer: u32) -> ModifierKey
Create a new ModifierKey that sets the default layer.
Sourcepub const fn lock() -> ModifierKey
pub const fn lock() -> ModifierKey
Create a ModifierKey::Lock that targets the highest currently active layer.
Sourcepub const fn lock_layer(layer: u32) -> ModifierKey
pub const fn lock_layer(layer: u32) -> ModifierKey
Create a ModifierKey::Lock that targets a specific 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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ModifierKey
Source§impl Debug for ModifierKey
impl Debug for ModifierKey
Source§impl<'de> Deserialize<'de> for ModifierKey
impl<'de> Deserialize<'de> for ModifierKey
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModifierKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<ModifierKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ModifierKey
impl PartialEq for ModifierKey
Source§fn eq(&self, other: &ModifierKey) -> bool
fn eq(&self, other: &ModifierKey) -> bool
self and other values to be equal, and is used by ==.