Skip to content

Commit

Permalink
feat: 只在 MacOS 电脑开启磨砂窗口
Browse files Browse the repository at this point in the history
  • Loading branch information
ayangweb committed Jun 12, 2024
1 parent fe131e1 commit 8fb3465
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pages/Clipboard/History/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import copyAudio from "@/assets/audio/copy.mp3";
import type { HistoryItem, TablePayload } from "@/types/database";
import { isMac } from "@/utils/shared";
import { listen } from "@tauri-apps/api/event";
import { isEqual } from "lodash-es";
import { createContext } from "react";
Expand Down Expand Up @@ -42,7 +43,9 @@ const ClipboardHistory = () => {
});

useMount(async () => {
frostedWindow();
if (await isMac()) {
frostedWindow();
}

await initDatabase();

Expand Down
18 changes: 18 additions & 0 deletions src/utils/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,21 @@ export const toggleTheme = async (theme: Theme) => {
export const isDev = () => {
return import.meta.env.DEV;
};

/**
* 是否为 windows 系统
*/
export const isWin = async () => {
const osType = await type();

return osType === "Windows_NT";
};

/**
* 是否为 mac 系统
*/
export const isMac = async () => {
const osType = await type();

return osType === "Darwin";
};

0 comments on commit 8fb3465

Please sign in to comment.