feat: add light tray icon & keydown listen (#72)

This commit is contained in:
BiggerRain
2024-12-25 17:43:56 +08:00
committed by GitHub
parent d659c5a4c4
commit 72ff9e38c8
16 changed files with 118 additions and 110 deletions

BIN
src-tauri/icons/1x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
src-tauri/icons/2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src-tauri/icons/3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src-tauri/icons/dark@1x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 589 B

BIN
src-tauri/icons/dark@2x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src-tauri/icons/dark@3x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 597 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

View File

@@ -234,6 +234,7 @@ fn handle_hide_coco(app: &AppHandle) {
fn enable_tray(app: &mut tauri::App) {
use tauri::{
image::Image,
menu::{MenuBuilder, MenuItem},
tray::TrayIconBuilder,
};
@@ -256,7 +257,8 @@ fn enable_tray(app: &mut tauri::App) {
.unwrap();
let _tray = TrayIconBuilder::new()
.icon(app.default_window_icon().unwrap().clone())
// .icon(app.default_window_icon().unwrap().clone())
.icon(Image::from_bytes(include_bytes!("../icons/light@2x.png")).expect("REASON"))
.menu(&menu)
.on_menu_event(|app, event| match event.id.as_ref() {
"open" => {