Fix shortcuts to be only when app is focused

Other small fixes
This commit is contained in:
Aziz Hasanain 2021-02-12 14:13:17 +03:00
parent a0652e3c9b
commit 9a828a3c39
6 changed files with 44 additions and 12 deletions

View File

@ -24,6 +24,7 @@
"axios": "^0.21.1",
"core-js": "^3.6.5",
"electron-context-menu": "^2.3.1",
"electron-localshortcut": "^3.2.1",
"electron-store": "^6.0.1",
"electron-updater": "^4.3.5",
"feather-icons": "^4.28.0",

View File

@ -286,6 +286,10 @@ export default {
this.chats.splice(chatIndex, 1)
}
if (this.$route.path == '/message/'+chatData.address) {
chatData.read = true
}
this.chats.unshift(chatData)
}

View File

@ -1,12 +1,13 @@
'use strict'
import { app, protocol, BrowserWindow, ipcMain, Tray, Menu, globalShortcut } from 'electron'
import { app, protocol, BrowserWindow, ipcMain, Tray, Menu } from 'electron'
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
const isDevelopment = process.env.NODE_ENV !== 'production'
const path = require('path')
const contextMenu = require('electron-context-menu')
const { autoUpdater } = require('electron-updater')
const Store = require('electron-store')
const localShortcut = require('electron-localshortcut')
const AutoLaunch = require('auto-launch')
const persistentStore = new Store()
@ -298,7 +299,7 @@ function registerLocalAudioProtocol () {
function registerShortcuts () {
[1,2,3,4,5,6,7,8,9,'n'].forEach((key) => {
globalShortcut.register('CommandOrControl+'+key, () => {
localShortcut.register('CommandOrControl+'+key, () => {
win.webContents.send('navigateTo', key)
})
})

View File

@ -335,14 +335,15 @@ export default {
},
autoCompleteHooks () {
if (this.$route.params.id == 'new') {
var input = document.getElementsByClassName('autocomplete-input')[0]
if (input) {
input.focus()
input.addEventListener('input', (e) => {
this.receiver = ''
})
}
return
this.$nextTick(() => {
var input = document.getElementsByClassName('autocomplete-input')[0]
if (input) {
input.focus()
input.addEventListener('input', (e) => {
this.receiver = ''
})
}
})
}
},
autoCompleteInput (input) {

View File

@ -1,7 +1,7 @@
<template>
<transition name="fade">
<div class="modal" v-if="show">
<popover name="tunnel" event="click" transition="fade">{{ relayMessage }}</popover>
<popover name="tunnel" event="hover" transition="fade">{{ relayMessage }}</popover>
<div class="modal__backdrop" @click="closeModal()" :class="{ nostyle: !($store.state.macstyle || process.platform === 'darwin') }"/>
<div class="modal__dialog">

View File

@ -3775,7 +3775,7 @@ debug@^3.1.1, debug@^3.2.5:
dependencies:
ms "^2.1.1"
debug@^4.1.0, debug@^4.1.1, debug@^4.3.0:
debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.0:
version "4.3.1"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.1.tgz#f0d229c505e0c6d8c49ac553d1b13dc183f6b2ee"
integrity sha512-doEwdvm4PCeK4K3RQN2ZC2BYUBaxwLARCqZmMjtF8a51J2Rb0xpVloFRnCODwqjpwnAoao4pelN8l3RJdv3gRQ==
@ -4182,11 +4182,26 @@ electron-icon-builder@^2.0.1:
icon-gen "^2.0.0"
jimp "^0.16.1"
electron-is-accelerator@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/electron-is-accelerator/-/electron-is-accelerator-0.1.2.tgz#509e510c26a56b55e17f863a4b04e111846ab27b"
integrity sha1-UJ5RDCala1Xhf4Y6SwThEYRqsns=
electron-is-dev@^1.0.1:
version "1.2.0"
resolved "https://registry.yarnpkg.com/electron-is-dev/-/electron-is-dev-1.2.0.tgz#2e5cea0a1b3ccf1c86f577cee77363ef55deb05e"
integrity sha512-R1oD5gMBPS7PVU8gJwH6CtT0e6VSoD0+SzSnYpNm+dBkcijgA+K7VAMHDfnRq/lkKPZArpzplTW6jfiMYosdzw==
electron-localshortcut@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/electron-localshortcut/-/electron-localshortcut-3.2.1.tgz#cfc83a3eff5e28faf98ddcc87f80a2ce4f623cd3"
integrity sha512-DWvhKv36GsdXKnaFFhEiK8kZZA+24/yFLgtTwJJHc7AFgDjNRIBJZ/jq62Y/dWv9E4ypYwrVWN2bVrCYw1uv7Q==
dependencies:
debug "^4.0.1"
electron-is-accelerator "^0.1.0"
keyboardevent-from-electron-accelerator "^2.0.0"
keyboardevents-areequal "^0.2.1"
electron-log@^4.3.1:
version "4.3.1"
resolved "https://registry.yarnpkg.com/electron-log/-/electron-log-4.3.1.tgz#1405fef9d4e6964a5fdb8790a69163aa237ffe91"
@ -6352,6 +6367,16 @@ kew@^0.7.0:
resolved "https://registry.yarnpkg.com/kew/-/kew-0.7.0.tgz#79d93d2d33363d6fdd2970b335d9141ad591d79b"
integrity sha1-edk9LTM2PW/dKXCzNdkUGtWR15s=
keyboardevent-from-electron-accelerator@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/keyboardevent-from-electron-accelerator/-/keyboardevent-from-electron-accelerator-2.0.0.tgz#ace21b1aa4e47148815d160057f9edb66567c50c"
integrity sha512-iQcmNA0M4ETMNi0kG/q0h/43wZk7rMeKYrXP7sqKIJbHkTU8Koowgzv+ieR/vWJbOwxx5nDC3UnudZ0aLSu4VA==
keyboardevents-areequal@^0.2.1:
version "0.2.2"
resolved "https://registry.yarnpkg.com/keyboardevents-areequal/-/keyboardevents-areequal-0.2.2.tgz#88191ec738ce9f7591c25e9056de928b40277194"
integrity sha512-Nv+Kr33T0mEjxR500q+I6IWisOQ0lK1GGOncV0kWE6n4KFmpcu7RUX5/2B0EUtX51Cb0HjZ9VJsSY3u4cBa0kw==
keyv@^3.0.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/keyv/-/keyv-3.1.0.tgz#ecc228486f69991e49e9476485a5be1e8fc5c4d9"