cli: print content type in tree query
This commit is contained in:
parent
045485e4bc
commit
cc785da980
5 changed files with 35 additions and 7 deletions
|
|
@ -133,6 +133,7 @@ struct Node {
|
||||||
urgent: bool,
|
urgent: bool,
|
||||||
fullscreen: bool,
|
fullscreen: bool,
|
||||||
output: Option<String>,
|
output: Option<String>,
|
||||||
|
content_type: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Query<'_> {
|
impl Query<'_> {
|
||||||
|
|
@ -267,6 +268,10 @@ impl Query<'_> {
|
||||||
last!(d, n);
|
last!(d, n);
|
||||||
n.placeholder_for = Some(event.id.to_string());
|
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 {
|
if args.recursive {
|
||||||
tl.send(SetRecursive {
|
tl.send(SetRecursive {
|
||||||
self_id: id,
|
self_id: id,
|
||||||
|
|
@ -384,6 +389,7 @@ impl Printer {
|
||||||
opt!(title, "title");
|
opt!(title, "title");
|
||||||
opt!(app_id, "app-id");
|
opt!(app_id, "app-id");
|
||||||
opt!(tag, "tag");
|
opt!(tag, "tag");
|
||||||
|
opt!(content_type, "content-type");
|
||||||
opt!(x_class, "x-class");
|
opt!(x_class, "x-class");
|
||||||
opt!(x_instance, "x-instance");
|
opt!(x_instance, "x-instance");
|
||||||
opt!(x_role, "x-role");
|
opt!(x_role, "x-role");
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ impl Global for JayCompositorGlobal {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn version(&self) -> u32 {
|
fn version(&self) -> u32 {
|
||||||
19
|
20
|
||||||
}
|
}
|
||||||
|
|
||||||
fn required_caps(&self) -> ClientCaps {
|
fn required_caps(&self) -> ClientCaps {
|
||||||
|
|
|
||||||
|
|
@ -2,11 +2,14 @@ use {
|
||||||
crate::{
|
crate::{
|
||||||
client::{Client, ClientError},
|
client::{Client, ClientError},
|
||||||
globals::GlobalBase,
|
globals::GlobalBase,
|
||||||
ifs::wl_surface::{
|
ifs::{
|
||||||
ext_session_lock_surface_v1::ExtSessionLockSurfaceV1,
|
wl_surface::{
|
||||||
x_surface::xwindow::Xwindow,
|
ext_session_lock_surface_v1::ExtSessionLockSurfaceV1,
|
||||||
xdg_surface::{xdg_popup::XdgPopup, xdg_toplevel::XdgToplevel},
|
x_surface::xwindow::Xwindow,
|
||||||
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
|
xdg_surface::{xdg_popup::XdgPopup, xdg_toplevel::XdgToplevel},
|
||||||
|
zwlr_layer_surface_v1::ZwlrLayerSurfaceV1,
|
||||||
|
},
|
||||||
|
wp_content_type_v1,
|
||||||
},
|
},
|
||||||
leaks::Tracker,
|
leaks::Tracker,
|
||||||
object::{Object, Version},
|
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_LAYER_SURFACE: u32 = 10;
|
||||||
pub const TREE_TY_LOCK_SURFACE: u32 = 11;
|
pub const TREE_TY_LOCK_SURFACE: u32 = 11;
|
||||||
|
|
||||||
|
const CONTENT_TYPE_SINCE: Version = Version(20);
|
||||||
|
|
||||||
pub struct JayTreeQuery {
|
pub struct JayTreeQuery {
|
||||||
pub id: JayTreeQueryId,
|
pub id: JayTreeQueryId,
|
||||||
pub client: Rc<Client>,
|
pub client: Rc<Client>,
|
||||||
|
|
@ -225,6 +230,19 @@ impl JayTreeQuery {
|
||||||
name: &ws.name,
|
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",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -335,7 +335,7 @@ impl ToolClient {
|
||||||
self_id: s.registry,
|
self_id: s.registry,
|
||||||
name: s.jay_compositor.0,
|
name: s.jay_compositor.0,
|
||||||
interface: JayCompositor.name(),
|
interface: JayCompositor.name(),
|
||||||
version: s.jay_compositor.1.min(19),
|
version: s.jay_compositor.1.min(20),
|
||||||
id: id.into(),
|
id: id.into(),
|
||||||
});
|
});
|
||||||
self.jay_compositor.set(Some(id));
|
self.jay_compositor.set(Some(id));
|
||||||
|
|
|
||||||
|
|
@ -100,3 +100,7 @@ event workspace {
|
||||||
event placeholder_for {
|
event placeholder_for {
|
||||||
id: str,
|
id: str,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
event content_type (since = 20) {
|
||||||
|
ty: str,
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue