Open njust opened 3 years ago
I've been trying to figure this out for a few hours now and I can't get it to work. After some searching around I found this Reddit thread which suggests that AppIndicator is not loading icons from resources.
I'm planning to move away from AppIndicator anyway in favor of ksni (#2).
Thanks for looking into this. Not sure how to load icons from a gresource file via ksni, but I got a working example where I can load a tray icon which I included into the binary in the example here. Would be nice if the TrayItem::new and TrayItem::set_icon would allow to handle different sources for tray icons like this:
enum IconSource {
Resource(String),
Path(String),
Data(Vec<u8>),
}
pub fn new(title: &str, icon: IconSource) -> Result<Self, TIError>{
..
}
pub fn set_icon(&mut self, icon: IconSource) -> Result<(), TIError> {
..
}
Hi,
I saw in your comment here that icons on linux can be loaded via gresources. I tried but unfortunately it shows only a black box:
I tried to load the icon resource via gio::resources_lookup_data, which is successful. So it seems the resource itself is correctly packed and loaded.
Any idea what's missing? Full example is here: https://github.com/njust/tray_test.