pub struct Config {
pub settings: Settings,
pub keys: HashMap<String, KeyBinding>,
}Expand description
Main configuration structure
Provides global settings and per-key bindings for application focus/launch behavior.
§Examples
use open_sesame::Config;
// Load from default XDG paths
let config = Config::load()?;
println!("Activation key: {}", config.settings.activation_key);
// Check key binding for an application
if let Some(key) = config.key_for_app("firefox") {
println!("Firefox is bound to: {}", key);
}
// Get launch command for a key
if let Some(launch) = config.launch_config("g") {
println!("Key 'g' launches: {}", launch.command());
}Fields§
§settings: SettingsGlobal settings
keys: HashMap<String, KeyBinding>Key bindings: letter -> binding config
Implementations§
Source§impl Config
impl Config
Sourcepub fn key_for_app(&self, app_id: &str) -> Option<char>
pub fn key_for_app(&self, app_id: &str) -> Option<char>
Returns the key binding character for an app_id.
Sourcepub fn launch_config(&self, key: &str) -> Option<&LaunchConfig>
pub fn launch_config(&self, key: &str) -> Option<&LaunchConfig>
Returns the launch config for a key.
Sourcepub fn default_toml() -> String
pub fn default_toml() -> String
Generates default TOML configuration string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Config
impl<'de> Deserialize<'de> for Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Config
impl RefUnwindSafe for Config
impl Send for Config
impl Sync for Config
impl Unpin for Config
impl UnwindSafe for Config
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.