1
0
Fork 0
forked from wry/wry

config: add content-type window criteria

This commit is contained in:
Julian Orth 2025-07-17 11:02:32 +02:00
parent fb5c50467b
commit 4fd70f03e1
22 changed files with 327 additions and 18 deletions

View file

@ -18,6 +18,7 @@ macro_rules! fixed_root_criterion {
}
pub mod tlmm_client;
pub mod tlmm_content_type;
pub mod tlmm_floating;
pub mod tlmm_fullscreen;
pub mod tlmm_just_mapped;

View file

@ -0,0 +1,32 @@
use {
crate::{
criteria::{
crit_graph::CritRootCriterion,
tlm::{RootMatchers, TlmRootMatcherMap},
},
ifs::wp_content_type_v1::ContentTypeExt,
tree::ToplevelData,
utils::bitflags::BitflagsExt,
},
jay_config::window::ContentType,
};
pub struct TlmMatchContentType {
kind: ContentType,
}
impl TlmMatchContentType {
pub fn new(kind: ContentType) -> TlmMatchContentType {
Self { kind }
}
}
impl CritRootCriterion<ToplevelData> for TlmMatchContentType {
fn matches(&self, data: &ToplevelData) -> bool {
self.kind.0.contains(data.content_type.get().to_config().0)
}
fn nodes(roots: &RootMatchers) -> Option<&TlmRootMatcherMap<Self>> {
Some(&roots.content_ty)
}
}