[fix] fast launch from tray not working
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
"use client"
|
||||
import { init } from "@/store"
|
||||
import { useSteamStore } from "@/store/steam"
|
||||
import { useToolStore } from "@/store/tool"
|
||||
import { steamStore, useSteamStore } from "@/store/steam"
|
||||
import { toolStore, useToolStore } from "@/store/tool"
|
||||
import { addToast } from "@heroui/react"
|
||||
import { invoke } from "@tauri-apps/api/core"
|
||||
import { listen } from "@tauri-apps/api/event"
|
||||
import { useDebounce } from "ahooks"
|
||||
import { useDebounce, useDebounceEffect, useDebounceFn } from "ahooks"
|
||||
import { useEffect } from "react"
|
||||
import "./globals.css"
|
||||
import Providers from "./providers"
|
||||
@@ -20,11 +20,11 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
|
||||
void listen<string>("tray://launch_game", async (event) => {
|
||||
await invoke("launch_game", {
|
||||
steamPath: `${steam.state.steamDir}/steam.exe`,
|
||||
launchOption: tool.state.launchOptions[tool.state.launchIndex].option || "",
|
||||
steamPath: `${steamStore.state.steamDir}\\steam.exe`,
|
||||
launchOption: toolStore.state.launchOptions[toolStore.state.launchIndex].option || "",
|
||||
server: event.payload || "worldwide",
|
||||
})
|
||||
addToast({ title: "启动国服成功" })
|
||||
addToast({ title: `启动${event.payload === "worldwide" ? "国际服" : "国服"}成功` })
|
||||
})
|
||||
|
||||
void listen("tray://kill_steam", async () => {
|
||||
@@ -38,7 +38,7 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
})
|
||||
|
||||
void listen<number>("tray://set_powerplan", async (event) => {
|
||||
if (typeof(event.payload) === "number" && event.payload <= 0 && event.payload > 4) return
|
||||
if (typeof event.payload === "number" && event.payload <= 0 && event.payload > 4) return
|
||||
await invoke("set_powerplan", { plan: event.payload })
|
||||
const current = await invoke<number>("get_powerplan")
|
||||
tool.setPowerPlan(current)
|
||||
|
||||
Reference in New Issue
Block a user