Skip to content

Commit e6858c0

Browse files
committed
fix: 🐛 tray icon
1 parent 5a65a6f commit e6858c0

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

next-env.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
/// <reference types="next/navigation-types/compat/navigation" />
43

54
// NOTE: This file should not be edited
65
// see https://nextjs.org/docs/basic-features/typescript for more information.

src-tauri/icons/appleTrayIcon.png

2.31 KB
Loading

src-tauri/icons/social-square.png

-11 KB
Binary file not shown.

src-tauri/src/tray.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,19 +29,20 @@ fn create_window<R: Runtime>(app: &tauri::AppHandle<R>, label: String, path: Str
2929
.center()
3030
.resizable(true)
3131
.visible(false)
32-
.decorations(true);
32+
.decorations(false);
3333
#[cfg(target_os = "macos")]
3434
{
3535
builder
3636
.hidden_title(true)
3737
.title_bar_style(tauri::TitleBarStyle::Overlay)
38+
.decorations(true)
3839
.build()
3940
.unwrap();
4041
}
4142

4243
#[cfg(not(target_os = "macos"))]
4344
{
44-
builder.decorations(true).build().unwrap();
45+
builder.decorations(false).build().unwrap();
4546
}
4647
}
4748

@@ -81,8 +82,12 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
8182
_ => {}
8283
})
8384
.tooltip("MDX editor")
85+
.icon(if cfg!(target_os = "macos") {
86+
Image::from_bytes(include_bytes!("../icons/appleTrayIcon.png"))
87+
} else {
88+
Image::from_bytes(include_bytes!("../icons/128x128.png"))
89+
}?)
8490
.icon_as_template(true)
85-
.icon(Image::from_path("icons/social-square.png")?)
8691
.on_tray_icon_event(|tray, event| match event {
8792
TrayIconEvent::Click {
8893
id: _,
@@ -92,15 +97,6 @@ pub fn create_tray<R: Runtime>(app: &tauri::AppHandle<R>) -> tauri::Result<()> {
9297
button_state: _,
9398
} => match button {
9499
MouseButton::Left {} => {
95-
// let windows = tray.app_handle().webview_windows();
96-
// for (key, value) in windows {
97-
// if key == "login" || key == "main" {
98-
// value.show().unwrap();
99-
// value.unminimize().unwrap();
100-
// value.set_focus().unwrap();
101-
// }
102-
// }
103-
104100
tray.app_handle().emit("tray_menu", position).unwrap();
105101
}
106102
MouseButton::Right {} => {}

0 commit comments

Comments
 (0)