mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2024-11-30 18:24:27 +01:00
fix: 🐛 Search for shortcut key conflicts
This commit is contained in:
parent
7116af28fd
commit
c70e6ca2fc
@ -1,13 +1,12 @@
|
||||
import { globalShortcut } from 'electron'
|
||||
// import { globalShortcut } from 'electron'
|
||||
|
||||
export default (mainWindow) => {
|
||||
mainWindow.on('focus', () => {
|
||||
globalShortcut.register('CommandOrControl+F', (event) => {
|
||||
mainWindow.webContents.send('focus-on-search')
|
||||
})
|
||||
})
|
||||
|
||||
mainWindow.on('blur', () => {
|
||||
globalShortcut.unregister('CommandOrControl+F')
|
||||
})
|
||||
// mainWindow.on('focus', () => {
|
||||
// globalShortcut.register('CommandOrControl+F', (event) => {
|
||||
// mainWindow.webContents.send('focus-on-search')
|
||||
// })
|
||||
// })
|
||||
// mainWindow.on('blur', () => {
|
||||
// globalShortcut.unregister('CommandOrControl+F')
|
||||
// })
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
"@unocss/transformer-directives": "^0.59.4",
|
||||
"@viarotel-org/unocss-preset-shades": "^0.8.2",
|
||||
"@vitejs/plugin-vue": "^5.0.4",
|
||||
"@vueuse/core": "^10.9.0",
|
||||
"dayjs": "^1.11.11",
|
||||
"electron": "^30.0.3",
|
||||
"electron-builder": "^24.13.3",
|
||||
|
@ -15,24 +15,20 @@
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
import { useMagicKeys, whenever } from '@vueuse/core'
|
||||
|
||||
import { useThemeStore } from '$/store/theme/index.js'
|
||||
|
||||
const themeStore = useThemeStore()
|
||||
|
||||
const activeTab = inject('activeTab')
|
||||
|
||||
const shortcutTip = `${
|
||||
window.electron.process.platform === 'darwin' ? 'Command' : 'Ctrl'
|
||||
} + F`
|
||||
const shortcutTip = 'Ctrl + F'
|
||||
|
||||
watch([() => themeStore.value, () => activeTab.value], () => {
|
||||
closeSearchModal()
|
||||
})
|
||||
|
||||
window.electron.ipcRenderer.on('focus-on-search', (event, ret) => {
|
||||
openSearchModal()
|
||||
})
|
||||
|
||||
function openSearchModal() {
|
||||
window.findInPageModal.open({ isDark: themeStore.isDark })
|
||||
}
|
||||
@ -40,6 +36,12 @@ function openSearchModal() {
|
||||
function closeSearchModal() {
|
||||
window.findInPageModal.close()
|
||||
}
|
||||
|
||||
const { ctrl_f } = useMagicKeys()
|
||||
|
||||
whenever(ctrl_f, () => {
|
||||
openSearchModal()
|
||||
})
|
||||
</script>
|
||||
|
||||
<style lang="postcss"></style>
|
||||
|
Loading…
Reference in New Issue
Block a user