Menu

Struct

KeyPress

kurogane::KeyPressSource
pub struct KeyPress { /* private fields */ }

A key the user pressed, passed to App::on_key.

Methods

#pub fn key(&self) -> Key

The key.

#pub fn modifiers(&self) -> Modifiers

The modifier keys held with it.

#pub fn character(&self) -> Option<char>

Returns the character the press types. There is none with a modifier that turns it into a control character (Ctrl+W) and none for keys that type nothing (F5, the arrows).

#pub fn in_editable_field(&self) -> bool

Whether the focus is in a field the user types into (an input, a text area, an editable element).

#pub fn repeat(&self) -> bool

Whether the key is held down and this press is its repeat.

#pub fn browser(&self) -> Option<BrowserId>

The browser the key went to.

#pub fn command(&self) -> Option<ChromeCommand>

Returns the command the key runs as one of Kurogane’s shortcuts on any OS. Ctrl+W (Cmd+W on macOS) is Close. Ctrl+R and F5 are Reload. Ctrl+Shift+I (Cmd+Option+I) and F12 are DevTools. macOS’s Cmd+Q quits and names no command. A browser embedded in the application’s own window runs no shortcut and names none.

Trait implementations