Feature: add config item to hide dock, only for macos

This commit is contained in:
萌萌哒赫萝 2023-04-09 17:12:21 +08:00
parent 28caf56331
commit 0466fa78a4
10 changed files with 44 additions and 9 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ node_modules/
npm-debug.log npm-debug.log
npm-debug.log.* npm-debug.log.*
thumbs.db thumbs.db
remote-notice.json
!.gitkeep !.gitkeep
yarn-error.log yarn-error.log
docs/dist/ docs/dist/

View File

@ -188,7 +188,7 @@ SETTINGS_CUSTOM_MINI_ICON_PATH: Custom Mini Window Icon Path
SETTINGS_CUSTOM_MINI_ICON: Custom Mini Window Icon SETTINGS_CUSTOM_MINI_ICON: Custom Mini Window Icon
SETTINGS_COMPRESS_AND_WATERMARK: Compress and Watermark SETTINGS_COMPRESS_AND_WATERMARK: Compress and Watermark
SETTINGS_SYNC_DELETE_CLOUD: Sync delete from cloud storage of gallery SETTINGS_SYNC_DELETE_CLOUD: Sync delete from cloud storage of gallery
SETTINGS_ISHIDEDOCK: Hide Dock Icon
# shortcut-page # shortcut-page
BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts

View File

@ -189,6 +189,7 @@ SETTINGS_CUSTOM_MINI_ICON_PATH: 自定义Mini窗口图标路径
SETTINGS_CUSTOM_MINI_ICON: 是否自定义Mini窗口图标 SETTINGS_CUSTOM_MINI_ICON: 是否自定义Mini窗口图标
SETTINGS_COMPRESS_AND_WATERMARK: 设置图片水印和压缩-格式转换等参数 SETTINGS_COMPRESS_AND_WATERMARK: 设置图片水印和压缩-格式转换等参数
SETTINGS_SYNC_DELETE_CLOUD: 相册内删除时同步删除云端文件 SETTINGS_SYNC_DELETE_CLOUD: 相册内删除时同步删除云端文件
SETTINGS_ISHIDEDOCK: 是否隐藏dock图标
# shortcut-page # shortcut-page

View File

@ -189,7 +189,7 @@ SETTINGS_CUSTOM_MINI_ICON_PATH: 自訂Mini視窗圖示路徑
SETTINGS_CUSTOM_MINI_ICON: 自訂Mini視窗圖示 SETTINGS_CUSTOM_MINI_ICON: 自訂Mini視窗圖示
SETTINGS_COMPRESS_AND_WATERMARK: 設置圖片浮水印和壓縮-格式轉換等參數 SETTINGS_COMPRESS_AND_WATERMARK: 設置圖片浮水印和壓縮-格式轉換等參數
SETTINGS_SYNC_DELETE_CLOUD: 從相簿中刪除並同步從雲端刪除 SETTINGS_SYNC_DELETE_CLOUD: 從相簿中刪除並同步從雲端刪除
SETTINGS_ISHIDEDOCK: 是否隱藏dock圖示
# shortcut-page # shortcut-page
SHORTCUT_NAME: 快捷鍵名稱 SHORTCUT_NAME: 快捷鍵名稱

View File

@ -30,7 +30,8 @@ import {
RELOAD_APP, RELOAD_APP,
SHOW_PLUGIN_PAGE_MENU, SHOW_PLUGIN_PAGE_MENU,
SET_MINI_WINDOW_POS, SET_MINI_WINDOW_POS,
GET_PICBEDS GET_PICBEDS,
HIDE_DOCK
} from '#/events/constants' } from '#/events/constants'
import { import {
uploadClipboardFiles, uploadClipboardFiles,
@ -270,6 +271,13 @@ export default {
const window = BrowserWindow.getFocusedWindow() const window = BrowserWindow.getFocusedWindow()
window?.setBounds(pos) window?.setBounds(pos)
}) })
ipcMain.on(HIDE_DOCK, (_evt: IpcMainEvent, val: boolean) => {
if (val) {
app.dock.hide()
} else {
app.dock.show()
}
})
}, },
dispose () {} dispose () {}
} }

View File

@ -175,7 +175,8 @@ class LifeCycle {
} }
await remoteNoticeHandler.init() await remoteNoticeHandler.init()
remoteNoticeHandler.triggerHook(IRemoteNoticeTriggerHook.APP_START) remoteNoticeHandler.triggerHook(IRemoteNoticeTriggerHook.APP_START)
if (db.get('settings.startMode') === 'mini') { const startMode = db.get('settings.startMode') || 'quiet'
if (startMode === 'mini') {
windowManager.create(IWindowList.MINI_WINDOW) windowManager.create(IWindowList.MINI_WINDOW)
const miniWindow = windowManager.get(IWindowList.MINI_WINDOW)! const miniWindow = windowManager.get(IWindowList.MINI_WINDOW)!
if (db.get('settings.miniWindowOntop')) { if (db.get('settings.miniWindowOntop')) {
@ -198,11 +199,15 @@ class LifeCycle {
}) })
miniWindow.show() miniWindow.show()
miniWindow.focus() miniWindow.focus()
} else if (db.get('settings.startMode') === 'main') { } else if (startMode === 'main') {
const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)! const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)!
settingWindow.show() settingWindow.show()
settingWindow.focus() settingWindow.focus()
} }
const isHideDock = db.get('settings.isHideDock') || false
if (isHideDock) {
app.dock.hide()
}
} }
app.whenReady().then(readyFunction) app.whenReady().then(readyFunction)
} }

View File

