Skip to main content

Module system_keys

Module system_keys 

Source
Expand description

Shortcuts in the system scope: keys bound with BindOptions::system() (KeyScope::System, system in keymap files) also run their command while the application is not focused, when a plugin registers them with the desktop (the platform plugin of egui-pop-platform). Inside the window they fire as global bindings do.

Experimental: may change in any release (docs/stability.md).

Whoever registers them says how it went through the SYSTEM_KEYS service: whether the desktop offers global shortcuts at all (Support), and each binding’s KeyStatus. The shortcuts editor shows it next to each command, so a shortcut that cannot work outside the window says so instead of failing silently; without the service, the editor says nothing registers them.

use egui_pop_api::system_keys::{KeyStatus, Support, SystemKeys};

let keys = SystemKeys::default();
assert_eq!(keys.support(), Support::Unknown);
keys.set_support(Support::Available { backend: "x11".into() });
keys.set_status("Ctrl+Alt+P", KeyStatus::Registered);
assert_eq!(keys.status("Ctrl+Alt+P"), Some(KeyStatus::Registered));

Structs§

SystemKeys
The system shortcuts’ state: shared, written by the registering plugin from any thread, read by the shortcuts editor.

Enums§

KeyStatus
One binding’s registration.
Support
Whether the desktop takes global shortcuts.

Constants§

SYSTEM_KEYS
The system shortcuts’ state, as a service of the plugin registering them.