config: add WM_CLASS window criteria
This commit is contained in:
parent
6d3d4dcabb
commit
faa0b27ef8
15 changed files with 159 additions and 10 deletions
|
|
@ -11,10 +11,14 @@ pub type TlmMatchString<T> = CritMatchString<ToplevelData, T>;
|
|||
pub type TlmMatchTitle = TlmMatchString<TitleAccess>;
|
||||
pub type TlmMatchAppId = TlmMatchString<AppIdAccess>;
|
||||
pub type TlmMatchTag = TlmMatchString<TagAccess>;
|
||||
pub type TlmMatchClass = TlmMatchString<ClassAccess>;
|
||||
pub type TlmMatchInstance = TlmMatchString<InstanceAccess>;
|
||||
|
||||
pub struct TitleAccess;
|
||||
pub struct AppIdAccess;
|
||||
pub struct TagAccess;
|
||||
pub struct ClassAccess;
|
||||
pub struct InstanceAccess;
|
||||
|
||||
impl StringAccess<ToplevelData> for TitleAccess {
|
||||
fn with_string(data: &ToplevelData, f: impl FnOnce(&str) -> bool) -> bool {
|
||||
|
|
@ -48,3 +52,29 @@ impl StringAccess<ToplevelData> for TagAccess {
|
|||
&roots.tag
|
||||
}
|
||||
}
|
||||
|
||||
impl StringAccess<ToplevelData> for ClassAccess {
|
||||
fn with_string(data: &ToplevelData, f: impl FnOnce(&str) -> bool) -> bool {
|
||||
if let ToplevelType::XWindow(data) = &data.kind {
|
||||
return f(&data.info.class.borrow().as_deref().unwrap_or_default());
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn nodes(roots: &RootMatchers) -> &TlmRootMatcherMap<TlmMatchString<Self>> {
|
||||
&roots.class
|
||||
}
|
||||
}
|
||||
|
||||
impl StringAccess<ToplevelData> for InstanceAccess {
|
||||
fn with_string(data: &ToplevelData, f: impl FnOnce(&str) -> bool) -> bool {
|
||||
if let ToplevelType::XWindow(data) = &data.kind {
|
||||
return f(&data.info.instance.borrow().as_deref().unwrap_or_default());
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
fn nodes(roots: &RootMatchers) -> &TlmRootMatcherMap<TlmMatchString<Self>> {
|
||||
&roots.instance
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue