1
0
Fork 0
forked from wry/wry

config: add WM_WINDOW_ROLE window criteria

This commit is contained in:
Julian Orth 2025-05-03 14:01:39 +02:00
parent faa0b27ef8
commit 5ad6ca4dd3
14 changed files with 81 additions and 6 deletions

View file

@ -13,12 +13,14 @@ pub type TlmMatchAppId = TlmMatchString<AppIdAccess>;
pub type TlmMatchTag = TlmMatchString<TagAccess>;
pub type TlmMatchClass = TlmMatchString<ClassAccess>;
pub type TlmMatchInstance = TlmMatchString<InstanceAccess>;
pub type TlmMatchRole = TlmMatchString<RoleAccess>;
pub struct TitleAccess;
pub struct AppIdAccess;
pub struct TagAccess;
pub struct ClassAccess;
pub struct InstanceAccess;
pub struct RoleAccess;
impl StringAccess<ToplevelData> for TitleAccess {
fn with_string(data: &ToplevelData, f: impl FnOnce(&str) -> bool) -> bool {
@ -78,3 +80,16 @@ impl StringAccess<ToplevelData> for InstanceAccess {
&roots.instance
}
}
impl StringAccess<ToplevelData> for RoleAccess {
fn with_string(data: &ToplevelData, f: impl FnOnce(&str) -> bool) -> bool {
if let ToplevelType::XWindow(data) = &data.kind {
return f(&data.info.role.borrow().as_deref().unwrap_or_default());
}
false
}
fn nodes(roots: &RootMatchers) -> &TlmRootMatcherMap<TlmMatchString<Self>> {
&roots.role
}
}