diff --git a/src/content/setup.html b/src/content/setup.html index a0f8540..9a00dd0 100644 --- a/src/content/setup.html +++ b/src/content/setup.html @@ -116,8 +116,8 @@ windowStyle: "default", channel: "stable", armcordCSP: true, - autoLaunch: true, minimizeToTray: true, + alternativePaste: false, automaticPatches: false, mods: "cumcord", inviteWebsocket: true, @@ -153,6 +153,7 @@ mobileMode: false, automaticPatches: false, performanceMode: "none", + alternativePaste: false, trayIcon: "ac_plug_colored", mods: options.mod, inviteWebsocket: true @@ -168,6 +169,7 @@ automaticPatches: false, mobileMode: false, mods: "none", + alternativePaste: false, performanceMode: "none", trayIcon: "ac_plug_colored", inviteWebsocket: true diff --git a/src/menu.ts b/src/menu.ts index 0acf2b1..9ca3962 100644 --- a/src/menu.ts +++ b/src/menu.ts @@ -1,5 +1,6 @@ import { Menu, app, clipboard, globalShortcut } from "electron"; import {mainWindow} from "./window"; +import {getConfig} from "./utils"; function paste(contents: any) { const contentTypes = clipboard.availableFormats().toString(); @@ -9,12 +10,21 @@ function paste(contents: any) { } contents.paste(); } -export function setMenu() { - globalShortcut.register("CmdOrCtrl+V", function () { - if (mainWindow.isFocused()) { - paste(mainWindow.webContents) - } - }) +export async function setMenu() { + if (await getConfig("alternativePaste") == true) { + mainWindow.on("focus", function () { + console.log("[Window state manager] Focus") + globalShortcut.register("CmdOrCtrl+V", function () { + if (mainWindow.isFocused()) { + paste(mainWindow.webContents) + } + }) + }) + mainWindow.on("blur", function () { + console.log("[Window state manager] Defocus") + globalShortcut.unregister("CmdOrCtrl+V") + }) + } var template: Electron.MenuItemConstructorOptions[] = [{ label: "ArmCord", submenu: [ @@ -39,9 +49,11 @@ export function setMenu() { {type: "separator"}, {label: "Cut", accelerator: "CmdOrCtrl+X", role: "cut"}, {label: "Copy", accelerator: "CmdOrCtrl+C", role: "copy"}, - {label: "Paste", accelerator: "CmdOrCtrl+V", click: function () { + { + label: "Paste", accelerator: "CmdOrCtrl+V", click: function () { paste(mainWindow.webContents) - }}, + } + }, {label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"} ] } diff --git a/src/settings/settings.html b/src/settings/settings.html index 2cb458e..9d2ee2d 100644 --- a/src/settings/settings.html +++ b/src/settings/settings.html @@ -70,6 +70,13 @@

short description, describing this great feature


+
+ + + +

to be used on gnome DE or when accelerator doesn't work on platform of choice

+
+