config: add content-type window criteria
This commit is contained in:
parent
fb5c50467b
commit
4fd70f03e1
22 changed files with 327 additions and 18 deletions
|
|
@ -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;
|
||||
|
|
|
|||
32
src/criteria/tlm/tlm_matchers/tlmm_content_type.rs
Normal file
32
src/criteria/tlm/tlm_matchers/tlmm_content_type.rs
Normal 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)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue