Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <ryanbrue.dev@gmail.com>
  • Loading branch information
ryanabx committed Aug 31, 2024
1 parent 73f7ee6 commit eec743e
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 49 deletions.
65 changes: 29 additions & 36 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,4 @@ env_logger = "0.11.5"
wayland-client = "0.31.5"
wayland-protocols-wlr = { version = "0.3.3", features = ["client"] }
smithay-client-toolkit = "0.19.2"
wayland-protocols-plasma = { version = "0.3.3", features = ["client"] }
73 changes: 65 additions & 8 deletions src/app_tray/compositor/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ use wayland_client::{
},
Connection, Dispatch, Proxy, QueueHandle,
};
use wayland_protocols_plasma::plasma_window_management::client::{
org_kde_plasma_window, org_kde_plasma_window_management,
};
use wayland_protocols_wlr::foreign_toplevel::v1::client::{
zwlr_foreign_toplevel_handle_v1::{self, ZwlrForeignToplevelHandleV1},
zwlr_foreign_toplevel_manager_v1,
Expand Down Expand Up @@ -409,6 +412,34 @@ impl Dispatch<zcosmic_toplevel_info_v1::ZcosmicToplevelInfoV1, ()> for AppData {
]);
}

// KDE Window Management

impl Dispatch<org_kde_plasma_window::OrgKdePlasmaWindow, ()> for AppData {
fn event(
state: &mut Self,
proxy: &org_kde_plasma_window::OrgKdePlasmaWindow,
event: <org_kde_plasma_window::OrgKdePlasmaWindow as Proxy>::Event,
data: &(),
conn: &Connection,
qhandle: &QueueHandle<Self>,
) {
println!("{:?}", event);
}
}

impl Dispatch<org_kde_plasma_window_management::OrgKdePlasmaWindowManagement, ()> for AppData {
fn event(
state: &mut Self,
proxy: &org_kde_plasma_window_management::OrgKdePlasmaWindowManagement,
event: <org_kde_plasma_window_management::OrgKdePlasmaWindowManagement as Proxy>::Event,
data: &(),
conn: &Connection,
qhandle: &QueueHandle<Self>,
) {
println!("{:?}", event);
}
}

// WL REGISTRY

// You need to provide a Dispatch<WlRegistry, GlobalListContents> impl for your app
Expand Down Expand Up @@ -441,9 +472,37 @@ fn wayland_client_listener(tx: UnboundedSender<WaylandIncoming>, rx: Channel<Way
// And get its handle to associate new objects to it
let qh = event_queue.handle();

// now you can bind the globals you need for your app
let zwlr_toplevel_manager: zwlr_foreign_toplevel_manager_v1::ZwlrForeignToplevelManagerV1 =
globals.bind(&qh, 3..=3, ()).unwrap();
globals.contents().with_list(|list| {
for item in list {
log::info!("{} @ {}", item.interface, item.version);
}
});

// // now you can bind the globals you need for your app
// let zwlr_toplevel_manager = match
// globals.bind::<zwlr_foreign_toplevel_manager_v1::ZwlrForeignToplevelManagerV1, _, _>(&qh, 3..=3, ()) {
// Ok(manager) => Some(manager),
// Err(e) => {
// log::warn!("Wlroots toplevel manager could not be bound: {}", e);
// None
// }
// };

// let zcosmic_toplevel_manager = match globals.bind::<zcosmic_toplevel_info_v1::ZcosmicToplevelInfoV1, _, _>(&qh, 1..=1, ()) {
// Ok(manager) => Some(manager),
// Err(e) => {
// log::warn!("Cosmic toplevel info could not be bound: {}", e);
// None
// }
// };

// let kde_window_manager = match globals.bind::<org_kde_plasma_window_management::OrgKdePlasmaWindowManagement, _, _>(&qh, 15..=16, ()) {
// Ok(manager) => Some(manager),
// Err(e) => {
// log::warn!("KDE window manager could not be bound: {}", e);
// None
// }
// };

// let zwlr_toplevel_handle: zwlr_foreign_toplevel_handle_v1::ZwlrForeignToplevelHandleV1 =
// globals.bind(&qh, 3..=3, ()).unwrap();
Expand Down Expand Up @@ -635,11 +694,9 @@ impl CompositorBackend {
}

for (t_handle, t_info) in self.active_toplevels.get_mut(&info.app_id).unwrap() {
if let c_handle = t_handle {
if &handle == c_handle {
*t_info = info;
break;
}
if &handle == t_handle {
*t_info = info;
break;
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/app_tray/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,9 +260,9 @@ impl<'a> AppTray<'a> {
}

pub fn subscription(&self) -> iced::Subscription<AppTrayMessage> {
iced::Subscription::batch(vec![self
.backend
.wayland_subscription()
.map(AppTrayMessage::WaylandIn)])
// self.backend
// .wayland_subscription()
// .map(AppTrayMessage::WaylandIn)
iced::Subscription::none()
}
}
1 change: 0 additions & 1 deletion src/panel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ pub struct Panel<'a> {
impl<'a> Panel<'a> {
pub fn new(config: PanelConfig) -> (Self, Task<Message>) {
let (id, open) = window::open(window::Settings {
decorations: false,
size: (1280.0, 48.0).into(),
..Default::default()
});
Expand Down

0 comments on commit eec743e

Please sign in to comment.