Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Add a custom shortcut for Paste and Match style

Hakan Shehu233c846b72cc
diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts
index 9d9b9115..b2d53215 100644
--- a/apps/desktop/src/main.ts
+++ b/apps/desktop/src/main.ts
@@ -2,7 +2,14 @@ import started from 'electron-squirrel-startup';
import { updateElectronApp, UpdateSourceType } from 'update-electron-app';
import { createDebugger } from '@colanode/core';
-import { app, BrowserWindow, ipcMain, protocol, shell } from 'electron';
+import {
+ app,
+ BrowserWindow,
+ ipcMain,
+ protocol,
+ shell,
+ globalShortcut,
+} from 'electron';
import path from 'path';
import { mediator } from '@/main/mediator';
@@ -109,10 +116,6 @@ const createWindow = async () => {
}
});
- mainWindow.on('close', () => {
- eventBus.unsubscribe(subscriptionId);
- });
-
if (!protocol.isProtocolHandled('avatar')) {
protocol.handle('avatar', (request) => {
return handleAvatarRequest(request);
@@ -142,6 +145,15 @@ const createWindow = async () => {
return { action: 'deny' }; // Prevent default new-window behavior
});
+ globalShortcut.register('CommandOrControl+Shift+V', () => {
+ mainWindow.webContents.pasteAndMatchStyle();
+ });
+
+ mainWindow.on('close', () => {
+ eventBus.unsubscribe(subscriptionId);
+ globalShortcut.unregister('CommandOrControl+Shift+V');
+ });
+
debug('Window created');
};