1
0
Fork 0
forked from wry/wry

config: add content-type window criteria

This commit is contained in:
Julian Orth 2025-07-17 11:02:32 +02:00
parent fb5c50467b
commit 4fd70f03e1
22 changed files with 327 additions and 18 deletions

View file

@ -32,7 +32,10 @@ use {
Transform, VrrMode,
connector_type::{CON_UNKNOWN, ConnectorType},
},
window::{MatchedWindow, TileState, Window, WindowCriterion, WindowMatcher, WindowType},
window::{
ContentType, MatchedWindow, TileState, Window, WindowCriterion, WindowMatcher,
WindowType,
},
xwayland::XScalingMode,
},
bincode::Options,
@ -413,6 +416,12 @@ impl ConfigClient {
kind
}
pub fn content_type(&self, window: Window) -> ContentType {
let res = self.send_with_response(&ClientMessage::GetContentType { window });
get_response!(res, ContentType(0), GetContentType { kind });
kind
}
pub fn window_id(&self, window: Window) -> String {
let res = self.send_with_response(&ClientMessage::GetWindowId { window });
get_response!(res, String::new(), GetWindowId { id });
@ -1682,6 +1691,7 @@ impl ConfigClient {
WindowCriterion::Workspace(t) => WindowCriterionIpc::Workspace(t),
WindowCriterion::WorkspaceName(t) => string!(t, Workspace, false),
WindowCriterion::WorkspaceNameRegex(t) => string!(t, Workspace, true),
WindowCriterion::ContentTypes(t) => WindowCriterionIpc::ContentTypes(t),
};
let res = self.send_with_response(&ClientMessage::CreateWindowMatcher { criterion });
get_response!(

View file

@ -15,7 +15,7 @@ use {
ColorSpace, Connector, DrmDevice, Format, GfxApi, TearingMode, TransferFunction,
Transform, VrrMode, connector_type::ConnectorType,
},
window::{TileState, Window, WindowMatcher, WindowType},
window::{ContentType, TileState, Window, WindowMatcher, WindowType},
xwayland::XScalingMode,
},
serde::{Deserialize, Serialize},
@ -718,6 +718,9 @@ pub enum ClientMessage<'a> {
device: InputDevice,
enabled: bool,
},
GetContentType {
window: Window,
},
}
#[derive(Serialize, Deserialize, Debug)]
@ -944,6 +947,9 @@ pub enum Response {
CreateWindowMatcher {
matcher: WindowMatcher,
},
GetContentType {
kind: ContentType,
},
}
#[derive(Serialize, Deserialize, Debug)]