config: add urgency window criteria
This commit is contained in:
parent
dcf57db3df
commit
eb172e9d8c
15 changed files with 56 additions and 5 deletions
|
|
@ -1999,6 +1999,7 @@ impl ConfigProxyHandler {
|
|||
}
|
||||
WindowCriterionIpc::Floating => mgr.floating(),
|
||||
WindowCriterionIpc::Visible => mgr.visible(),
|
||||
WindowCriterionIpc::Urgent => mgr.urgent(),
|
||||
};
|
||||
let cached = Rc::new(CachedCriterion {
|
||||
crit: criterion.clone(),
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ use {
|
|||
tlmm_floating::TlmMatchFloating,
|
||||
tlmm_kind::TlmMatchKind,
|
||||
tlmm_string::{TlmMatchAppId, TlmMatchTitle},
|
||||
tlmm_urgent::TlmMatchUrgent,
|
||||
tlmm_visible::TlmMatchVisible,
|
||||
},
|
||||
},
|
||||
|
|
@ -42,6 +43,7 @@ bitflags! {
|
|||
TL_CHANGED_APP_ID = 1 << 3,
|
||||
TL_CHANGED_FLOATING = 1 << 4,
|
||||
TL_CHANGED_VISIBLE = 1 << 5,
|
||||
TL_CHANGED_URGENT = 1 << 6,
|
||||
}
|
||||
|
||||
type TlmFixedRootMatcher<T> = FixedRootMatcher<ToplevelData, T>;
|
||||
|
|
@ -53,6 +55,7 @@ pub struct TlMatcherManager {
|
|||
constant: TlmFixedRootMatcher<CritMatchConstant<ToplevelData>>,
|
||||
floating: TlmFixedRootMatcher<TlmMatchFloating>,
|
||||
visible: TlmFixedRootMatcher<TlmMatchVisible>,
|
||||
urgent: TlmFixedRootMatcher<TlmMatchUrgent>,
|
||||
matchers: Rc<RootMatchers>,
|
||||
}
|
||||
|
||||
|
|
@ -105,6 +108,7 @@ impl TlMatcherManager {
|
|||
constant: CritMatchConstant::create(&matchers, ids),
|
||||
floating: bool!(TlmMatchFloating),
|
||||
visible: bool!(TlmMatchVisible),
|
||||
urgent: bool!(TlmMatchUrgent),
|
||||
changes: Default::default(),
|
||||
leaf_events: Default::default(),
|
||||
ids: ids.clone(),
|
||||
|
|
@ -173,6 +177,7 @@ impl TlMatcherManager {
|
|||
conditional!(TL_CHANGED_APP_ID, app_id);
|
||||
fixed_conditional!(TL_CHANGED_FLOATING, floating);
|
||||
fixed_conditional!(TL_CHANGED_VISIBLE, visible);
|
||||
fixed_conditional!(TL_CHANGED_URGENT, urgent);
|
||||
false
|
||||
}
|
||||
|
||||
|
|
@ -241,6 +246,7 @@ impl TlMatcherManager {
|
|||
conditional!(TL_CHANGED_APP_ID, app_id);
|
||||
fixed_conditional!(TL_CHANGED_FLOATING, floating);
|
||||
fixed_conditional!(TL_CHANGED_VISIBLE, visible);
|
||||
fixed_conditional!(TL_CHANGED_URGENT, urgent);
|
||||
}
|
||||
|
||||
pub fn title(&self, string: CritLiteralOrRegex) -> Rc<TlmUpstreamNode> {
|
||||
|
|
@ -266,6 +272,10 @@ impl TlMatcherManager {
|
|||
pub fn visible(&self) -> Rc<TlmUpstreamNode> {
|
||||
self.visible[true].clone()
|
||||
}
|
||||
|
||||
pub fn urgent(&self) -> Rc<TlmUpstreamNode> {
|
||||
self.urgent[true].clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl CritTarget for ToplevelData {
|
||||
|
|
|
|||
|
|
@ -21,4 +21,5 @@ pub mod tlmm_client;
|
|||
pub mod tlmm_floating;
|
||||
pub mod tlmm_kind;
|
||||
pub mod tlmm_string;
|
||||
pub mod tlmm_urgent;
|
||||
pub mod tlmm_visible;
|
||||
|
|
|
|||
11
src/criteria/tlm/tlm_matchers/tlmm_urgent.rs
Normal file
11
src/criteria/tlm/tlm_matchers/tlmm_urgent.rs
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
use crate::{criteria::crit_graph::CritFixedRootCriterion, tree::ToplevelData};
|
||||
|
||||
pub struct TlmMatchUrgent(pub bool);
|
||||
|
||||
fixed_root_criterion!(TlmMatchUrgent, urgent);
|
||||
|
||||
impl CritFixedRootCriterion<ToplevelData> for TlmMatchUrgent {
|
||||
fn matches(&self, data: &ToplevelData) -> bool {
|
||||
data.wants_attention.get()
|
||||
}
|
||||
}
|
||||
|
|
@ -1152,7 +1152,7 @@ impl ContainerNode {
|
|||
fn mod_attention_requests(&self, set: bool) {
|
||||
let propagate = self.attention_requests.adj(set);
|
||||
if set || propagate {
|
||||
self.toplevel_data.wants_attention.set(set);
|
||||
self.toplevel_data.set_wants_attention(set);
|
||||
}
|
||||
if propagate {
|
||||
if let Some(parent) = self.toplevel_data.parent.get() {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ use {
|
|||
CritDestroyListener, CritMatcherId,
|
||||
tlm::{
|
||||
TL_CHANGED_APP_ID, TL_CHANGED_DESTROYED, TL_CHANGED_FLOATING, TL_CHANGED_NEW,
|
||||
TL_CHANGED_TITLE, TL_CHANGED_VISIBLE, TlMatcherChange,
|
||||
TL_CHANGED_TITLE, TL_CHANGED_URGENT, TL_CHANGED_VISIBLE, TlMatcherChange,
|
||||
},
|
||||
},
|
||||
ifs::{
|
||||
|
|
@ -647,7 +647,7 @@ impl ToplevelData {
|
|||
if !self.requested_attention.replace(false) {
|
||||
return;
|
||||
}
|
||||
self.wants_attention.set(false);
|
||||
self.set_wants_attention(false);
|
||||
if let Some(parent) = self.parent.get() {
|
||||
parent.cnode_child_attention_request_changed(node, false);
|
||||
}
|
||||
|
|
@ -660,12 +660,18 @@ impl ToplevelData {
|
|||
if self.requested_attention.replace(true) {
|
||||
return;
|
||||
}
|
||||
self.wants_attention.set(true);
|
||||
self.set_wants_attention(true);
|
||||
if let Some(parent) = self.parent.get() {
|
||||
parent.cnode_child_attention_request_changed(node, true);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn set_wants_attention(&self, value: bool) {
|
||||
if self.wants_attention.replace(value) != value {
|
||||
self.property_changed(TL_CHANGED_URGENT);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn output(&self) -> Rc<OutputNode> {
|
||||
match self.output_opt() {
|
||||
None => self.state.dummy_output.get().unwrap(),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue