1
0
Fork 0
forked from wry/wry

config: add fullscreen window criteria

This commit is contained in:
Julian Orth 2025-05-01 18:49:39 +02:00
parent 91c948b219
commit e36ccd560c
14 changed files with 51 additions and 3 deletions

View file

@ -2001,6 +2001,7 @@ impl ConfigProxyHandler {
WindowCriterionIpc::Visible => mgr.visible(),
WindowCriterionIpc::Urgent => mgr.urgent(),
WindowCriterionIpc::SeatFocus(seat) => mgr.seat_focus(&*self.get_seat(*seat)?),
WindowCriterionIpc::Fullscreen => mgr.fullscreen(),
};
let cached = Rc::new(CachedCriterion {
crit: criterion.clone(),

View file

@ -14,6 +14,7 @@ use {
tlm::tlm_matchers::{
tlmm_client::TlmMatchClient,
tlmm_floating::TlmMatchFloating,
tlmm_fullscreen::TlmMatchFullscreen,
tlmm_kind::TlmMatchKind,
tlmm_seat_focus::TlmMatchSeatFocus,
tlmm_string::{TlmMatchAppId, TlmMatchTitle},
@ -47,6 +48,7 @@ bitflags! {
TL_CHANGED_VISIBLE = 1 << 5,
TL_CHANGED_URGENT = 1 << 6,
TL_CHANGED_SEAT_FOCI = 1 << 7,
TL_CHANGED_FULLSCREEN = 1 << 8,
}
type TlmFixedRootMatcher<T> = FixedRootMatcher<ToplevelData, T>;
@ -59,6 +61,7 @@ pub struct TlMatcherManager {
floating: TlmFixedRootMatcher<TlmMatchFloating>,
visible: TlmFixedRootMatcher<TlmMatchVisible>,
urgent: TlmFixedRootMatcher<TlmMatchUrgent>,
fullscreen: TlmFixedRootMatcher<TlmMatchFullscreen>,
matchers: Rc<RootMatchers>,
}
@ -113,6 +116,7 @@ impl TlMatcherManager {
floating: bool!(TlmMatchFloating),
visible: bool!(TlmMatchVisible),
urgent: bool!(TlmMatchUrgent),
fullscreen: bool!(TlmMatchFullscreen),
changes: Default::default(),
leaf_events: Default::default(),
ids: ids.clone(),
@ -187,6 +191,7 @@ impl TlMatcherManager {
fixed_conditional!(TL_CHANGED_FLOATING, floating);
fixed_conditional!(TL_CHANGED_VISIBLE, visible);
fixed_conditional!(TL_CHANGED_URGENT, urgent);
fixed_conditional!(TL_CHANGED_FULLSCREEN, fullscreen);
false
}
@ -257,6 +262,7 @@ impl TlMatcherManager {
fixed_conditional!(TL_CHANGED_FLOATING, floating);
fixed_conditional!(TL_CHANGED_VISIBLE, visible);
fixed_conditional!(TL_CHANGED_URGENT, urgent);
fixed_conditional!(TL_CHANGED_FULLSCREEN, fullscreen);
}
pub fn title(&self, string: CritLiteralOrRegex) -> Rc<TlmUpstreamNode> {
@ -283,6 +289,10 @@ impl TlMatcherManager {
self.visible[true].clone()
}
pub fn fullscreen(&self) -> Rc<TlmUpstreamNode> {
self.fullscreen[true].clone()
}
pub fn urgent(&self) -> Rc<TlmUpstreamNode> {
self.urgent[true].clone()
}

View file

@ -19,6 +19,7 @@ macro_rules! fixed_root_criterion {
pub mod tlmm_client;
pub mod tlmm_floating;
pub mod tlmm_fullscreen;
pub mod tlmm_kind;
pub mod tlmm_seat_focus;
pub mod tlmm_string;

View file

@ -0,0 +1,11 @@
use crate::{criteria::crit_graph::CritFixedRootCriterion, tree::ToplevelData};
pub struct TlmMatchFullscreen(pub bool);
fixed_root_criterion!(TlmMatchFullscreen, fullscreen);
impl CritFixedRootCriterion<ToplevelData> for TlmMatchFullscreen {
fn matches(&self, data: &ToplevelData) -> bool {
data.is_fullscreen.get()
}
}

View file

@ -4,8 +4,9 @@ use {
criteria::{
CritDestroyListener, CritMatcherId,
tlm::{
TL_CHANGED_APP_ID, TL_CHANGED_DESTROYED, TL_CHANGED_FLOATING, TL_CHANGED_NEW,
TL_CHANGED_TITLE, TL_CHANGED_URGENT, TL_CHANGED_VISIBLE, TlMatcherChange,
TL_CHANGED_APP_ID, TL_CHANGED_DESTROYED, TL_CHANGED_FLOATING,
TL_CHANGED_FULLSCREEN, TL_CHANGED_NEW, TL_CHANGED_TITLE, TL_CHANGED_URGENT,
TL_CHANGED_VISIBLE, TlMatcherChange,
},
},
ifs::{
@ -579,6 +580,7 @@ impl ToplevelData {
});
drop(data);
self.is_fullscreen.set(true);
self.property_changed(TL_CHANGED_FULLSCREEN);
node.tl_set_parent(ws.clone());
ws.set_fullscreen_node(&node);
node.clone()
@ -601,6 +603,7 @@ impl ToplevelData {
}
};
self.is_fullscreen.set(false);
self.property_changed(TL_CHANGED_FULLSCREEN);
match fd.workspace.fullscreen.get() {
None => {
log::error!(