MCPcopy
hub / github.com/ZToolsCenter/ZTools / setEnabled

Method setEnabled

src/main/core/floatingBallManager.ts:315–335  ·  view source on GitHub ↗

* 设置悬浮球启用/禁用

(enabled: boolean)

Source from the content-addressed store, hash-verified

313 * 设置悬浮球启用/禁用
314 */
315 public async setEnabled(enabled: boolean): Promise<{ success: boolean }> {
316 this.enabled = enabled
317
318 if (enabled) {
319 this.createBallWindow()
320 } else {
321 this.destroyBallWindow()
322 }
323
324 // 保存到数据库
325 try {
326 const data = databaseAPI.dbGet('settings-general') || {}
327 data.floatingBallEnabled = enabled
328 databaseAPI.dbPut('settings-general', data)
329 console.log('[FloatingBall] 悬浮球已', enabled ? '启用' : '禁用')
330 } catch (error) {
331 console.error('[FloatingBall] 保存悬浮球设置失败:', error)
332 }
333
334 return { success: true }
335 }
336
337 /**
338 * 设置悬浮球显示文字

Callers 2

setupIPCMethod · 0.95
showContextMenuMethod · 0.95

Calls 4

createBallWindowMethod · 0.95
destroyBallWindowMethod · 0.95
dbGetMethod · 0.45
dbPutMethod · 0.45

Tested by

no test coverage detected