diff --git a/commons/utils/setting.ts b/commons/utils/setting.ts index 5e4a731..e666feb 100644 --- a/commons/utils/setting.ts +++ b/commons/utils/setting.ts @@ -278,6 +278,7 @@ function getQuickSearch({ useItemOpen = false, openAfterHideQuickSearchWindow = true, matchConditionsRemark = false, + width = 600, }: { enable?: boolean | null; showHideShortcutKey?: string | null; @@ -289,6 +290,7 @@ function getQuickSearch({ useItemOpen?: boolean | null; openAfterHideQuickSearchWindow?: boolean | null; matchConditionsRemark?: boolean | null; + width?: number | null; }): QuickSearch { return { enable: enable ?? true, @@ -301,6 +303,7 @@ function getQuickSearch({ useItemOpen: useItemOpen ?? false, openAfterHideQuickSearchWindow: openAfterHideQuickSearchWindow ?? true, matchConditionsRemark: matchConditionsRemark ?? false, + width: width ?? 600, }; } diff --git a/electron/main/search/index.ts b/electron/main/search/index.ts index 76c9206..92049dd 100644 --- a/electron/main/search/index.ts +++ b/electron/main/search/index.ts @@ -14,7 +14,7 @@ function createQuickSearchWindow() { global.quickSearchWindowInit = false; quickSearchWindow = global.quickSearchWindow = new BrowserWindow({ title: "Dawn Launcher", - width: 600, + width: global.setting.quickSearch.width, height: 44, type: "toolbar", frame: false, diff --git a/electron/main/search/ipcEvent.ts b/electron/main/search/ipcEvent.ts index fdfc40c..75f18e5 100644 --- a/electron/main/search/ipcEvent.ts +++ b/electron/main/search/ipcEvent.ts @@ -18,4 +18,8 @@ export default function () { ipcMain.on("setQuickSearchWindowHeight", (event, args) => { global.quickSearchWindow.setBounds({ height: args }); }); + // 设置快速搜索窗口宽度 + ipcMain.on("setQuickSearchWindowWidth", (event, args) => { + global.quickSearchWindow.setBounds({ width: args }); + }); } diff --git a/electron/preload/index.ts b/electron/preload/index.ts index ef887f6..36d5c95 100644 --- a/electron/preload/index.ts +++ b/electron/preload/index.ts @@ -822,6 +822,10 @@ contextBridge.exposeInMainWorld("quickSearch", { setWindowHeight: (height: number) => { ipcRenderer.send("setQuickSearchWindowHeight", height); }, + // 设置窗口宽度 + setWindowWidth: (width: number) => { + ipcRenderer.send("setQuickSearchWindowWidth", width); + }, }); contextBridge.exposeInMainWorld("about", { diff --git a/src/index.d.ts b/src/index.d.ts index 694d7d6..ff04b08 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -175,6 +175,7 @@ declare global { onShowWindowBefore: (callback: Callback) => Function; onClearData: (callback: Callback) => Function; setWindowHeight: (height: number) => void; + setWindowWidth: (width: number) => void; }; about: { createWindow: () => void; diff --git a/src/pages/setting/Index.vue b/src/pages/setting/Index.vue index 4bfbce2..3ca754b 100644 --- a/src/pages/setting/Index.vue +++ b/src/pages/setting/Index.vue @@ -1083,6 +1083,25 @@ > + + {{ store.language.size }} + + + + (null); let searchSourceURL = ref(null); // 网络搜索源描述 let searchSourceDescription = ref(null); -// 显示新增搜索源 +// 显示新增搜索源 function showAddSearchSource() { searchSourceType.value = "add"; searchSourceId.value = null; diff --git a/types/setting.d.ts b/types/setting.d.ts index 3261cdc..a4576a1 100644 --- a/types/setting.d.ts +++ b/types/setting.d.ts @@ -182,6 +182,8 @@ export interface QuickSearch { openAfterHideQuickSearchWindow: boolean; // 匹配条件:备注 matchConditionsRemark: boolean; + // 宽度 + width: number; } // 网络搜索