Change app ID to com.outlay.app, add AppStream metadata, fix toast visibility
This commit is contained in:
@@ -1626,8 +1626,7 @@ impl LogView {
|
||||
inner.append(&recent_group);
|
||||
|
||||
clamp.set_child(Some(&inner));
|
||||
toast_overlay.set_child(Some(&clamp));
|
||||
container.append(&toast_overlay);
|
||||
container.append(&clamp);
|
||||
|
||||
LogView {
|
||||
container,
|
||||
|
||||
@@ -28,7 +28,7 @@ use gtk::glib;
|
||||
use outlay_core::db::Database;
|
||||
use std::rc::Rc;
|
||||
|
||||
const APP_ID: &str = "io.github.outlay";
|
||||
const APP_ID: &str = "com.outlay.app";
|
||||
|
||||
fn main() {
|
||||
let app = Application::builder()
|
||||
@@ -100,6 +100,25 @@ fn build_ui(app: &Application) {
|
||||
load_css();
|
||||
icon_theme::setup_themed_icons();
|
||||
|
||||
// Register app icon for the hicolor theme so it works for window + tray
|
||||
{
|
||||
let display = gtk::gdk::Display::default().expect("Could not get display");
|
||||
let theme = gtk::IconTheme::for_display(&display);
|
||||
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"),
|
||||
];
|
||||
for candidate in &candidates {
|
||||
if candidate.exists() {
|
||||
theme.add_search_path(candidate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
gtk::Window::set_default_icon_name("com.outlay.app");
|
||||
|
||||
let data_dir = glib::user_data_dir().join("outlay");
|
||||
std::fs::create_dir_all(&data_dir).expect("Failed to create data directory");
|
||||
let db_path = data_dir.join("outlay.db");
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -88,7 +88,8 @@ impl MainWindow {
|
||||
.hscrollbar_policy(gtk::PolicyType::Never)
|
||||
.child(&log_view.container)
|
||||
.build();
|
||||
content_stack.add_named(&log_scroll, Some("log"));
|
||||
log_view.toast_overlay.set_child(Some(&log_scroll));
|
||||
content_stack.add_named(&log_view.toast_overlay, Some("log"));
|
||||
|
||||
let history_view = HistoryView::new(db.clone());
|
||||
let history_scroll = gtk::ScrolledWindow::builder()
|
||||
|
||||
Reference in New Issue
Block a user