From 79ead78eaf6927dc2732c07f32c26bd64d256668 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Fri, 16 Jan 2026 19:38:33 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8C=B1=20=E5=B0=9D=E8=AF=95=E9=80=82?= =?UTF-8?q?=E9=85=8Dlinux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit https://docs.gtk.org/gio/type_func.Application.id_is_valid.html --- src-tauri/Cargo.toml | 2 +- .../{TeyvatGuide.json => Teyvat.Guide.json} | 2 +- src-tauri/rustfmt.toml | 2 +- src-tauri/src/lib.rs | 4 ++-- src-tauri/src/main.rs | 10 ++++++++-- src-tauri/tauri.conf.json | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) rename src-tauri/capabilities/{TeyvatGuide.json => Teyvat.Guide.json} (98%) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 02b75461..e4ce4793 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -5,7 +5,7 @@ description = "Game Tool for Genshin Impact player" authors = ["BTMuli "] license = "MIT" repository = "https://github.com/BTMuli/TeyvatGuide" -edition = "2021" +edition = "2024" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src-tauri/capabilities/TeyvatGuide.json b/src-tauri/capabilities/Teyvat.Guide.json similarity index 98% rename from src-tauri/capabilities/TeyvatGuide.json rename to src-tauri/capabilities/Teyvat.Guide.json index 72a8a3ed..527b1fa7 100644 --- a/src-tauri/capabilities/TeyvatGuide.json +++ b/src-tauri/capabilities/Teyvat.Guide.json @@ -1,6 +1,6 @@ { "$schema": "./schemas/desktop-schema.json", - "identifier": "TeyvatGuide", + "identifier": "Teyvat.Guide", "description": "Capability for the main window", "windows": ["TeyvatGuide"], "permissions": [ diff --git a/src-tauri/rustfmt.toml b/src-tauri/rustfmt.toml index 3fc430c9..940cb966 100644 --- a/src-tauri/rustfmt.toml +++ b/src-tauri/rustfmt.toml @@ -4,6 +4,6 @@ max_width = 100 tab_spaces = 2 -edition = "2018" +edition = "2024" use_small_heuristics = "Max" newline_style = "Auto" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 10789186..325a725b 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -16,7 +16,7 @@ use crate::commands::{ create_window, execute_js, get_dir_size, hide_main_window, init_app, is_in_admin, launch_game, quit_app, read_text_scale, }; -use tauri::{generate_context, generate_handler, Emitter, Manager, Window, WindowEvent}; +use tauri::{Emitter, Manager, Window, WindowEvent, generate_context, generate_handler}; // 子窗口 label 的数组 pub const SUB_WINDOW_LABELS: [&str; 3] = ["Sub_window", "Dev_JSON", "mhy_client"]; @@ -26,7 +26,7 @@ fn window_event_handler(app: &Window, event: &WindowEvent) { match event { WindowEvent::CloseRequested { api, .. } => { api.prevent_close(); - if app.label() == "TeyvatGuide" { + if app.label() == "Teyvat.Guide" { // 主窗口:发送事件让前端根据配置决定是隐藏还是退出 let _ = app.emit("main-window-close-requested", ()); } else { diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs index 7346453f..522f0b83 100644 --- a/src-tauri/src/main.rs +++ b/src-tauri/src/main.rs @@ -7,7 +7,7 @@ #[cfg(target_os = "windows")] fn enable_dpi_v2() { use windows_sys::Win32::UI::HiDpi::{ - SetProcessDpiAwarenessContext, DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, + DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2, SetProcessDpiAwarenessContext, }; unsafe { @@ -22,8 +22,14 @@ fn main() { release: sentry::release_name!().into(), send_default_pii: true, ..Default::default() - })); + }, + )); #[cfg(target_os = "windows")] enable_dpi_v2(); + #[cfg(target_os = "linux")] + unsafe { + // Not unsafe if you don't use edition 2024 + std::env::set_var("WEBKIT_DISABLE_DMABUF_RENDERER", "1"); + } teyvat_guide_lib::run() } diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a09ae11d..d5597b29 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "$schema": "https://schema.tauri.app/config/2", "productName": "TeyvatGuide", - "identifier": "TeyvatGuide", + "identifier": "Teyvat.Guide", "version": "0.9.1", "build": { "beforeDevCommand": "pnpm vite:dev", @@ -48,7 +48,7 @@ "visible": false } ], - "security": { "capabilities": ["TeyvatGuide", "Mys", "SubWindow", "DevJson"] } + "security": { "capabilities": ["Teyvat.Guide", "Mys", "SubWindow", "DevJson"] } }, "plugins": { "deep-link": { "desktop": { "schemes": ["teyvatguide"] }, "mobile": [] },