1
0
Fork 0
forked from wry/wry

cli: print content type in tree query

This commit is contained in:
Julian Orth 2025-07-21 23:45:10 +02:00
parent 045485e4bc
commit cc785da980
5 changed files with 35 additions and 7 deletions

View file

@ -133,6 +133,7 @@ struct Node {
urgent: bool,
fullscreen: bool,
output: Option<String>,
content_type: Option<String>,
}
impl Query<'_> {
@ -267,6 +268,10 @@ impl Query<'_> {
last!(d, n);
n.placeholder_for = Some(event.id.to_string());
});
ContentType::handle(tl, id, d.clone(), |d, event| {
last!(d, n);
n.content_type = Some(event.ty.to_string());
});
if args.recursive {
tl.send(SetRecursive {
self_id: id,
@ -384,6 +389,7 @@ impl Printer {
opt!(title, "title");
opt!(app_id, "app-id");
opt!(tag, "tag");
opt!(content_type, "content-type");
opt!(x_class, "x-class");
opt!(x_instance, "x-instance");
opt!(x_role, "x-role");

View file

@ -79,7 +79,7 @@ impl Global for JayCompositorGlobal {
}
fn version(&self) -> u32 {
19
20
}
fn required_caps(&self) -> ClientCaps {

View file

@ -2,11 +2,14 @@ use {
crate::{
client::{Client, ClientError},
globals::GlobalBase,
ifs::wl_surface::{
ext_session_lock_surface_v1::ExtSessionLockSurfaceV1,
x_surface::xwindow::Xwindow,
xdg_surface::{xdg_popup::XdgPopup, xdg_toplevel::XdgToplevel},
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
ifs::{
wl_surface::{
ext_session_lock_surface_v1::ExtSessionLockSurfaceV1,
x_surface::xwindow::Xwindow,
xdg_surface::{xdg_popup::XdgPopup, xdg_toplevel::XdgToplevel},
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
},
wp_content_type_v1,
},
leaks::Tracker,
object::{Object, Version},
@ -40,6 +43,8 @@ pub const TREE_TY_XDG_POPUP: u32 = 9;
pub const TREE_TY_LAYER_SURFACE: u32 = 10;
pub const TREE_TY_LOCK_SURFACE: u32 = 11;
const CONTENT_TYPE_SINCE: Version = Version(20);
pub struct JayTreeQuery {
pub id: JayTreeQueryId,
pub client: Rc<Client>,
@ -225,6 +230,19 @@ impl JayTreeQuery {
name: &ws.name,
});
}
if self.version >= CONTENT_TYPE_SINCE
&& let Some(ct) = data.content_type.get()
{
use wp_content_type_v1::ContentType::*;
self.client.event(ContentType {
self_id: self.id,
ty: match ct {
Photo => "photo",
Video => "video",
Game => "game",
},
});
}
}
}

View file

@ -335,7 +335,7 @@ impl ToolClient {
self_id: s.registry,
name: s.jay_compositor.0,
interface: JayCompositor.name(),
version: s.jay_compositor.1.min(19),
version: s.jay_compositor.1.min(20),
id: id.into(),
});
self.jay_compositor.set(Some(id));