1
0
Fork 0
forked from wry/wry

config: add window-rule infrastructure

This commit is contained in:
Julian Orth 2025-05-01 17:49:21 +02:00
parent a6257910bb
commit 59f8acdfde
26 changed files with 1829 additions and 38 deletions

View file

@ -32,6 +32,7 @@ use {
theme::ThemeParser,
ui_drag::UiDragParser,
vrr::VrrParser,
window_rule::WindowRulesParser,
xwayland::XwaylandParser,
},
spanned::SpannedErrorExt,
@ -121,7 +122,14 @@ impl Parser for ConfigParser<'_> {
ui_drag_val,
xwayland_val,
),
(color_management_val, float_val, actions_val, max_action_depth_val, client_rules_val),
(
color_management_val,
float_val,
actions_val,
max_action_depth_val,
client_rules_val,
window_rules_val,
),
) = ext.extract((
(
opt(val("keymap")),
@ -165,6 +173,7 @@ impl Parser for ConfigParser<'_> {
opt(val("actions")),
recover(opt(int("max-action-depth"))),
opt(val("clients")),
opt(val("windows")),
),
))?;
let mut keymap = None;
@ -428,6 +437,13 @@ impl Parser for ConfigParser<'_> {
Err(e) => log::warn!("Could not parse the client rules: {}", self.0.error(e)),
}
}
let mut window_rules = vec![];
if let Some(value) = window_rules_val {
match value.parse(&mut WindowRulesParser(self.0)) {
Ok(v) => window_rules = v,
Err(e) => log::warn!("Could not parse the window rules: {}", self.0.error(e)),
}
}
Ok(Config {
keymap,
repeat_rate,
@ -463,6 +479,7 @@ impl Parser for ConfigParser<'_> {
named_actions,
max_action_depth,
client_rules,
window_rules,
})
}
}