@ -70,6 +70,16 @@
/> />
</el-select> </el-select>
</el-form-item> </el-form-item>
<el-form-item
:label="$T('SETTINGS_ISHIDEDOCK')"
>
<el-switch
v-model="form.isHideDock"
:active-text="$T('SETTINGS_OPEN')"
:inactive-text="$T('SETTINGS_CLOSE')"
@change="handleHideDockChange"
/>
</el-form-item>
<el-form-item <el-form-item
:label="$T('SETTINGS_MIGRATE_FROM_PICGO')" :label="$T('SETTINGS_MIGRATE_FROM_PICGO')"
> >
@ -897,7 +907,7 @@
import { ElForm, ElMessage as $message, ElMessage, ElMessageBox, FormRules } from 'element-plus' import { ElForm, ElMessage as $message, ElMessage, ElMessageBox, FormRules } from 'element-plus'
import { Reading, QuestionFilled } from '@element-plus/icons-vue' import { Reading, QuestionFilled } from '@element-plus/icons-vue'
import pkg from 'root/package.json' import pkg from 'root/package.json'
import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS } from '#/events/constants' import { PICGO_OPEN_FILE, OPEN_URL, GET_PICBEDS, HIDE_DOCK } from '#/events/constants'
import { import {
ipcRenderer ipcRenderer
} from 'electron' } from 'electron'
@ -1022,7 +1032,8 @@ const form = reactive<ISettingForm>({
logFileSizeLimit: 10, logFileSizeLimit: 10,
deleteCloudFile: false, deleteCloudFile: false,
isCustomMiniIcon: false, isCustomMiniIcon: false,
customMiniIcon: '' customMiniIcon: '',
isHideDock: false
}) })
const languageList = i18nManager.languageList.map(item => ({ const languageList = i18nManager.languageList.map(item => ({
@ -1117,6 +1128,7 @@ async function initData () {
form.deleteCloudFile = settings.deleteCloudFile || false form.deleteCloudFile = settings.deleteCloudFile || false
form.isCustomMiniIcon = settings.isCustomMiniIcon || false form.isCustomMiniIcon = settings.isCustomMiniIcon || false
form.customMiniIcon = settings.customMiniIcon || '' form.customMiniIcon = settings.customMiniIcon || ''
form.isHideDock = settings.isHideDock || false
currentLanguage.value = settings.language ?? 'zh-CN' currentLanguage.value = settings.language ?? 'zh-CN'
currentStartMode.value = settings.startMode || 'quiet' currentStartMode.value = settings.startMode || 'quiet'
customLink.value = settings.customLink || '$url' customLink.value = settings.customLink || '$url'
@ -1166,7 +1178,7 @@ function openLogSetting () {
async function cancelCustomLink () { async function cancelCustomLink () {
customLinkVisible.value = false customLinkVisible.value = false
customLink.value = await getConfig<string>('settings.customLink') || '$url' customLink.value = await getConfig<string>('settings.customLink') || '![$fileName]($url)'
} }
function confirmCustomLink () { function confirmCustomLink () {
@ -1222,6 +1234,11 @@ function updateHelperChange (val: ICheckBoxValueType) {
saveConfig('settings.showUpdateTip', val) saveConfig('settings.showUpdateTip', val)
} }
function handleHideDockChange (val: ICheckBoxValueType) {
saveConfig('settings.isHideDock', val)
sendToMain(HIDE_DOCK, val)
}
function useBuiltinClipboardChange (val: ICheckBoxValueType) { function useBuiltinClipboardChange (val: ICheckBoxValueType) {
saveConfig('settings.useBuiltinClipboard', val) saveConfig('settings.useBuiltinClipboard', val)
} }

View File

@ -22,6 +22,7 @@ export const MINIMIZE_WINDOW = 'MINIMIZE_WINDOW'
export const CLOSE_WINDOW = 'CLOSE_WINDOW' export const CLOSE_WINDOW = 'CLOSE_WINDOW'
export const OPEN_USER_STORE_FILE = 'OPEN_USER_STORE_FILE' export const OPEN_USER_STORE_FILE = 'OPEN_USER_STORE_FILE'
export const OPEN_URL = 'OPEN_URL' export const OPEN_URL = 'OPEN_URL'
export const HIDE_DOCK = 'HIDE_DOCK'
export const RELOAD_APP = 'RELOAD_APP' export const RELOAD_APP = 'RELOAD_APP'
export const PICGO_CONFIG_PLUGIN = 'PICGO_CONFIG_PLUGIN' export const PICGO_CONFIG_PLUGIN = 'PICGO_CONFIG_PLUGIN'
export const PICGO_HANDLE_PLUGIN_ING = 'PICGO_HANDLE_PLUGIN_ING' export const PICGO_HANDLE_PLUGIN_ING = 'PICGO_HANDLE_PLUGIN_ING'

View File

@ -183,6 +183,7 @@ interface ILocales {
SETTINGS_CUSTOM_MINI_ICON: string SETTINGS_CUSTOM_MINI_ICON: string
SETTINGS_COMPRESS_AND_WATERMARK: string SETTINGS_COMPRESS_AND_WATERMARK: string
SETTINGS_SYNC_DELETE_CLOUD: string SETTINGS_SYNC_DELETE_CLOUD: string
SETTINGS_ISHIDEDOCK: string
SHORTCUT_NAME: string SHORTCUT_NAME: string
SHORTCUT_BIND: string SHORTCUT_BIND: string
SHORTCUT_STATUS: string SHORTCUT_STATUS: string

View File

@ -14,7 +14,8 @@ interface ISettingForm {
logFileSizeLimit: number, logFileSizeLimit: number,
deleteCloudFile: boolean, deleteCloudFile: boolean,
isCustomMiniIcon: boolean, isCustomMiniIcon: boolean,
customMiniIcon: string customMiniIcon: string,
isHideDock: boolean
} }
interface IShortKeyMap { interface IShortKeyMap {