mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-03-15 03:53:16 +08:00
🌱 尝试适配linux
https://docs.gtk.org/gio/type_func.Application.id_is_valid.html
This commit is contained in:
@@ -5,7 +5,7 @@ description = "Game Tool for Genshin Impact player"
|
||||
authors = ["BTMuli <bt-muli@outlook.com>"]
|
||||
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
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "./schemas/desktop-schema.json",
|
||||
"identifier": "TeyvatGuide",
|
||||
"identifier": "Teyvat.Guide",
|
||||
"description": "Capability for the main window",
|
||||
"windows": ["TeyvatGuide"],
|
||||
"permissions": [
|
||||
@@ -4,6 +4,6 @@
|
||||
|
||||
max_width = 100
|
||||
tab_spaces = 2
|
||||
edition = "2018"
|
||||
edition = "2024"
|
||||
use_small_heuristics = "Max"
|
||||
newline_style = "Auto"
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
@@ -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": [] },
|
||||
|
||||
Reference in New Issue
Block a user