config: add xwayland client criteria
This commit is contained in:
parent
a952e658da
commit
bdabb7bbdd
13 changed files with 47 additions and 1 deletions
|
|
@ -1887,6 +1887,7 @@ impl ConfigProxyHandler {
|
|||
ClientCriterionIpc::Sandboxed => mgr.sandboxed(),
|
||||
ClientCriterionIpc::Uid(p) => mgr.uid(*p),
|
||||
ClientCriterionIpc::Pid(p) => mgr.pid(*p),
|
||||
ClientCriterionIpc::IsXwayland => mgr.is_xwayland(),
|
||||
};
|
||||
let cached = Rc::new(CachedCriterion {
|
||||
crit: criterion.clone(),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ use {
|
|||
CritDestroyListener, CritLiteralOrRegex, CritMatcherId, CritMatcherIds, CritMgrExt,
|
||||
CritUpstreamNode, FixedRootMatcher, RootMatcherMap,
|
||||
clm::clm_matchers::{
|
||||
clmm_is_xwayland::ClmMatchIsXwayland,
|
||||
clmm_pid::ClmMatchPid,
|
||||
clmm_sandboxed::ClmMatchSandboxed,
|
||||
clmm_string::{
|
||||
|
|
@ -44,6 +45,7 @@ pub struct ClMatcherManager {
|
|||
leaf_events: Rc<AsyncQueue<CritLeafEvent<Rc<Client>>>>,
|
||||
constant: ClmFixedRootMatcher<CritMatchConstant<Rc<Client>>>,
|
||||
sandboxed: ClmFixedRootMatcher<ClmMatchSandboxed>,
|
||||
is_xwayland: ClmFixedRootMatcher<ClmMatchIsXwayland>,
|
||||
matchers: Rc<RootMatchers>,
|
||||
}
|
||||
|
||||
|
|
@ -96,6 +98,7 @@ impl ClMatcherManager {
|
|||
Self {
|
||||
constant: CritMatchConstant::create(&matchers, ids),
|
||||
sandboxed: bool!(ClmMatchSandboxed),
|
||||
is_xwayland: bool!(ClmMatchIsXwayland),
|
||||
changes: Default::default(),
|
||||
leaf_events: Default::default(),
|
||||
ids: ids.clone(),
|
||||
|
|
@ -158,6 +161,7 @@ impl ClMatcherManager {
|
|||
unconditional!(uid);
|
||||
unconditional!(pid);
|
||||
fixed!(sandboxed);
|
||||
fixed!(is_xwayland);
|
||||
self.constant[true].handle(data);
|
||||
}
|
||||
}
|
||||
|
|
@ -185,6 +189,10 @@ impl ClMatcherManager {
|
|||
pub fn pid(&self, pid: i32) -> Rc<ClmUpstreamNode> {
|
||||
self.root(ClmMatchPid(pid as _))
|
||||
}
|
||||
|
||||
pub fn is_xwayland(&self) -> Rc<ClmUpstreamNode> {
|
||||
self.is_xwayland[true].clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl CritTarget for Rc<Client> {
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ macro_rules! fixed_root_criterion {
|
|||
};
|
||||
}
|
||||
|
||||
pub mod clmm_is_xwayland;
|
||||
pub mod clmm_pid;
|
||||
pub mod clmm_sandboxed;
|
||||
pub mod clmm_string;
|
||||
|
|
|
|||
14
src/criteria/clm/clm_matchers/clmm_is_xwayland.rs
Normal file
14
src/criteria/clm/clm_matchers/clmm_is_xwayland.rs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
use {
|
||||
crate::{client::Client, criteria::crit_graph::CritFixedRootCriterion},
|
||||
std::rc::Rc,
|
||||
};
|
||||
|
||||
pub struct ClmMatchIsXwayland(pub bool);
|
||||
|
||||
fixed_root_criterion!(ClmMatchIsXwayland, is_xwayland);
|
||||
|
||||
impl CritFixedRootCriterion<Rc<Client>> for ClmMatchIsXwayland {
|
||||
fn matches(&self, data: &Rc<Client>) -> bool {
|
||||
data.is_xwayland
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue