Skip to content

Commit fe1778f

Browse files
committed
新增:主界面进入插件默认隐藏搜索
1 parent 518afee commit fe1778f

4 files changed

Lines changed: 19 additions & 14 deletions

File tree

electron/config/tray.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@ import {AppsMain} from "../mapi/app/main";
99
let tray = null
1010

1111
const showApp = () => {
12-
// if (isMac) {
13-
// app.dock.show()
14-
// }
1512
AppRuntime.mainWindow.show()
13+
AppRuntime.mainWindow.focus()
1614
}
1715

1816
const hideApp = () => {

electron/mapi/manager/window/index.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,20 @@ export const ManagerWindow = {
256256
view.webContents.once('dom-ready', async () => {
257257
DevToolsManager.autoShow(view)
258258
});
259+
view.webContents.on('before-input-event', (event, input) => {
260+
// console.log('ManagerWindow.open.before-input-event', input)
261+
if (input.type === 'keyUp') {
262+
// exit when Escape key is pressed
263+
if (mainWindowView === view) {
264+
if (input.key === 'Escape') {
265+
if (mainWindowView) {
266+
ManagerWindow.close()
267+
AppRuntime.mainWindow.webContents.focus()
268+
}
269+
}
270+
}
271+
}
272+
})
259273
const windowOption = {
260274
width,
261275
height,
@@ -286,16 +300,6 @@ export const ManagerWindow = {
286300
if (autoDetach) {
287301
await this._showInDetachWindow(view, windowOption)
288302
} else {
289-
view.webContents.on('before-input-event', (event, input) => {
290-
if (input.type === 'keyUp') {
291-
if (input.key === 'Escape') {
292-
if (mainWindowView) {
293-
ManagerWindow.close()
294-
AppRuntime.mainWindow.webContents.focus()
295-
}
296-
}
297-
}
298-
})
299303
await this._showInMainWindow(view, windowOption)
300304
}
301305
// Log.info('open.PluginReady', JSON.stringify({readyData, action}))

src/pages/Main/MainSearch.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
</div>
6666
</div>
6767
<div v-else
68+
@dblclick="onSearchDoubleClick"
6869
class="main-search"></div>
6970
<div class="content-right"
7071
@click="doShowMenu">

src/pages/PageDetachWindow.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,9 @@ window.__page.onLeaveFullScreen(() => {
105105
isFullscreen.value = false
106106
console.log('onLeaveFullScreen')
107107
})
108-
108+
window.addEventListener('keydown', (e) => {
109+
console.log('PageDetachWindow.keydown', e)
110+
})
109111
</script>
110112

111113
<template>

0 commit comments

Comments
 (0)