Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.
TypeScript agentaiai-agentsall-in-onecrmcrm-systememaillinearmcpmessagingnotesnotionofficerustslackslack-alternativestartupstartup-toolstypescriptworkspace
import type { EmailThreadKeyboardHandlers } from '@app/features/email-thread/core/thread-keyboard';
import { t } from '@app/lib/i18n';
import { registerHotkey } from '@core/hotkey/hotkeys';
import { TOKENS } from '@core/hotkey/tokens';
export function registerEmailHotkeys(
scopeId: string,
handlers: EmailThreadKeyboardHandlers
) {
if (handlers.replyAllToFocusedMessage) {
registerHotkey({
hotkey: 'opt+r',
scopeId: scopeId,
description: 'Reply all to message',
keyDownHandler: handlers.replyAllToFocusedMessage,
hotkeyToken: TOKENS.email.replyAll,
displayPriority: 8,
});
}
registerHotkey({
hotkey: 'r',
scopeId: scopeId,
description: 'Reply to message',
keyDownHandler: handlers.replyToFocusedMessage,
hotkeyToken: TOKENS.email.reply,
displayPriority: 9,
});
if (handlers.createEvent) {
registerHotkey({
hotkey: 'b',
scopeId,
description: () => t('commands.createEventFromEmail'),
keyDownHandler: handlers.createEvent,
hotkeyToken: TOKENS.email.createEvent,
displayPriority: 7,
condition: handlers.canCreateEvent,
});
}
registerHotkey({
hotkey: 'f',
scopeId: scopeId,
description: 'Forward message',
keyDownHandler: handlers.forwardFocusedMessage,
hotkeyToken: TOKENS.email.forward,
displayPriority: 7,
});
registerHotkey({
hotkey: 'e',
scopeId,
description: 'Mark done',
// Mark done opens the next thread, so a held key would archive thread
// after thread; auto-repeat is ignored.
keyDownHandler: (event) => (event?.repeat ? true : handlers.markDone()),
hotkeyToken: TOKENS.entity.action.markDone,
displayPriority: 10,
condition: () => !handlers.isThreadDone(),
});
registerHotkey({
hotkey: 'shift+e',
scopeId,
description: 'Mark as not done',
keyDownHandler: (event) => (event?.repeat ? true : handlers.markNotDone()),
hotkeyToken: TOKENS.entity.action.markNotDone,
displayPriority: 10,
condition: () => handlers.isThreadDone() && handlers.canMarkNotDone(),
});
registerHotkey({
hotkey: 'u',
scopeId,
description: 'Mark as unread',
keyDownHandler: handlers.markUnread,
hotkeyToken: TOKENS.entity.action.markUnread,
displayPriority: 9,
condition: () => !handlers.isThreadMarkedUnread(),
});
registerHotkey({
hotkey: 'shift+u',
scopeId,
description: 'Mark as read',
keyDownHandler: handlers.markRead,
hotkeyToken: TOKENS.entity.action.markRead,
displayPriority: 9,
condition: () => handlers.isThreadMarkedUnread(),
});
registerHotkey({
scopeId: scopeId,
description: 'Block sender',
keyDownHandler: handlers.blockSender,
hotkeyToken: TOKENS.email.blockSender,
displayPriority: 5,
condition: () => handlers.canActOnSender(),
});
registerHotkey({
scopeId: scopeId,
description: 'Mark sender as Signal',
keyDownHandler: handlers.markSenderSignal,
hotkeyToken: TOKENS.email.markSenderSignal,
displayPriority: 5,
condition: () => handlers.canActOnSender(),
});
registerHotkey({
scopeId: scopeId,
description: 'Mark sender as Noise',
keyDownHandler: handlers.markSenderNoise,
hotkeyToken: TOKENS.email.markSenderNoise,
displayPriority: 5,
condition: () => handlers.canActOnSender(),
});
registerHotkey({
hotkey: ['arrowup', 'p'],
scopeId,
description: 'Previous message',
keyDownHandler: handlers.navigateToPreviousMessage,
hotkeyToken: TOKENS.email.previousMessage,
});
registerHotkey({
hotkey: ['arrowdown', 'n'],
scopeId,
description: 'Next message',
keyDownHandler: handlers.navigateToNextMessage,
hotkeyToken: TOKENS.email.nextMessage,
});
registerHotkey({
hotkey: 'o',
scopeId,
description: 'Expand or collapse message',
keyDownHandler: handlers.expandFocusedMessage,
hotkeyToken: TOKENS.email.expandMessage,
displayPriority: 6,
});
registerHotkey({
hotkey: 'shift+o',
scopeId,
description: 'Expand all messages',
keyDownHandler: handlers.expandAllMessages,
hotkeyToken: TOKENS.email.expandAllMessages,
displayPriority: 6,
});
}