1
0
Fork 0
forked from wry/wry

config: add floating window criteria

This commit is contained in:
Julian Orth 2025-05-01 18:31:59 +02:00
parent da64166e82
commit 8bb8b2a649
14 changed files with 78 additions and 14 deletions

View file

@ -259,6 +259,7 @@ pub struct WindowMatch {
pub title_regex: Option<String>,
pub app_id: Option<String>,
pub app_id_regex: Option<String>,
pub floating: Option<bool>,
}
#[derive(Debug, Clone)]

View file

@ -3,7 +3,7 @@ use {
config::{
GenericMatch, MatchExactly, WindowMatch,
context::Context,
extractor::{Extractor, ExtractorError, arr, n32, opt, str, val},
extractor::{Extractor, ExtractorError, arr, bol, n32, opt, str, val},
parser::{DataType, ParseResult, Parser, UnexpectedDataType},
parsers::{
client_match::{ClientMatchParser, ClientMatchParserError},
@ -56,7 +56,7 @@ impl Parser for WindowMatchParser<'_> {
title,
title_regex,
),
(app_id, app_id_regex),
(app_id, app_id_regex, floating),
) = ext.extract((
(
opt(str("name")),
@ -69,7 +69,11 @@ impl Parser for WindowMatchParser<'_> {
opt(str("title")),
opt(str("title-regex")),
),
(opt(str("app-id")), opt(str("app-id-regex"))),
(
opt(str("app-id")),
opt(str("app-id-regex")),
opt(bol("floating")),
),
))?;
let mut not = None;
if let Some(value) = not_val {
@ -114,6 +118,7 @@ impl Parser for WindowMatchParser<'_> {
title_regex: title_regex.despan_into(),
app_id: app_id.despan_into(),
app_id_regex: app_id_regex.despan_into(),
floating: floating.despan(),
types,
client,
})

View file

@ -231,7 +231,6 @@ impl Rule for WindowRule {
}
};
}
#[expect(unused_macros)]
macro_rules! bool {
($ty:ident, $field:ident) => {
if let Some(value) = &match_.$field {
@ -259,6 +258,7 @@ impl Rule for WindowRule {
value!(TitleRegex, title_regex);
value!(AppId, app_id);
value!(AppIdRegex, app_id_regex);
bool!(Floating, floating);
Some(())
}