pub enum KeyScope {
Global,
Surface(String),
System,
Window(String),
Panel(String),
}Expand description
Where a binding listens. Each window dispatches its own keys and
bubbles outwards: a surface holding the focus, then the window’s
focused panel, then the window, then the whole application
(KeyScope::tier); a binding of a narrower scope wins over one of a
wider scope on the same keys.
Variants§
Global
Any window, whatever has the focus (a text input may keep the key,
see Typing); a modal open in the window blocks it.
Surface(String)
Only while the surface (a focus scope of that name) holds the focus, shown with a focus ring or not.
System
Also while the application does not have the focus: the system
delivers the keys (a global shortcut, registered by a plugin that
reads Keymap::system_bindings). Inside the window it fires as
a KeyScope::Global binding does.
Window(String)
Only in that application window (the context key appWindow:
main for the main window and its detached panels).
Panel(String)
Only while that panel is the focused panel of the window the keys
are pressed in (the context key focusedPanel, which each window
keeps for itself): never from another window.
Implementations§
Source§impl KeyScope
impl KeyScope
pub fn surface(name: &str) -> KeyScope
pub fn window(id: &str) -> KeyScope
pub fn panel(id: &str) -> KeyScope
Sourcepub fn parse(text: &str) -> Result<KeyScope, String>
pub fn parse(text: &str) -> Result<KeyScope, String>
As in files and traces: global, surface:<name>, system,
window:<id>, panel:<id>.
Sourcepub fn infer(when: &When) -> KeyScope
pub fn infer(when: &When) -> KeyScope
The scope a binding declared without one gets, from its clause:
a clause requiring focusedPanel == '<id>' (alone or in a
conjunction) is the panel’s (KeyScope::Panel); any other is
KeyScope::Global. What keymaps written before scopes existed
load as.
Sourcepub fn infer_from(when: &str) -> KeyScope
pub fn infer_from(when: &str) -> KeyScope
KeyScope::infer from a clause’s text; a clause that does not
parse is global.
Sourcepub fn is_global(&self) -> bool
pub fn is_global(&self) -> bool
Whether it listens in every window (global, and system
inside the window).