fix tray
This commit is contained in:
17
src/main.rs
17
src/main.rs
@@ -7,9 +7,7 @@ mod state;
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
use std::sync::Arc;
|
||||
|
||||
#[cfg(unix)]
|
||||
use tray_item::IconSource;
|
||||
use tray_item::TrayItem;
|
||||
use tray_item::{IconSource, TrayItem};
|
||||
|
||||
fn main() {
|
||||
let rt = tokio::runtime::Runtime::new().unwrap();
|
||||
@@ -74,7 +72,18 @@ fn main() {
|
||||
});
|
||||
|
||||
// Create the tray application
|
||||
let mut tray = TrayItem::new("Ambiligth", IconSource::Resource("")).unwrap();
|
||||
// On Linux: empty string works as a default/no icon
|
||||
// On Windows: use IconSource::Data with a 1x1 transparent icon
|
||||
#[cfg(unix)]
|
||||
let icon_source = IconSource::Resource("");
|
||||
#[cfg(windows)]
|
||||
let icon_source = IconSource::Data {
|
||||
rgba: &[0, 0, 0, 0], // 1x1 transparent black pixel
|
||||
width: 1,
|
||||
height: 1,
|
||||
};
|
||||
|
||||
let mut tray = TrayItem::new("Ambiligth", icon_source).unwrap();
|
||||
|
||||
let is_running_toggle = is_running.clone();
|
||||
let restore_on_toggle = settings_arc.restore_on_exit;
|
||||
|
||||
Reference in New Issue
Block a user