Skip to content

feat: add TypeX app icons#27

Merged
LRainner merged 1 commit into
masterfrom
feat/app-icons
Jun 23, 2026
Merged

feat: add TypeX app icons#27
LRainner merged 1 commit into
masterfrom
feat/app-icons

Conversation

@LRainner

Copy link
Copy Markdown
Owner

Summary

  • Replace the placeholder desktop app icon with the generated TypeX icon.
  • Add a macOS template tray icon and use the default app icon for non-macOS trays.

🤖 Generated with Claude Code

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds support for a macOS-specific tray icon template by enabling the image-png feature in Tauri and conditionally loading a template image. The review feedback suggests using conditional compilation attributes (#[cfg(...)]) instead of runtime cfg! checks to prevent embedding the macOS icon in non-macOS binaries and to safely handle potential panics when retrieving the default window icon.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread apps/desktop/src/lib.rs Outdated
Comment on lines +1207 to +1211
let tray_icon = if cfg!(target_os = "macos") {
Image::from_bytes(include_bytes!("../icons/tray-template.png"))?
} else {
app.default_window_icon().unwrap().clone()
};

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Using cfg!(target_os = "macos") inside a runtime if expression means both branches are compiled on all platforms. This causes include_bytes!("../icons/tray-template.png") to embed the macOS tray icon into Windows and Linux binaries, unnecessarily increasing their size. Additionally, calling .unwrap() on default_window_icon() can cause a runtime panic if the icon is missing.

Using conditional compilation attributes (#[cfg(...)]) resolves both issues by only compiling the relevant branch and safely handling the missing icon case.

Suggested change
let tray_icon = if cfg!(target_os = "macos") {
Image::from_bytes(include_bytes!("../icons/tray-template.png"))?
} else {
app.default_window_icon().unwrap().clone()
};
#[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")?;

Replace the placeholder desktop icon, add a macOS template tray icon, tune icon sizing, and use the default app icon for non-macOS trays.

Co-Authored-By: Claude <noreply@anthropic.com>
@LRainner

Copy link
Copy Markdown
Owner Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request configures a platform-specific tray icon for macOS using a template image, while falling back to the default window icon on other platforms. It also updates the Tauri configuration and Cargo dependencies to support PNG images. The review feedback suggests importing Image unconditionally and adding a fallback to an embedded icon.png on non-macOS platforms to prevent application startup failures when running directly via cargo run.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread apps/desktop/src/lib.rs
Comment on lines +13 to +14
#[cfg(target_os = "macos")]
use tauri::image::Image;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Import Image unconditionally since it will be used on non-macOS platforms as well for the fallback icon.

Suggested change
#[cfg(target_os = "macos")]
use tauri::image::Image;
use tauri::image::Image;

Comment thread apps/desktop/src/lib.rs
Comment on lines +1208 to +1214
#[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")?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

When running the application directly via cargo run (instead of cargo tauri dev or tauri build), app.default_window_icon() can return None because the resources are not packaged. This causes the application to fail to start. Adding a fallback to the embedded icon.png improves the developer experience and application robustness.

            #[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"))?
                }
            };

@LRainner LRainner merged commit 5a905b8 into master Jun 23, 2026
7 checks passed
@LRainner LRainner deleted the feat/app-icons branch June 23, 2026 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant