From 0a617a2e3e4f87a9812a162c3f7668b455db3b42 Mon Sep 17 00:00:00 2001 From: AkiraFukushima Date: Sun, 4 Sep 2022 22:48:47 +0900 Subject: [PATCH] refs #3573 Temporary disable reload shortcut key --- src/main/index.ts | 10 +++++++++- .../components/TimelineSpace/Contents/Bookmarks.vue | 4 ++-- .../TimelineSpace/Contents/DirectMessages.vue | 4 ++-- .../components/TimelineSpace/Contents/Favourites.vue | 4 ++-- .../components/TimelineSpace/Contents/Hashtag/Tag.vue | 4 ++-- .../components/TimelineSpace/Contents/Home.vue | 4 ++-- .../components/TimelineSpace/Contents/Lists/Show.vue | 4 ++-- .../components/TimelineSpace/Contents/Local.vue | 4 ++-- .../components/TimelineSpace/Contents/Mentions.vue | 4 ++-- .../TimelineSpace/Contents/Notifications.vue | 4 ++-- .../components/TimelineSpace/Contents/Public.vue | 4 ++-- 11 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/main/index.ts b/src/main/index.ts index b2ba097d..63efc7e7 100644 --- a/src/main/index.ts +++ b/src/main/index.ts @@ -14,7 +14,8 @@ import { Notification, NotificationConstructorOptions, nativeTheme, - IpcMainInvokeEvent + IpcMainInvokeEvent, + globalShortcut } from 'electron' import Datastore from 'nedb' import { isEmpty } from 'lodash' @@ -451,6 +452,13 @@ app.on('activate', () => { } }) +app.on('browser-window-focus', () => { + // Disable reload + globalShortcut.register('CommandOrControl+R', () => { + console.log('CommandOrControl+R is pressed: Shortcut Disabled') + }) +}) + const auth = new Authentication(accountRepo) type AuthRequest = { diff --git a/src/renderer/components/TimelineSpace/Contents/Bookmarks.vue b/src/renderer/components/TimelineSpace/Contents/Bookmarks.vue index 6e09eff2..5d9c3c72 100644 --- a/src/renderer/components/TimelineSpace/Contents/Bookmarks.vue +++ b/src/renderer/components/TimelineSpace/Contents/Bookmarks.vue @@ -53,7 +53,7 @@ export default defineComponent({ const focusedId = ref(null) const heading = ref(true) const scroller = ref() - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const bookmarks = computed(() => store.state.TimelineSpace.Contents.Bookmarks.bookmarks) const lazyLoading = computed(() => store.state.TimelineSpace.Contents.Bookmarks.lazyLoading) @@ -97,7 +97,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/DirectMessages.vue b/src/renderer/components/TimelineSpace/Contents/DirectMessages.vue index 4c25cf8e..83df5647 100644 --- a/src/renderer/components/TimelineSpace/Contents/DirectMessages.vue +++ b/src/renderer/components/TimelineSpace/Contents/DirectMessages.vue @@ -55,7 +55,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const focusedId = ref(null) const scrollPosition = ref(null) @@ -143,7 +143,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Favourites.vue b/src/renderer/components/TimelineSpace/Contents/Favourites.vue index 01fa938c..a81d447d 100644 --- a/src/renderer/components/TimelineSpace/Contents/Favourites.vue +++ b/src/renderer/components/TimelineSpace/Contents/Favourites.vue @@ -51,7 +51,7 @@ export default defineComponent({ const heading = ref(false) const focusedId = ref(null) const scroller = ref() - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const openSideBar = computed(() => store.state.TimelineSpace.Contents.SideBar.openSideBar) const startReload = computed(() => store.state.TimelineSpace.HeaderMenu.reload) @@ -105,7 +105,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue b/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue index 25cf7305..dc6007d8 100644 --- a/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue +++ b/src/renderer/components/TimelineSpace/Contents/Hashtag/Tag.vue @@ -55,7 +55,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const { tag } = toRefs(props) const focusedId = ref(null) @@ -134,7 +134,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Home.vue b/src/renderer/components/TimelineSpace/Contents/Home.vue index 38f66ca4..b848ff25 100644 --- a/src/renderer/components/TimelineSpace/Contents/Home.vue +++ b/src/renderer/components/TimelineSpace/Contents/Home.vue @@ -63,7 +63,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const focusedId = ref(null) const scrollPosition = ref(null) @@ -175,7 +175,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue b/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue index 32ee62fb..cb7758a8 100644 --- a/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue +++ b/src/renderer/components/TimelineSpace/Contents/Lists/Show.vue @@ -51,7 +51,7 @@ export default defineComponent({ const space = 'TimelineSpace/Contents/Lists/Show' const store = useStore() const i18n = useI18next() - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const { list_id } = toRefs(props) const focusedId = ref(null) @@ -129,7 +129,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Local.vue b/src/renderer/components/TimelineSpace/Contents/Local.vue index 6be06541..c098aa7f 100644 --- a/src/renderer/components/TimelineSpace/Contents/Local.vue +++ b/src/renderer/components/TimelineSpace/Contents/Local.vue @@ -55,7 +55,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const focusedId = ref(null) const scrollPosition = ref(null) @@ -154,7 +154,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Mentions.vue b/src/renderer/components/TimelineSpace/Contents/Mentions.vue index 3e96f818..3a328ec6 100644 --- a/src/renderer/components/TimelineSpace/Contents/Mentions.vue +++ b/src/renderer/components/TimelineSpace/Contents/Mentions.vue @@ -62,7 +62,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const focusedId = ref(null) const scrollPosition = ref(null) @@ -156,7 +156,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Notifications.vue b/src/renderer/components/TimelineSpace/Contents/Notifications.vue index c593e901..8291fcac 100644 --- a/src/renderer/components/TimelineSpace/Contents/Notifications.vue +++ b/src/renderer/components/TimelineSpace/Contents/Notifications.vue @@ -61,7 +61,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const focusedId = ref(null) const scrollPosition = ref(null) @@ -161,7 +161,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() }) diff --git a/src/renderer/components/TimelineSpace/Contents/Public.vue b/src/renderer/components/TimelineSpace/Contents/Public.vue index 8adc28f9..534c4aa9 100644 --- a/src/renderer/components/TimelineSpace/Contents/Public.vue +++ b/src/renderer/components/TimelineSpace/Contents/Public.vue @@ -55,7 +55,7 @@ export default defineComponent({ const route = useRoute() const i18n = useI18next() const { reloadable } = useReloadable(store, route, i18n) - const { j, k, r } = useMagicKeys() + const { j, k, Ctrl_r } = useMagicKeys() const focusedId = ref(null) const scrollPosition = ref(null) @@ -155,7 +155,7 @@ export default defineComponent({ whenever(and(k, shortcutEnabled), () => { focusPrev() }) - whenever(and(r, shortcutEnabled), () => { + whenever(and(Ctrl_r, shortcutEnabled), () => { reload() })