1
0
Fork 0
forked from wry/wry

config: add workspace window criteria

This commit is contained in:
Julian Orth 2025-05-03 14:13:40 +02:00
parent 5ad6ca4dd3
commit 51e752992f
13 changed files with 88 additions and 3 deletions

View file

@ -5,6 +5,7 @@ pub(crate) mod string_error;
use {
crate::{
Workspace,
client::ClientMatcher,
input::Seat,
video::Mode,
@ -117,6 +118,7 @@ pub enum WindowCriterionIpc {
SeatFocus(Seat),
Fullscreen,
JustMapped,
Workspace(Workspace),
}
#[derive(Serialize, Deserialize, Clone, Debug, Hash, Eq, PartialEq)]
@ -127,4 +129,5 @@ pub enum WindowCriterionStringField {
XClass,
XInstance,
XRole,
Workspace,
}

View file

@ -1671,6 +1671,9 @@ impl ConfigClient {
WindowCriterion::XInstanceRegex(t) => string!(t, XInstance, true),
WindowCriterion::XRole(t) => string!(t, XRole, false),
WindowCriterion::XRoleRegex(t) => string!(t, XRole, true),
WindowCriterion::Workspace(t) => WindowCriterionIpc::Workspace(t),
WindowCriterion::WorkspaceName(t) => string!(t, Workspace, false),
WindowCriterion::WorkspaceNameRegex(t) => string!(t, Workspace, true),
};
let res = self.send_with_response(&ClientMessage::CreateWindowMatcher { criterion });
get_response!(

View file

@ -276,6 +276,12 @@ pub enum WindowCriterion<'a> {
XRole(&'a str),
/// Matches the X role of the window with a regular expression.
XRoleRegex(&'a str),
/// Matches the workspace the window.
Workspace(Workspace),
/// Matches the workspace name of the window verbatim.
WorkspaceName(&'a str),
/// Matches the workspace name of the window with a regular expression.
WorkspaceNameRegex(&'a str),
}
impl WindowCriterion<'_> {