Skip to content

Commit

Permalink
chore: more cosmic-comp stuff to new compositor module
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <ryanbrue@gmail.com>
  • Loading branch information
ryanabx committed Aug 11, 2024
1 parent 4a48573 commit d847cc1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
1 change: 0 additions & 1 deletion src/app_tray/mod.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
pub mod cosmic_comp;
pub mod desktop_entry;
30 changes: 18 additions & 12 deletions src/app_tray/cosmic_comp.rs → src/compositor/cosmic_comp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,10 +66,12 @@ impl OutputHandler for WaylandData {
output: cctk::wayland_client::protocol::wl_output::WlOutput,
) {
if let Some(info) = self.output_state.info(&output) {
let _ = self.tx.unbounded_send(WaylandMessage::Output(OutputUpdate::Add(
output.clone(),
info.clone(),
)));
let _ = self
.tx
.unbounded_send(WaylandMessage::Output(OutputUpdate::Add(
output.clone(),
info.clone(),
)));
}
}

Expand All @@ -80,10 +82,12 @@ impl OutputHandler for WaylandData {
output: cctk::wayland_client::protocol::wl_output::WlOutput,
) {
if let Some(info) = self.output_state.info(&output) {
let _ = self.tx.unbounded_send(WaylandMessage::Output(OutputUpdate::Update(
output.clone(),
info.clone(),
)));
let _ = self
.tx
.unbounded_send(WaylandMessage::Output(OutputUpdate::Update(
output.clone(),
info.clone(),
)));
}
}

Expand Down Expand Up @@ -237,10 +241,12 @@ impl ToplevelInfoHandler for WaylandData {
toplevel: &cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1::ZcosmicToplevelHandleV1,
) {
if let Some(info) = self.toplevel_info_state.info(toplevel) {
let _ = self.tx.unbounded_send(WaylandMessage::Toplevel(ToplevelUpdate::Add(
toplevel.clone(),
info.clone(),
)));
let _ = self
.tx
.unbounded_send(WaylandMessage::Toplevel(ToplevelUpdate::Add(
toplevel.clone(),
info.clone(),
)));
} else {
println!("WTF");
}
Expand Down
1 change: 1 addition & 0 deletions src/compositor/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod cosmic_comp;
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use app_tray::cosmic_comp::{WaylandMessage, WaylandRequest};
use cctk::{sctk::reexports::calloop::channel::Sender, wayland_client::protocol::wl_seat::WlSeat};
use compositor::cosmic_comp::{WaylandMessage, WaylandRequest};
use config::PanelConfig;
use iced::{
application::{
Expand All @@ -16,6 +16,7 @@ use iced::{
};

mod app_tray;
mod compositor;
mod config;

fn main() -> Result<(), iced::Error> {
Expand Down Expand Up @@ -123,7 +124,7 @@ impl<'a> Application for Panel<'a> {

fn subscription(&self) -> iced::Subscription<Self::Message> {
Subscription::batch(vec![
app_tray::cosmic_comp::wayland_subscription().map(Message::Wayland),
compositor::cosmic_comp::wayland_subscription().map(Message::Wayland),
listen_with(|e, _, _| match e {
iced::Event::PlatformSpecific(event::PlatformSpecific::Wayland(
event::wayland::Event::Seat(e, seat),
Expand Down

0 comments on commit d847cc1

Please sign in to comment.