From da232116004959adaa81359db1e24ca2705750b9 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 19 Nov 2023 21:14:14 +0800 Subject: [PATCH] Settings-System-Added the function of hiding the taskbar, which is enabled by default. --- commons/data/languages.ts | 3 +++ commons/utils/setting.ts | 3 +++ electron/main/main/index.ts | 3 ++- electron/main/main/ipcEvent.ts | 8 ++++++++ electron/preload/index.ts | 4 ++++ src/index.d.ts | 1 + src/pages/setting/Index.vue | 14 +++++++++++++- types/setting.d.ts | 2 ++ yarn.lock | 8 ++++---- 9 files changed, 40 insertions(+), 6 deletions(-) diff --git a/commons/data/languages.ts b/commons/data/languages.ts index d8e9af6..32b1b60 100644 --- a/commons/data/languages.ts +++ b/commons/data/languages.ts @@ -135,6 +135,7 @@ let simplifiedChinese = { hideLoseFocus: "失去焦点后隐藏", hideName: "隐藏名称", hideTray: "隐藏托盘图标", + hideTaskbar: "隐藏任务栏", hideWindowCollapseSubClassification: "隐藏窗口时收起子分类", history: "历史记录", hover: "悬停", @@ -435,6 +436,7 @@ let traditionalChinese = { hideLoseFocus: "失去焦點後隱藏", hideName: "隱藏名稱", hideTray: "隱藏托盤圖標", + hideTaskbar: "隱藏任務欄", hideWindowCollapseSubClassification: "隱藏窗口時收起子分類", history: "歷史記錄", hover: "懸停", @@ -741,6 +743,7 @@ let english = { hideLoseFocus: "Hide After Lose Focus", hideName: "Hide Name", hideTray: "Hide Tray", + hideTaskbar: "Hide Taskbar", hideWindowCollapseSubClassification: "Collapse Subclassification when Hide Window", history: "History", diff --git a/commons/utils/setting.ts b/commons/utils/setting.ts index 02d66b7..1848879 100644 --- a/commons/utils/setting.ts +++ b/commons/utils/setting.ts @@ -31,6 +31,7 @@ function getGeneral({ lockSize = false, hideLoseFocus = false, hideTray = false, + hideTaskbar = true, fixedPosition = false, alwaysCenter = false, showHideMouseWheelClick = false, @@ -53,6 +54,7 @@ function getGeneral({ lockSize?: boolean | null; hideLoseFocus?: boolean | null; hideTray?: boolean | null; + hideTaskbar?: boolean | null; fixedPosition?: boolean | null; alwaysCenter?: boolean | null; showHideMouseWheelClick?: boolean | null; @@ -76,6 +78,7 @@ function getGeneral({ lockSize: lockSize ?? false, hideLoseFocus: hideLoseFocus ?? false, hideTray: hideTray ?? false, + hideTaskbar: hideTaskbar ?? true, fixedPosition: fixedPosition ?? false, alwaysCenter: alwaysCenter ?? false, showHideMouseWheelClick: showHideMouseWheelClick ?? false, diff --git a/electron/main/main/index.ts b/electron/main/main/index.ts index 2bc798f..9451e0f 100644 --- a/electron/main/main/index.ts +++ b/electron/main/main/index.ts @@ -36,11 +36,12 @@ function createMainWindow() { minimizable: false, fullscreenable: false, transparent: global.setting.appearance.transparency < 1, - skipTaskbar: true, + skipTaskbar: global.setting.general.hideTaskbar, backgroundColor: global.setting.appearance.transparency === 1 ? getMainBackgorunColor() : null, + icon: join(process.env.VITE_PUBLIC, "logo.ico"), webPreferences: { spellcheck: false, backgroundThrottling: false, diff --git a/electron/main/main/ipcEvent.ts b/electron/main/main/ipcEvent.ts index ccea079..817302c 100644 --- a/electron/main/main/ipcEvent.ts +++ b/electron/main/main/ipcEvent.ts @@ -2,6 +2,7 @@ import { ipcMain } from "electron"; import { createTray, hideMainWindow, showMainWindow } from "./index"; import { initAssociateFolder } from "../classification"; import { checkInvalid } from "../item"; +import { getWindow } from "../commons"; export default function () { // 显示窗口 @@ -16,6 +17,13 @@ export default function () { ipcMain.on("setTray", (event, args) => { createTray(args); }); + // 任务栏 + ipcMain.on("setTaskbar", (event, args) => { + let window = getWindow("mainWindow"); + if (window) { + window.setSkipTaskbar(args); + } + }); // 初始化数据 ipcMain.on("mainWindowInitData", () => { // 初始化关联文件夹 diff --git a/electron/preload/index.ts b/electron/preload/index.ts index 269dad1..6c7d282 100644 --- a/electron/preload/index.ts +++ b/electron/preload/index.ts @@ -717,6 +717,10 @@ contextBridge.exposeInMainWorld("setting", { setTray: (show: boolean) => { ipcRenderer.send("setTray", show); }, + // 隐藏任务栏 + setTaskbar: (show: boolean) => { + ipcRenderer.send("setTaskbar", show); + }, // 设置快捷键 setShortcutKey: (setting: Setting) => { ipcRenderer.send("setShortcutKey", setting); diff --git a/src/index.d.ts b/src/index.d.ts index 4a63818..97f820a 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -149,6 +149,7 @@ declare global { onUpdate: (callback: Callback) => Function; setStartup: (value: boolean) => void; setTray: (show: boolean) => void; + setTaskbar: (show: boolean) => void; setShortcutKey: (setting: Setting) => void; setAlwaysTop: (value: boolean) => void; setLockSize: (value: boolean) => void; diff --git a/src/pages/setting/Index.vue b/src/pages/setting/Index.vue index b5f4c1b..34dcd0e 100644 --- a/src/pages/setting/Index.vue +++ b/src/pages/setting/Index.vue @@ -63,7 +63,7 @@ size="small" > {{ - store.language.startup + store.language.system }} {{ store.language.hideTray }} + {{ store.language.hideTaskbar }}