diff --git a/.gitignore b/.gitignore index 1660afc..d383bc0 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ node_modules/ npm-debug.log npm-debug.log.* thumbs.db +remote-notice.json !.gitkeep yarn-error.log docs/dist/ diff --git a/public/i18n/en.yml b/public/i18n/en.yml index 293f8d4..25de946 100644 --- a/public/i18n/en.yml +++ b/public/i18n/en.yml @@ -188,7 +188,7 @@ SETTINGS_CUSTOM_MINI_ICON_PATH: Custom Mini Window Icon Path SETTINGS_CUSTOM_MINI_ICON: Custom Mini Window Icon SETTINGS_COMPRESS_AND_WATERMARK: Compress and Watermark SETTINGS_SYNC_DELETE_CLOUD: Sync delete from cloud storage of gallery - +SETTINGS_ISHIDEDOCK: Hide Dock Icon # shortcut-page BUILTIN_CLIPBOARD_TIPS: Use builtin clipboard function to upload instead of using scripts diff --git a/public/i18n/zh-CN.yml b/public/i18n/zh-CN.yml index 6971cb1..98da3c2 100644 --- a/public/i18n/zh-CN.yml +++ b/public/i18n/zh-CN.yml @@ -189,6 +189,7 @@ SETTINGS_CUSTOM_MINI_ICON_PATH: 自定义Mini窗口图标路径 SETTINGS_CUSTOM_MINI_ICON: 是否自定义Mini窗口图标 SETTINGS_COMPRESS_AND_WATERMARK: 设置图片水印和压缩-格式转换等参数 SETTINGS_SYNC_DELETE_CLOUD: 相册内删除时同步删除云端文件 +SETTINGS_ISHIDEDOCK: 是否隐藏dock图标 # shortcut-page diff --git a/public/i18n/zh-TW.yml b/public/i18n/zh-TW.yml index e9b29ec..a30052c 100644 --- a/public/i18n/zh-TW.yml +++ b/public/i18n/zh-TW.yml @@ -189,7 +189,7 @@ SETTINGS_CUSTOM_MINI_ICON_PATH: 自訂Mini視窗圖示路徑 SETTINGS_CUSTOM_MINI_ICON: 自訂Mini視窗圖示 SETTINGS_COMPRESS_AND_WATERMARK: 設置圖片浮水印和壓縮-格式轉換等參數 SETTINGS_SYNC_DELETE_CLOUD: 從相簿中刪除並同步從雲端刪除 - +SETTINGS_ISHIDEDOCK: 是否隱藏dock圖示 # shortcut-page SHORTCUT_NAME: 快捷鍵名稱 diff --git a/src/main/events/ipcList.ts b/src/main/events/ipcList.ts index 8222463..9c2a093 100644 --- a/src/main/events/ipcList.ts +++ b/src/main/events/ipcList.ts @@ -30,7 +30,8 @@ import { RELOAD_APP, SHOW_PLUGIN_PAGE_MENU, SET_MINI_WINDOW_POS, - GET_PICBEDS + GET_PICBEDS, + HIDE_DOCK } from '#/events/constants' import { uploadClipboardFiles, @@ -270,6 +271,13 @@ export default { const window = BrowserWindow.getFocusedWindow() window?.setBounds(pos) }) + ipcMain.on(HIDE_DOCK, (_evt: IpcMainEvent, val: boolean) => { + if (val) { + app.dock.hide() + } else { + app.dock.show() + } + }) }, dispose () {} } diff --git a/src/main/lifeCycle/index.ts b/src/main/lifeCycle/index.ts index 39f9a1e..aa731fb 100644 --- a/src/main/lifeCycle/index.ts +++ b/src/main/lifeCycle/index.ts @@ -175,7 +175,8 @@ class LifeCycle { } await remoteNoticeHandler.init() 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) const miniWindow = windowManager.get(IWindowList.MINI_WINDOW)! if (db.get('settings.miniWindowOntop')) { @@ -198,11 +199,15 @@ class LifeCycle { }) miniWindow.show() miniWindow.focus() - } else if (db.get('settings.startMode') === 'main') { + } else if (startMode === 'main') { const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)! settingWindow.show() settingWindow.focus() } + const isHideDock = db.get('settings.isHideDock') || false + if (isHideDock) { + app.dock.hide() + } } app.whenReady().then(readyFunction) } diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index fb44740..079f29a 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -70,6 +70,16 @@ /> + + + @@ -897,7 +907,7 @@ import { ElForm, ElMessage as $message, ElMessage, ElMessageBox, FormRules } from 'element-plus' import { Reading, QuestionFilled } from '@element-plus/icons-vue' 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 { ipcRenderer } from 'electron' @@ -1022,7 +1032,8 @@ const form = reactive({ logFileSizeLimit: 10, deleteCloudFile: false, isCustomMiniIcon: false, - customMiniIcon: '' + customMiniIcon: '', + isHideDock: false }) const languageList = i18nManager.languageList.map(item => ({ @@ -1117,6 +1128,7 @@ async function initData () { form.deleteCloudFile = settings.deleteCloudFile || false form.isCustomMiniIcon = settings.isCustomMiniIcon || false form.customMiniIcon = settings.customMiniIcon || '' + form.isHideDock = settings.isHideDock || false currentLanguage.value = settings.language ?? 'zh-CN' currentStartMode.value = settings.startMode || 'quiet' customLink.value = settings.customLink || '$url' @@ -1166,7 +1178,7 @@ function openLogSetting () { async function cancelCustomLink () { customLinkVisible.value = false - customLink.value = await getConfig('settings.customLink') || '$url' + customLink.value = await getConfig('settings.customLink') || '![$fileName]($url)' } function confirmCustomLink () { @@ -1222,6 +1234,11 @@ function updateHelperChange (val: ICheckBoxValueType) { saveConfig('settings.showUpdateTip', val) } +function handleHideDockChange (val: ICheckBoxValueType) { + saveConfig('settings.isHideDock', val) + sendToMain(HIDE_DOCK, val) +} + function useBuiltinClipboardChange (val: ICheckBoxValueType) { saveConfig('settings.useBuiltinClipboard', val) } diff --git a/src/universal/events/constants.ts b/src/universal/events/constants.ts index dbc0792..7495526 100644 --- a/src/universal/events/constants.ts +++ b/src/universal/events/constants.ts @@ -22,6 +22,7 @@ export const MINIMIZE_WINDOW = 'MINIMIZE_WINDOW' export const CLOSE_WINDOW = 'CLOSE_WINDOW' export const OPEN_USER_STORE_FILE = 'OPEN_USER_STORE_FILE' export const OPEN_URL = 'OPEN_URL' +export const HIDE_DOCK = 'HIDE_DOCK' export const RELOAD_APP = 'RELOAD_APP' export const PICGO_CONFIG_PLUGIN = 'PICGO_CONFIG_PLUGIN' export const PICGO_HANDLE_PLUGIN_ING = 'PICGO_HANDLE_PLUGIN_ING' diff --git a/src/universal/types/i18n.d.ts b/src/universal/types/i18n.d.ts index 8eae98a..9cda86e 100644 --- a/src/universal/types/i18n.d.ts +++ b/src/universal/types/i18n.d.ts @@ -183,6 +183,7 @@ interface ILocales { SETTINGS_CUSTOM_MINI_ICON: string SETTINGS_COMPRESS_AND_WATERMARK: string SETTINGS_SYNC_DELETE_CLOUD: string + SETTINGS_ISHIDEDOCK: string SHORTCUT_NAME: string SHORTCUT_BIND: string SHORTCUT_STATUS: string diff --git a/src/universal/types/view.d.ts b/src/universal/types/view.d.ts index d64b31d..b3d435c 100644 --- a/src/universal/types/view.d.ts +++ b/src/universal/types/view.d.ts @@ -14,7 +14,8 @@ interface ISettingForm { logFileSizeLimit: number, deleteCloudFile: boolean, isCustomMiniIcon: boolean, - customMiniIcon: string + customMiniIcon: string, + isHideDock: boolean } interface IShortKeyMap {