#[non_exhaustive]pub enum ModifierKey {
Show 14 variants
LeftShift,
LeftCtrl,
LeftAlt,
LeftSuper,
RightShift,
RightCtrl,
RightAlt,
RightSuper,
LeftHyper,
LeftMeta,
RightHyper,
RightMeta,
IsoLevel3Shift,
IsoLevel5Shift,
}Expand description
A modifier key reported on its own (no character), e.g. a bare Ctrl press.
Mirrors crossterm’s ModifierKeyCode with SLT naming. Only delivered when
the Kitty keyboard protocol is active and
RunConfig::report_all_keys(true) was
set, on a supporting terminal (kitty, Ghostty, WezTerm). Most terminals
never emit these.
Useful for vi-style leader/chord overlays (“Ctrl is being held”) and hold-to-repeat affordances keyed off a modifier-down → modifier-up window.
Since 0.21.0.
§Example
use slt::{KeyCode, ModifierKey, RunConfig};
// `report_all_keys` only has an effect with `kitty_keyboard` enabled.
let cfg = RunConfig::default().kitty_keyboard(true).report_all_keys(true);
slt::run_with(cfg, |ui| {
if ui.key_code(KeyCode::Modifier(ModifierKey::LeftCtrl)) {
ui.text("Left Ctrl is down");
}
})
.unwrap();Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
LeftShift
Left Shift key.
LeftCtrl
Left Control key.
LeftAlt
Left Alt / Option key.
LeftSuper
Left Super key (Cmd on macOS, Win on Windows).
RightShift
Right Shift key.
RightCtrl
Right Control key.
RightAlt
Right Alt / Option key.
RightSuper
Right Super key (Cmd on macOS, Win on Windows).
LeftHyper
Left Hyper key.
LeftMeta
Left Meta key.
RightHyper
Right Hyper key.
RightMeta
Right Meta key.
IsoLevel3Shift
ISO Level 3 Shift key (AltGr).
IsoLevel5Shift
ISO Level 5 Shift key.
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 moreSource§impl Debug for ModifierKey
impl Debug for ModifierKey
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 ==.impl Copy for ModifierKey
impl Eq for ModifierKey
impl StructuralPartialEq for ModifierKey
Auto Trait Implementations§
impl Freeze for ModifierKey
impl RefUnwindSafe for ModifierKey
impl Send for ModifierKey
impl Sync for ModifierKey
impl Unpin for ModifierKey
impl UnsafeUnpin for ModifierKey
impl UnwindSafe for ModifierKey
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.