Skip to content

wayland: implement xdg-toplevel-tag-v1 #434

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ Jay supports the following wayland protocols:
| wp_viewporter | 1 | |
| xdg_activation_v1 | 1 | |
| xdg_toplevel_drag_manager_v1 | 1 | |
| xdg_toplevel_tag_manager_v1 | 1 | |
| xdg_wm_base | 7 | |
| xdg_wm_dialog_v1 | 1 | |
| zwlr_data_control_manager_v1 | 2 | Yes |
Expand Down
1 change: 1 addition & 0 deletions release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Floating windows can now be configured to be shown above fullscreen windows
by using the `enable-float-above-fullscreen` action.
- Implement xdg-toplevel-tag-v1.

# 1.10.0 (2025-04-22)

Expand Down
2 changes: 2 additions & 0 deletions src/globals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ use {
wp_viewporter::WpViewporterGlobal,
xdg_activation_v1::XdgActivationV1Global,
xdg_toplevel_drag_manager_v1::XdgToplevelDragManagerV1Global,
xdg_toplevel_tag_manager_v1::XdgToplevelTagManagerV1Global,
xdg_wm_base::XdgWmBaseGlobal,
xdg_wm_dialog_v1::XdgWmDialogV1Global,
zwlr_layer_shell_v1::ZwlrLayerShellV1Global,
Expand Down Expand Up @@ -221,6 +222,7 @@ impl Globals {
add_singleton!(WlFixesGlobal);
add_singleton!(ExtWorkspaceManagerV1Global);
add_singleton!(WpColorManagerV1Global);
add_singleton!(XdgToplevelTagManagerV1Global);
}

pub fn add_backend_singletons(&self, backend: &Rc<dyn Backend>) {
Expand Down
1 change: 1 addition & 0 deletions src/ifs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pub mod xdg_activation_v1;
pub mod xdg_positioner;
pub mod xdg_toplevel_drag_manager_v1;
pub mod xdg_toplevel_drag_v1;
pub mod xdg_toplevel_tag_manager_v1;
pub mod xdg_wm_base;
pub mod xdg_wm_dialog_v1;
pub mod zwlr_layer_shell_v1;
Expand Down
104 changes: 104 additions & 0 deletions src/ifs/xdg_toplevel_tag_manager_v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
use {
crate::{
client::{Client, ClientError},
globals::{Global, GlobalName},
leaks::Tracker,
object::{Object, Version},
wire::{XdgToplevelTagManagerV1Id, xdg_toplevel_tag_manager_v1::*},
},
std::rc::Rc,
thiserror::Error,
};

pub struct XdgToplevelTagManagerV1Global {
name: GlobalName,
}

impl XdgToplevelTagManagerV1Global {
pub fn new(name: GlobalName) -> Self {
Self { name }
}

fn bind_(
self: Rc<Self>,
id: XdgToplevelTagManagerV1Id,
client: &Rc<Client>,
version: Version,
) -> Result<(), XdgTopleveTagManagerV1Error> {
let obj = Rc::new(XdgToplevelTagManagerV1 {
id,
client: client.clone(),
tracker: Default::default(),
version,
});
track!(client, obj);
client.add_client_obj(&obj)?;
Ok(())
}
}

global_base!(
XdgToplevelTagManagerV1Global,
XdgToplevelTagManagerV1,
XdgTopleveTagManagerV1Error
);

impl Global for XdgToplevelTagManagerV1Global {
fn singleton(&self) -> bool {
true
}

fn version(&self) -> u32 {
1
}
}

simple_add_global!(XdgToplevelTagManagerV1Global);

pub struct XdgToplevelTagManagerV1 {
pub id: XdgToplevelTagManagerV1Id,
pub client: Rc<Client>,
pub tracker: Tracker<Self>,
pub version: Version,
}

impl XdgToplevelTagManagerV1RequestHandler for XdgToplevelTagManagerV1 {
type Error = XdgTopleveTagManagerV1Error;

fn destroy(&self, _req: Destroy, _slf: &Rc<Self>) -> Result<(), Self::Error> {
self.client.remove_obj(self)?;
Ok(())
}

fn set_toplevel_tag(
&self,
_req: SetToplevelTag<'_>,
_slf: &Rc<Self>,
) -> Result<(), Self::Error> {
Ok(())
}

fn set_toplevel_description(
&self,
_req: SetToplevelDescription<'_>,
_slf: &Rc<Self>,
) -> Result<(), Self::Error> {
Ok(())
}
}

object_base! {
self = XdgToplevelTagManagerV1;
version = self.version;
}

impl Object for XdgToplevelTagManagerV1 {}

simple_add_obj!(XdgToplevelTagManagerV1);

#[derive(Debug, Error)]
pub enum XdgTopleveTagManagerV1Error {
#[error(transparent)]
ClientError(Box<ClientError>),
}
efrom!(XdgTopleveTagManagerV1Error, ClientError);
13 changes: 13 additions & 0 deletions wire/xdg_toplevel_tag_manager_v1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
request destroy {

}

request set_toplevel_tag {
toplevel: id(xdg_toplevel),
tag: str,
}

request set_toplevel_description {
toplevel: id(xdg_toplevel),
description: str,
}