#[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 more