[feat] tray powerplan items and seperators
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import { store } from "@tauri-store/valtio"
|
||||
import { useSnapshot } from "valtio"
|
||||
import { DEFAULT_STORE_CONFIG } from "./config"
|
||||
import { emit } from "@tauri-apps/api/event"
|
||||
import { send } from "process"
|
||||
|
||||
interface LaunchOption {
|
||||
option: string
|
||||
@@ -50,6 +52,13 @@ export const useToolStore = () => {
|
||||
void toolStore.start
|
||||
const state = useSnapshot(toolStore.state)
|
||||
|
||||
if (typeof window !== 'undefined') {
|
||||
setTimeout(() => {
|
||||
sendCurrentLaunchOptionToTray(state.launchIndex)
|
||||
sendPowerPlanToTray(state.powerPlan)
|
||||
}, 500)
|
||||
}
|
||||
|
||||
return {
|
||||
state,
|
||||
store: toolStore,
|
||||
@@ -77,10 +86,18 @@ const setLaunchOptions = (options: LaunchOption[]) => {
|
||||
|
||||
const setLaunchIndex = (index: number) => {
|
||||
toolStore.state.launchIndex = index
|
||||
sendCurrentLaunchOptionToTray(index)
|
||||
}
|
||||
|
||||
const sendCurrentLaunchOptionToTray = (index: number) => {
|
||||
emit("tray://get_current_launch_option", toolStore.state.launchOptions[index].name || index + 1)
|
||||
}
|
||||
const setPowerPlan = (plan: number) => {
|
||||
toolStore.state.powerPlan = plan
|
||||
sendPowerPlanToTray(plan)
|
||||
}
|
||||
const sendPowerPlanToTray = (plan: number) => {
|
||||
emit("tray://get_powerplan", plan)
|
||||
}
|
||||
|
||||
const setVideoSetting = (setting: VideoSetting) => {
|
||||
|
||||
Reference in New Issue
Block a user