[feat] tray powerplan items and seperators
This commit is contained in:
@@ -9,6 +9,7 @@ import { useDebounce } from "ahooks"
|
||||
import { useEffect } from "react"
|
||||
import "./globals.css"
|
||||
import Providers from "./providers"
|
||||
import { PowerPlans } from "@/components/cstb/PowerPlan"
|
||||
|
||||
export default function RootLayout({ children }: { children: React.ReactNode }) {
|
||||
const steam = useSteamStore()
|
||||
@@ -35,6 +36,15 @@ export default function RootLayout({ children }: { children: React.ReactNode })
|
||||
await invoke("kill_game")
|
||||
addToast({ title: "已关闭CS2" })
|
||||
})
|
||||
|
||||
void listen<number>("tray://set_powerplan", async (event) => {
|
||||
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)
|
||||
|
||||
addToast({ title: `电源计划已切换 → ${PowerPlans[current].title}` })
|
||||
})
|
||||
})
|
||||
|
||||
// 检测steam路径和游戏路径是否有效
|
||||
|
||||
Reference in New Issue
Block a user