Settings-System-Added the function of hiding the taskbar, which is enabled by default.

This commit is contained in:
unknown 2023-11-19 21:14:14 +08:00
parent 2bdbdbab16
commit da23211600
9 changed files with 40 additions and 6 deletions

View File

@ -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",

View File

@ -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,

View File

@ -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,

View File

@ -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", () => {
// 初始化关联文件夹

View File

@ -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);

1
src/index.d.ts vendored
View File

@ -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;

View File

@ -63,7 +63,7 @@
size="small"
>
<span class="block font-semibold">{{
store.language.startup
store.language.system
}}</span>
<NFormItem class="mt-1">
<NCheckbox
@ -88,6 +88,14 @@
>{{ store.language.hideTray }}</NCheckbox
></NFormItem
>
<NFormItem
><NCheckbox
v-model:checked="setting.general.hideTaskbar"
:focusable="false"
@update:checked="setTaskbar"
>{{ store.language.hideTaskbar }}</NCheckbox
></NFormItem
>
</NForm>
<NForm
label-placement="left"
@ -1834,6 +1842,10 @@ function setStartup(value: boolean) {
function setTray(value: boolean) {
window.setting.setTray(!value);
}
//
function setTaskbar(value: boolean) {
window.setting.setTaskbar(value);
}
//
async function checkGeneralShowHideShortcutKey() {
let success = true;

2
types/setting.d.ts vendored
View File

@ -20,6 +20,8 @@ export interface General {
hideLoseFocus: boolean;
// 隐藏托盘图标
hideTray: boolean;
// 隐藏任务栏
hideTaskbar: boolean;
// 固定位置
fixedPosition: boolean;
// 永远居中

View File

@ -3449,10 +3449,10 @@ verror@^1.10.0:
core-util-is "1.0.2"
extsprintf "^1.2.0"
vite-plugin-electron@^0.14.1:
version "0.14.1"
resolved "https://registry.npmmirror.com/vite-plugin-electron/-/vite-plugin-electron-0.14.1.tgz#faad1e26d853ea7960b812272c19521c7f180482"
integrity sha512-QGQ2nJ4wjMf1FaDSkdoC/UskQGiYGcAToATJqJXvqrL4Jmt0CFaZqoDjh1xLicUWEo/X7urHYjhKTqwEeP7F7g==
vite-plugin-electron@^0.15.4:
version "0.15.4"
resolved "https://registry.npmmirror.com/vite-plugin-electron/-/vite-plugin-electron-0.15.4.tgz#29552461940ed7ec398f59ee8b5ee63aa559a6c9"
integrity sha512-aXGDjTXebJxNX+cf+KSZEsa9BcMrTbNhjZJaUhU5999/ATYZq4PlZpebfyeslyuYpjk6OdyA/pNC+fTeDYK5Kw==
vite@^4.4.11:
version "4.5.0"