Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified apps/desktop/src-tauri/icons/tray-default-icon-instant.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/desktop/src-tauri/icons/tray-default-icon-screenshot.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/desktop/src-tauri/icons/tray-default-icon-studio.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified apps/desktop/src-tauri/icons/tray-stop-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions apps/desktop/src-tauri/src/tray.rs
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,12 @@ pub fn get_mode_icon(mode: RecordingMode) -> &'static [u8] {
}
}

fn set_tray_template_icon(tray: &tauri::tray::TrayIcon, icon: Image<'_>) {
Comment thread
gupsammy marked this conversation as resolved.
let _ = tray.set_icon(Some(icon));
#[cfg(target_os = "macos")]
let _ = tray.set_icon_as_template(true);
}
Comment thread
gupsammy marked this conversation as resolved.

pub fn update_tray_icon_for_mode(app: &AppHandle, mode: RecordingMode) {
if cfg!(target_os = "windows") {
return;
Expand All @@ -626,7 +632,7 @@ pub fn update_tray_icon_for_mode(app: &AppHandle, mode: RecordingMode) {
};

if let Ok(icon) = Image::from_bytes(get_mode_icon(mode)) {
let _ = tray.set_icon(Some(icon));
set_tray_template_icon(&tray, icon);
}
}

Expand Down Expand Up @@ -660,6 +666,7 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {

let _ = TrayIconBuilder::with_id("tray")
.icon(initial_icon)
.icon_as_template(true)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.icon_as_template(true) is now unconditional. The previous code used cfg!(target_os = "macos") to conditionally apply this only on macOS. While this doesn't cause runtime issues (the method exists on all platforms), using an unconditional true is slightly less clear than the previous version. Consider keeping the cfg! macro for clarity.

Previous:

Suggested change
.icon_as_template(true)
.icon_as_template(cfg!(target_os = "macos"))

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Prompt To Fix With AI
This is a comment left during a code review.
Path: apps/desktop/src-tauri/src/tray.rs
Line: 669:669

Comment:
`.icon_as_template(true)` is now unconditional. The previous code used `cfg!(target_os = "macos")` to conditionally apply this only on macOS. While this doesn't cause runtime issues (the method exists on all platforms), using an unconditional `true` is slightly less clear than the previous version. Consider keeping the `cfg!` macro for clarity.

Previous:
```suggestion
        .icon_as_template(cfg!(target_os = "macos"))
```

<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>

How can I resolve this? If you propose a fix, please make it concise.

Comment thread
gupsammy marked this conversation as resolved.
Outdated
.menu(&menu)
.show_menu_on_left_click(true)
.on_menu_event({
Expand Down Expand Up @@ -886,7 +893,7 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {
};

if let Ok(icon) = Image::from_bytes(include_bytes!("../icons/tray-stop-icon.png")) {
let _ = tray.set_icon(Some(icon));
set_tray_template_icon(&tray, icon);
}
}
});
Expand All @@ -907,7 +914,7 @@ pub fn create_tray(app: &AppHandle) -> tauri::Result<()> {

let current_mode = get_current_mode(&app_handle);
if let Ok(icon) = Image::from_bytes(get_mode_icon(current_mode)) {
let _ = tray.set_icon(Some(icon));
set_tray_template_icon(&tray, icon);
}
}
});
Expand Down