config: add comm client criteria
This commit is contained in:
parent
bdabb7bbdd
commit
cc734a135c
12 changed files with 73 additions and 2 deletions
|
|
@ -1882,6 +1882,7 @@ impl ConfigProxyHandler {
|
|||
ClientCriterionStringField::SandboxInstanceId => {
|
||||
mgr.sandbox_instance_id(needle)
|
||||
}
|
||||
ClientCriterionStringField::Comm => mgr.comm(needle),
|
||||
}
|
||||
}
|
||||
ClientCriterionIpc::Sandboxed => mgr.sandboxed(),
|
||||
|
|
|
|||
|
|
@ -11,7 +11,8 @@ use {
|
|||
clmm_pid::ClmMatchPid,
|
||||
clmm_sandboxed::ClmMatchSandboxed,
|
||||
clmm_string::{
|
||||
ClmMatchSandboxAppId, ClmMatchSandboxEngine, ClmMatchSandboxInstanceId,
|
||||
ClmMatchComm, ClmMatchSandboxAppId, ClmMatchSandboxEngine,
|
||||
ClmMatchSandboxInstanceId,
|
||||
},
|
||||
clmm_uid::ClmMatchUid,
|
||||
},
|
||||
|
|
@ -58,6 +59,7 @@ pub struct RootMatchers {
|
|||
sandbox_instance_id: ClmRootMatcherMap<ClmMatchSandboxInstanceId>,
|
||||
uid: ClmRootMatcherMap<ClmMatchUid>,
|
||||
pid: ClmRootMatcherMap<ClmMatchPid>,
|
||||
comm: ClmRootMatcherMap<ClmMatchComm>,
|
||||
}
|
||||
|
||||
pub async fn handle_cl_changes(state: Rc<State>) {
|
||||
|
|
@ -160,6 +162,7 @@ impl ClMatcherManager {
|
|||
unconditional!(sandbox_engine);
|
||||
unconditional!(uid);
|
||||
unconditional!(pid);
|
||||
unconditional!(comm);
|
||||
fixed!(sandboxed);
|
||||
fixed!(is_xwayland);
|
||||
self.constant[true].handle(data);
|
||||
|
|
@ -193,6 +196,10 @@ impl ClMatcherManager {
|
|||
pub fn is_xwayland(&self) -> Rc<ClmUpstreamNode> {
|
||||
self.is_xwayland[true].clone()
|
||||
}
|
||||
|
||||
pub fn comm(&self, string: CritLiteralOrRegex) -> Rc<ClmUpstreamNode> {
|
||||
self.root(ClmMatchComm::new(string))
|
||||
}
|
||||
}
|
||||
|
||||
impl CritTarget for Rc<Client> {
|
||||
|
|
|
|||
|
|
@ -15,8 +15,10 @@ pub type ClmMatchString<T> = CritMatchString<Rc<Client>, T>;
|
|||
pub type ClmMatchSandboxEngine = ClmMatchString<AcceptorMetadataAccess<SandboxEngineField>>;
|
||||
pub type ClmMatchSandboxAppId = ClmMatchString<AcceptorMetadataAccess<SandboxAppIdField>>;
|
||||
pub type ClmMatchSandboxInstanceId = ClmMatchString<AcceptorMetadataAccess<SandboxInstanceIdField>>;
|
||||
pub type ClmMatchComm = ClmMatchString<CommAccess>;
|
||||
|
||||
pub struct AcceptorMetadataAccess<T>(PhantomData<T>);
|
||||
pub struct CommAccess;
|
||||
|
||||
trait SandboxField: Sized + 'static {
|
||||
fn field(meta: &AcceptorMetadata) -> &Option<String>;
|
||||
|
|
@ -77,3 +79,13 @@ impl SandboxField for SandboxInstanceIdField {
|
|||
&roots.sandbox_instance_id
|
||||
}
|
||||
}
|
||||
|
||||
impl StringAccess<Rc<Client>> for CommAccess {
|
||||
fn with_string(data: &Rc<Client>, f: impl FnOnce(&str) -> bool) -> bool {
|
||||
f(&data.pid_info.comm)
|
||||
}
|
||||
|
||||
fn nodes(roots: &RootMatchers) -> &ClmRootMatcherMap<ClmMatchString<Self>> {
|
||||
&roots.comm
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue