Change app ID to com.outlay.app, add AppStream metadata, fix toast visibility
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
use ksni::menu::StandardItem;
|
||||
use ksni::{Category, ToolTip, Tray, TrayMethods};
|
||||
use std::path::PathBuf;
|
||||
use ksni::{Category, Icon, ToolTip, Tray, TrayMethods};
|
||||
use std::sync::mpsc;
|
||||
|
||||
pub enum TrayCommand {
|
||||
@@ -11,9 +10,11 @@ pub enum TrayCommand {
|
||||
Quit,
|
||||
}
|
||||
|
||||
static TRAY_ICON_32: &[u8] = include_bytes!("../data/icons/tray-icon-32x32.argb");
|
||||
static TRAY_ICON_48: &[u8] = include_bytes!("../data/icons/tray-icon-48x48.argb");
|
||||
|
||||
struct OutlayTray {
|
||||
sender: mpsc::Sender<TrayCommand>,
|
||||
icon_theme_path: String,
|
||||
}
|
||||
|
||||
impl Tray for OutlayTray {
|
||||
@@ -26,11 +27,22 @@ impl Tray for OutlayTray {
|
||||
}
|
||||
|
||||
fn icon_name(&self) -> String {
|
||||
"io.github.outlay".into()
|
||||
String::new()
|
||||
}
|
||||
|
||||
fn icon_theme_path(&self) -> String {
|
||||
self.icon_theme_path.clone()
|
||||
fn icon_pixmap(&self) -> Vec<Icon> {
|
||||
vec![
|
||||
Icon {
|
||||
width: 32,
|
||||
height: 32,
|
||||
data: TRAY_ICON_32.to_vec(),
|
||||
},
|
||||
Icon {
|
||||
width: 48,
|
||||
height: 48,
|
||||
data: TRAY_ICON_48.to_vec(),
|
||||
},
|
||||
]
|
||||
}
|
||||
|
||||
fn category(&self) -> Category {
|
||||
@@ -98,34 +110,8 @@ impl Tray for OutlayTray {
|
||||
}
|
||||
}
|
||||
|
||||
fn find_icon_theme_path() -> String {
|
||||
let exe_path = std::env::current_exe().unwrap_or_default();
|
||||
let exe_dir = exe_path.parent().unwrap_or(std::path::Path::new("."));
|
||||
|
||||
let candidates = [
|
||||
exe_dir.join("../../outlay-gtk/data/icons"),
|
||||
exe_dir.join("../share/icons"),
|
||||
PathBuf::from("/usr/share/icons"),
|
||||
];
|
||||
|
||||
for candidate in &candidates {
|
||||
if candidate.exists() {
|
||||
if let Ok(resolved) = candidate.canonicalize() {
|
||||
return resolved.to_string_lossy().into_owned();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
String::new()
|
||||
}
|
||||
|
||||
pub fn spawn_tray(sender: mpsc::Sender<TrayCommand>) {
|
||||
let icon_theme_path = find_icon_theme_path();
|
||||
|
||||
let tray = OutlayTray {
|
||||
sender,
|
||||
icon_theme_path,
|
||||
};
|
||||
let tray = OutlayTray { sender };
|
||||
|
||||
std::thread::spawn(move || {
|
||||
let rt = tokio::runtime::Builder::new_current_thread()
|
||||
|
||||
Reference in New Issue
Block a user