feat(config): add win32_exclude_orphan_events option
This commit is contained in:
parent
53eef3ce7b
commit
7eddfd1f12
|
@ -144,6 +144,12 @@ pub trait Config: Send + Sync {
|
||||||
// If false, avoid showing the SecureInput notification on macOS
|
// If false, avoid showing the SecureInput notification on macOS
|
||||||
fn secure_input_notification(&self) -> bool;
|
fn secure_input_notification(&self) -> bool;
|
||||||
|
|
||||||
|
// If true, filter out keyboard events without an explicit HID device source on Windows.
|
||||||
|
// This is needed to filter out the software-generated events, including
|
||||||
|
// those from espanso, but might need to be disabled when using some software-level keyboards.
|
||||||
|
// Disabling this option might conflict with the undo feature.
|
||||||
|
fn win32_exclude_orphan_events(&self) -> bool;
|
||||||
|
|
||||||
fn is_match<'a>(&self, app: &AppProperties<'a>) -> bool;
|
fn is_match<'a>(&self, app: &AppProperties<'a>) -> bool;
|
||||||
|
|
||||||
fn pretty_dump(&self) -> String {
|
fn pretty_dump(&self) -> String {
|
||||||
|
|
|
@ -44,6 +44,7 @@ pub(crate) struct ParsedConfig {
|
||||||
pub show_notifications: Option<bool>,
|
pub show_notifications: Option<bool>,
|
||||||
pub show_icon: Option<bool>,
|
pub show_icon: Option<bool>,
|
||||||
pub secure_input_notification: Option<bool>,
|
pub secure_input_notification: Option<bool>,
|
||||||
|
pub win32_exclude_orphan_events: Option<bool>,
|
||||||
|
|
||||||
pub pre_paste_delay: Option<usize>,
|
pub pre_paste_delay: Option<usize>,
|
||||||
pub restore_clipboard_delay: Option<usize>,
|
pub restore_clipboard_delay: Option<usize>,
|
||||||
|
|
|
@ -103,6 +103,9 @@ pub(crate) struct YAMLConfig {
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub secure_input_notification: Option<bool>,
|
pub secure_input_notification: Option<bool>,
|
||||||
|
|
||||||
|
#[serde(default)]
|
||||||
|
pub win32_exclude_orphan_events: Option<bool>,
|
||||||
|
|
||||||
// Include/Exclude
|
// Include/Exclude
|
||||||
#[serde(default)]
|
#[serde(default)]
|
||||||
pub includes: Option<Vec<String>>,
|
pub includes: Option<Vec<String>>,
|
||||||
|
@ -189,6 +192,8 @@ impl TryFrom<YAMLConfig> for ParsedConfig {
|
||||||
restore_clipboard_delay: yaml_config.restore_clipboard_delay,
|
restore_clipboard_delay: yaml_config.restore_clipboard_delay,
|
||||||
paste_shortcut_event_delay: yaml_config.paste_shortcut_event_delay,
|
paste_shortcut_event_delay: yaml_config.paste_shortcut_event_delay,
|
||||||
|
|
||||||
|
win32_exclude_orphan_events: yaml_config.win32_exclude_orphan_events,
|
||||||
|
|
||||||
use_standard_includes: yaml_config.use_standard_includes,
|
use_standard_includes: yaml_config.use_standard_includes,
|
||||||
includes: yaml_config.includes,
|
includes: yaml_config.includes,
|
||||||
extra_includes: yaml_config.extra_includes,
|
extra_includes: yaml_config.extra_includes,
|
||||||
|
@ -242,6 +247,7 @@ mod tests {
|
||||||
show_icon: false
|
show_icon: false
|
||||||
show_notifications: false
|
show_notifications: false
|
||||||
secure_input_notification: false
|
secure_input_notification: false
|
||||||
|
win32_exclude_orphan_events: false
|
||||||
|
|
||||||
use_standard_includes: true
|
use_standard_includes: true
|
||||||
includes: ["test1"]
|
includes: ["test1"]
|
||||||
|
@ -292,6 +298,7 @@ mod tests {
|
||||||
show_icon: Some(false),
|
show_icon: Some(false),
|
||||||
show_notifications: Some(false),
|
show_notifications: Some(false),
|
||||||
secure_input_notification: Some(false),
|
secure_input_notification: Some(false),
|
||||||
|
win32_exclude_orphan_events: Some(false),
|
||||||
|
|
||||||
pre_paste_delay: Some(300),
|
pre_paste_delay: Some(300),
|
||||||
|
|
||||||
|
|
|
@ -310,6 +310,10 @@ impl Config for ResolvedConfig {
|
||||||
fn secure_input_notification(&self) -> bool {
|
fn secure_input_notification(&self) -> bool {
|
||||||
self.parsed.secure_input_notification.unwrap_or(true)
|
self.parsed.secure_input_notification.unwrap_or(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn win32_exclude_orphan_events(&self) -> bool {
|
||||||
|
self.parsed.win32_exclude_orphan_events.unwrap_or(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ResolvedConfig {
|
impl ResolvedConfig {
|
||||||
|
@ -390,6 +394,7 @@ impl ResolvedConfig {
|
||||||
show_icon,
|
show_icon,
|
||||||
show_notifications,
|
show_notifications,
|
||||||
secure_input_notification,
|
secure_input_notification,
|
||||||
|
win32_exclude_orphan_events,
|
||||||
includes,
|
includes,
|
||||||
excludes,
|
excludes,
|
||||||
extra_includes,
|
extra_includes,
|
||||||
|
|
|
@ -386,6 +386,10 @@ impl Config for LegacyInteropConfig {
|
||||||
fn enable(&self) -> bool {
|
fn enable(&self) -> bool {
|
||||||
self.config.enable_active
|
self.config.enable_active
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn win32_exclude_orphan_events(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct LegacyMatchGroup {
|
struct LegacyMatchGroup {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user