Skip to content

Commit

Permalink
feat: send quit event if failing to connect
Browse files Browse the repository at this point in the history
  • Loading branch information
wash2 committed Sep 14, 2022
1 parent a161ad4 commit 84eb3e3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions plugins/src/cosmic_toplevel/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub async fn main() {
app.ids_to_ignore
.push(remove_toplevel.toplevel_handle.id().protocol_id());
}
ToplevelEvent::Quit => break,
}
}
_ => break,
Expand Down
5 changes: 3 additions & 2 deletions plugins/src/cosmic_toplevel/wayland.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,10 @@ pub enum ToplevelAction {
pub enum ToplevelEvent {
Add(Toplevel),
Remove(Toplevel),
Quit,
}

pub fn spawn_toplevels(tx: Sender<ToplevelEvent>) -> SyncSender<ToplevelAction> {
pub fn spawn_toplevels(mut tx: Sender<ToplevelEvent>) -> SyncSender<ToplevelAction> {
let (workspaces_tx, workspaces_rx) = calloop::channel::sync_channel(100);

if let Ok(Ok(conn)) = std::env::var("WAYLAND_DISPLAY")
Expand Down Expand Up @@ -126,7 +127,7 @@ pub fn spawn_toplevels(tx: Sender<ToplevelEvent>) -> SyncSender<ToplevelAction>
});
} else {
eprintln!("ENV variable WAYLAND_DISPLAY is missing. Exiting...");
std::process::exit(1);
let _ = futures::executor::block_on(tx.send(ToplevelEvent::Quit));
}

workspaces_tx
Expand Down

0 comments on commit 84eb3e3

Please sign in to comment.