Skip to content
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

Store tray icon so it doesn't disappear #285

Merged
merged 1 commit into from
Aug 10, 2024
Merged
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
8 changes: 6 additions & 2 deletions src/frontend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::frontend::new_version::NewVersion;
use crate::frontend::running::{RunningInit, RunningInput, RunningOutput, RunningView};
use crate::frontend::translations::{AsDefaultStr, T};
use crate::AppStatusCode;
use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIconBuilder};
use betrayer::{Icon, Menu, MenuItem, TrayEvent, TrayIcon, TrayIconBuilder};
use futures::channel::mpsc;
use futures::{SinkExt, StreamExt};
use gtk::prelude::*;
Expand Down Expand Up @@ -203,6 +203,9 @@ pub struct App {
loaded: bool,
#[do_not_track]
backend_fut: Option<Box<dyn Future<Output = ()> + Send>>,
// Keep it around so it doesn't disappear
#[do_not_track]
_tray_icon: Option<TrayIcon<TrayMenuSignal>>,
}

#[relm4::component(pub async)]
Expand Down Expand Up @@ -592,8 +595,9 @@ impl AsyncComponent for App {
app_data_dir,
exit_status_code,
loaded: false,
tracker: u8::MAX,
backend_fut: Some(backend_fut),
_tray_icon: tray_icon,
tracker: u8::MAX,
};

let widgets = view_output!();
Expand Down
Loading