[feat] start hidden + hidden on close + basic tray function
This commit is contained in:
@@ -11,8 +11,7 @@ import {
|
||||
Refresh,
|
||||
RocketOne,
|
||||
Square,
|
||||
SunOne,
|
||||
SurprisedFaceWithOpenBigMouth,
|
||||
SunOne
|
||||
} from "@icon-park/react"
|
||||
import { type Theme, getCurrentWindow } from "@tauri-apps/api/window"
|
||||
import { /* relaunch, */ exit } from "@tauri-apps/plugin-process"
|
||||
@@ -21,6 +20,7 @@ import { usePathname, useRouter } from "next/navigation"
|
||||
import { saveAllNow } from "@tauri-store/valtio"
|
||||
import { useSteamStore } from "@/store/steam"
|
||||
import { Modal, ModalContent, ModalHeader, ModalBody, ModalFooter } from "@heroui/react"
|
||||
import { window } from "@tauri-apps/api"
|
||||
|
||||
const Nav = () => {
|
||||
const { theme, setTheme } = useTheme()
|
||||
@@ -29,10 +29,12 @@ const Nav = () => {
|
||||
await setTauriTheme(theme)
|
||||
}
|
||||
|
||||
const app = useAppStore()
|
||||
const close = async () => {
|
||||
// (await window.hideOnClose) ? getCurrent().hide() : exit();
|
||||
await saveAllNow()
|
||||
await exit()
|
||||
// await exit()
|
||||
if (app.state.hiddenOnClose) window.getCurrentWindow().hide()
|
||||
else exit()
|
||||
}
|
||||
|
||||
const minimize = async () => {
|
||||
@@ -52,8 +54,6 @@ const Nav = () => {
|
||||
const router = useRouter()
|
||||
const pathname = usePathname()
|
||||
|
||||
const app = useAppStore()
|
||||
|
||||
return (
|
||||
<nav className="absolute top-0 right-0 flex flex-row h-16 gap-0.5 p-4" data-tauri-drag-region>
|
||||
<Tooltip content="启动页确认设置" showArrow={true} delay={300}>
|
||||
|
||||
Reference in New Issue
Block a user