Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ const windowDefaultHeight = ref(541)

// 托盘图标显示设置
const showTrayIcon = ref(true)
// 静默启动:开启后启动时不显示搜索窗口(默认)
const silentStart = ref(true)

// 悬浮球设置
const floatingBallEnabled = ref(false)
Expand Down Expand Up @@ -953,6 +955,16 @@ async function handleTrayIconChange(): Promise<void> {
}
}

// 处理静默启动变化
async function handleSilentStartChange(): Promise<void> {
try {
await saveSettings()
console.log('静默启动设置已更新:', silentStart.value)
} catch (error) {
console.error('更新静默启动设置失败:', error)
}
}

// 处理悬浮球开关变化
async function handleFloatingBallChange(): Promise<void> {
try {
Expand Down Expand Up @@ -1198,6 +1210,7 @@ async function loadSettings(): Promise<void> {
windowDefaultHeight.value = data.windowDefaultHeight ?? 541
hotkey.value = data.hotkey ?? defaultHotkey.value
showTrayIcon.value = data.showTrayIcon ?? true
silentStart.value = data.silentStart ?? true
placeholder.value = data.placeholder ?? DEFAULT_PLACEHOLDER
avatar.value = data.avatar ?? DEFAULT_AVATAR
autoPaste.value = data.autoPaste ?? '3s'
Expand Down Expand Up @@ -1318,6 +1331,7 @@ async function saveSettings(): Promise<void> {
primaryColor: primaryColor.value,
customColor: customColor.value,
showTrayIcon: showTrayIcon.value,
silentStart: silentStart.value,
windowMaterial: windowMaterial.value,
acrylicLightOpacity: acrylicLightOpacity.value,
acrylicDarkOpacity: acrylicDarkOpacity.value,
Expand Down Expand Up @@ -1430,6 +1444,19 @@ onUnmounted(() => {
</div>
</div>

<div class="setting-item">
<div class="setting-label">
<span>静默启动</span>
<span class="setting-desc">开启后启动时不显示主窗口,仅在系统托盘运行(默认开启)</span>
</div>
<div class="setting-control">
<label class="toggle">
<input v-model="silentStart" type="checkbox" @change="handleSilentStartChange" />
<span class="toggle-slider"></span>
</label>
</div>
</div>

<div class="setting-item blocked-apps-setting">
<div class="blocked-apps-content">
<div class="blocked-apps-header">
Expand Down
13 changes: 13 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,19 @@ app.whenReady().then(async () => {
}
}

// 检查静默启动设置,未开启时启动后自动显示搜索窗口
try {
const settingsDoc = lmdbInstance.get('ZTOOLS/settings-general')
const silentStart = settingsDoc?.data?.silentStart ?? true
if (!silentStart) {
setTimeout(() => {
windowManager.showWindow()
console.log('[Main] 静默启动已关闭,启动后自动显示搜索窗口')
}, 500)
}
} catch {
console.log('[Main] 读取静默启动设置失败,按默认行为启动')
}
// 处理文件关联打开:macOS pending 文件 / Windows 命令行参数
const zpxFromArgs =
pendingZpxFile || process.argv.find((arg) => arg.endsWith('.zpx') && !arg.startsWith('-'))
Expand Down