-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add TypeX app icons #27
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,8 @@ use std::{ | |
| use futures::{StreamExt, stream}; | ||
| use rusqlite::Connection; | ||
| use serde::{Deserialize, Serialize}; | ||
| #[cfg(target_os = "macos")] | ||
| use tauri::image::Image; | ||
| use tauri::{ | ||
| Emitter, Manager, WindowEvent, | ||
| menu::{Menu, MenuItem, PredefinedMenuItem}, | ||
|
|
@@ -1203,8 +1205,17 @@ pub fn run() { | |
| let separator = PredefinedMenuItem::separator(app)?; | ||
| let menu = Menu::with_items(app, &[&show_item, &separator, &quit_item])?; | ||
|
|
||
| #[cfg(target_os = "macos")] | ||
| let tray_icon = Image::from_bytes(include_bytes!("../icons/tray-template.png"))?; | ||
| #[cfg(not(target_os = "macos"))] | ||
| let tray_icon = app | ||
| .default_window_icon() | ||
| .cloned() | ||
| .ok_or("default window icon is missing")?; | ||
|
Comment on lines
+1208
to
+1214
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. When running the application directly via #[cfg(target_os = "macos")]
let tray_icon = Image::from_bytes(include_bytes!("../icons/tray-template.png"))?;
#[cfg(not(target_os = "macos"))]
let tray_icon = match app.default_window_icon().cloned() {
Some(icon) => icon,
None => {
tracing::warn!("Default window icon is missing, falling back to embedded icon.png");
Image::from_bytes(include_bytes!("../icons/icon.png"))?
}
}; |
||
|
|
||
| TrayIconBuilder::new() | ||
| .icon(app.default_window_icon().unwrap().clone()) | ||
| .icon(tray_icon) | ||
| .icon_as_template(cfg!(target_os = "macos")) | ||
| .menu(&menu) | ||
| .show_menu_on_left_click(false) | ||
| .tooltip("TypeX") | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Import
Imageunconditionally since it will be used on non-macOS platforms as well for the fallback icon.