mirror of
https://github.com/fanchenio/DawnLauncher.git
synced 2025-07-13 12:52:10 +08:00
settings-Quick search, add dimensions, modify window width.
This commit is contained in:
parent
607ff84af9
commit
d655198b1d
@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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 });
|
||||
});
|
||||
}
|
||||
|
@ -822,6 +822,10 @@ contextBridge.exposeInMainWorld("quickSearch", {
|
||||
setWindowHeight: (height: number) => {
|
||||
ipcRenderer.send("setQuickSearchWindowHeight", height);
|
||||
},
|
||||
// 设置窗口宽度
|
||||
setWindowWidth: (width: number) => {
|
||||
ipcRenderer.send("setQuickSearchWindowWidth", width);
|
||||
},
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld("about", {
|
||||
|
1
src/index.d.ts
vendored
1
src/index.d.ts
vendored
@ -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;
|
||||
|
@ -1083,6 +1083,25 @@
|
||||
>
|
||||
</div>
|
||||
</NForm>
|
||||
<NForm
|
||||
label-placement="left"
|
||||
:show-feedback="false"
|
||||
size="small"
|
||||
class="mt-3"
|
||||
>
|
||||
<span class="block font-semibold">{{ store.language.size }}</span>
|
||||
<NFormItem :label="store.language.width" class="mt-1">
|
||||
<NInputNumber
|
||||
v-model:value="setting.quickSearch.width"
|
||||
size="small"
|
||||
:min="0"
|
||||
class="w-full"
|
||||
placeholder=""
|
||||
:show-button="false"
|
||||
@update:value="updateQuickSearchWidth"
|
||||
></NInputNumber>
|
||||
</NFormItem>
|
||||
</NForm>
|
||||
<NForm
|
||||
label-placement="left"
|
||||
:show-feedback="false"
|
||||
@ -2121,6 +2140,12 @@ let quickSearchHistorySortOptions = ref([
|
||||
value: "openNumber",
|
||||
},
|
||||
]);
|
||||
// 快速搜索宽度更新
|
||||
function updateQuickSearchWidth(value: number | null) {
|
||||
if (value) {
|
||||
window.quickSearch.setWindowWidth(value);
|
||||
}
|
||||
}
|
||||
// 网络搜索模式
|
||||
let webSearchModeOptions = ref([
|
||||
{
|
||||
@ -2144,7 +2169,7 @@ let searchSourceName = ref<string | null>(null);
|
||||
let searchSourceURL = ref<string | null>(null);
|
||||
// 网络搜索源描述
|
||||
let searchSourceDescription = ref<string | null>(null);
|
||||
// 显示新增搜索源
|
||||
// 显示新增搜索源
|
||||
function showAddSearchSource() {
|
||||
searchSourceType.value = "add";
|
||||
searchSourceId.value = null;
|
||||
|
2
types/setting.d.ts
vendored
2
types/setting.d.ts
vendored
@ -182,6 +182,8 @@ export interface QuickSearch {
|
||||
openAfterHideQuickSearchWindow: boolean;
|
||||
// 匹配条件:备注
|
||||
matchConditionsRemark: boolean;
|
||||
// 宽度
|
||||
width: number;
|
||||
}
|
||||
|
||||
// 网络搜索
|
||||
|
Loading…
Reference in New Issue
Block a user