From 168add044b6524bfea6953f9b27b93bc79821716 Mon Sep 17 00:00:00 2001 From: Vanboom Date: Wed, 3 Jun 2026 14:28:38 -0500 Subject: [PATCH 1/2] Address issue #363, implement CTRL+M hotkey to access the macro dialog directly --- .../main/src/features/command/CommandBox.vue | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/frontend/apps/main/src/features/command/CommandBox.vue b/frontend/apps/main/src/features/command/CommandBox.vue index edda8ea9..3de4e2bb 100644 --- a/frontend/apps/main/src/features/command/CommandBox.vue +++ b/frontend/apps/main/src/features/command/CommandBox.vue @@ -299,6 +299,23 @@ const { Meta_K, Ctrl_K } = useMagicKeys({ }) watch([Meta_K, Ctrl_K], ([mac, win]) => { + setNestedCommand(null) + if (mac || win) toggleOpen() +}) + +const { Meta_M, Ctrl_M } = useMagicKeys({ + passive: false, + onEventFired(e) { + if (e.key === 'm' && (e.metaKey || e.ctrlKey)) { + e.preventDefault() + } + } +}) + +watch([Meta_M, Ctrl_M], ([mac, win]) => { + if (nestedCommand.value != 'apply-macro-to-new-conversation') { + setNestedCommand('apply-macro-to-existing-conversation') + } if (mac || win) toggleOpen() }) @@ -338,9 +355,10 @@ const otherActions = computed( ) function toggleOpen() { - if (nestedCommand.value != 'apply-macro-to-new-conversation' && !open.value) { - nestedCommand.value = null - } + // Allow it to be set from the outside + // if (nestedCommand.value != 'apply-macro-to-new-conversation' && !open.value) { + // nestedCommand.value = null + // } open.value = !open.value } From 4f4bbbef5fa0cb090b203e2354e3c8d5f3c2c589 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Sat, 6 Jun 2026 21:02:25 +0530 Subject: [PATCH 2/2] Fix macro context lost via Ctrl+K and stale macro filter after new conversation --- .../main/src/features/command/CommandBox.vue | 36 +++++++++---------- .../conversation/CreateConversation.vue | 3 ++ frontend/apps/main/src/stores/macro.js | 1 + 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/frontend/apps/main/src/features/command/CommandBox.vue b/frontend/apps/main/src/features/command/CommandBox.vue index 3de4e2bb..75df8ed4 100644 --- a/frontend/apps/main/src/features/command/CommandBox.vue +++ b/frontend/apps/main/src/features/command/CommandBox.vue @@ -289,34 +289,38 @@ const visibleMacros = computed(() => { return matched }) -const { Meta_K, Ctrl_K } = useMagicKeys({ - passive: false, - onEventFired(e) { - if (e.key === 'k' && (e.metaKey || e.ctrlKey)) { +function preventDefaultOnHotkey(key) { + return (e) => { + if (e.key === key && (e.metaKey || e.ctrlKey)) { e.preventDefault() } } +} + +const { Meta_K, Ctrl_K } = useMagicKeys({ + passive: false, + onEventFired: preventDefaultOnHotkey('k') }) watch([Meta_K, Ctrl_K], ([mac, win]) => { - setNestedCommand(null) - if (mac || win) toggleOpen() + if (mac || win) { + if (nestedCommand.value !== 'apply-macro-to-new-conversation') setNestedCommand(null) + toggleOpen() + } }) const { Meta_M, Ctrl_M } = useMagicKeys({ passive: false, - onEventFired(e) { - if (e.key === 'm' && (e.metaKey || e.ctrlKey)) { - e.preventDefault() - } - } + onEventFired: preventDefaultOnHotkey('m') }) watch([Meta_M, Ctrl_M], ([mac, win]) => { - if (nestedCommand.value != 'apply-macro-to-new-conversation') { - setNestedCommand('apply-macro-to-existing-conversation') + if (mac || win) { + if (nestedCommand.value !== 'apply-macro-to-new-conversation') { + setNestedCommand('apply-macro-to-existing-conversation') + } + toggleOpen() } - if (mac || win) toggleOpen() }) const highlightedMacro = ref(null) @@ -355,10 +359,6 @@ const otherActions = computed( ) function toggleOpen() { - // Allow it to be set from the outside - // if (nestedCommand.value != 'apply-macro-to-new-conversation' && !open.value) { - // nestedCommand.value = null - // } open.value = !open.value } diff --git a/frontend/apps/main/src/features/conversation/CreateConversation.vue b/frontend/apps/main/src/features/conversation/CreateConversation.vue index 50c9a752..2b3c4544 100644 --- a/frontend/apps/main/src/features/conversation/CreateConversation.vue +++ b/frontend/apps/main/src/features/conversation/CreateConversation.vue @@ -321,6 +321,7 @@ const emailQuery = ref('') const conversationStore = useConversationStore() const macroStore = useMacroStore() let timeoutId = null +let previousMacroView = '' const insertContent = ref('') const selectedContact = ref(null) const emailInputRef = ref(null) @@ -367,6 +368,7 @@ onUnmounted(() => { clearTimeout(timeoutId) clearMediaFiles() conversationStore.resetMacro(MACRO_CONTEXT.NEW_CONVERSATION) + macroStore.setCurrentView(previousMacroView) emitter.emit(EMITTER_EVENTS.SET_NESTED_COMMAND, { command: null, open: false @@ -374,6 +376,7 @@ onUnmounted(() => { }) onMounted(() => { + previousMacroView = macroStore.currentView macroStore.setCurrentView('starting_conversation') emitter.emit(EMITTER_EVENTS.SET_NESTED_COMMAND, { command: 'apply-macro-to-new-conversation', diff --git a/frontend/apps/main/src/stores/macro.js b/frontend/apps/main/src/stores/macro.js index d1161a1f..39a6e1dc 100644 --- a/frontend/apps/main/src/stores/macro.js +++ b/frontend/apps/main/src/stores/macro.js @@ -81,6 +81,7 @@ export const useMacroStore = defineStore('macroStore', () => { return { macroList, macroOptions, + currentView, loadMacros, setCurrentView }