mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Add alternative paste setting
This commit is contained in:
parent
a1f91d4d89
commit
3e2efad943
4 changed files with 34 additions and 9 deletions
|
@ -116,8 +116,8 @@
|
||||||
windowStyle: "default",
|
windowStyle: "default",
|
||||||
channel: "stable",
|
channel: "stable",
|
||||||
armcordCSP: true,
|
armcordCSP: true,
|
||||||
autoLaunch: true,
|
|
||||||
minimizeToTray: true,
|
minimizeToTray: true,
|
||||||
|
alternativePaste: false,
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
inviteWebsocket: true,
|
inviteWebsocket: true,
|
||||||
|
@ -153,6 +153,7 @@
|
||||||
mobileMode: false,
|
mobileMode: false,
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
|
alternativePaste: false,
|
||||||
trayIcon: "ac_plug_colored",
|
trayIcon: "ac_plug_colored",
|
||||||
mods: options.mod,
|
mods: options.mod,
|
||||||
inviteWebsocket: true
|
inviteWebsocket: true
|
||||||
|
@ -168,6 +169,7 @@
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
mobileMode: false,
|
mobileMode: false,
|
||||||
mods: "none",
|
mods: "none",
|
||||||
|
alternativePaste: false,
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
trayIcon: "ac_plug_colored",
|
trayIcon: "ac_plug_colored",
|
||||||
inviteWebsocket: true
|
inviteWebsocket: true
|
||||||
|
|
28
src/menu.ts
28
src/menu.ts
|
@ -1,5 +1,6 @@
|
||||||
import { Menu, app, clipboard, globalShortcut } from "electron";
|
import { Menu, app, clipboard, globalShortcut } from "electron";
|
||||||
import {mainWindow} from "./window";
|
import {mainWindow} from "./window";
|
||||||
|
import {getConfig} from "./utils";
|
||||||
|
|
||||||
function paste(contents: any) {
|
function paste(contents: any) {
|
||||||
const contentTypes = clipboard.availableFormats().toString();
|
const contentTypes = clipboard.availableFormats().toString();
|
||||||
|
@ -9,12 +10,21 @@ function paste(contents: any) {
|
||||||
}
|
}
|
||||||
contents.paste();
|
contents.paste();
|
||||||
}
|
}
|
||||||
export function setMenu() {
|
export async function setMenu() {
|
||||||
globalShortcut.register("CmdOrCtrl+V", function () {
|
if (await getConfig("alternativePaste") == true) {
|
||||||
if (mainWindow.isFocused()) {
|
mainWindow.on("focus", function () {
|
||||||
paste(mainWindow.webContents)
|
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[] = [{
|
var template: Electron.MenuItemConstructorOptions[] = [{
|
||||||
label: "ArmCord",
|
label: "ArmCord",
|
||||||
submenu: [
|
submenu: [
|
||||||
|
@ -39,9 +49,11 @@ export function setMenu() {
|
||||||
{type: "separator"},
|
{type: "separator"},
|
||||||
{label: "Cut", accelerator: "CmdOrCtrl+X", role: "cut"},
|
{label: "Cut", accelerator: "CmdOrCtrl+X", role: "cut"},
|
||||||
{label: "Copy", accelerator: "CmdOrCtrl+C", role: "copy"},
|
{label: "Copy", accelerator: "CmdOrCtrl+C", role: "copy"},
|
||||||
{label: "Paste", accelerator: "CmdOrCtrl+V", click: function () {
|
{
|
||||||
|
label: "Paste", accelerator: "CmdOrCtrl+V", click: function () {
|
||||||
paste(mainWindow.webContents)
|
paste(mainWindow.webContents)
|
||||||
}},
|
}
|
||||||
|
},
|
||||||
{label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"}
|
{label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,13 @@
|
||||||
<p class="description2">short description, describing this great feature</p>
|
<p class="description2">short description, describing this great feature</p>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
<div class="switch">
|
||||||
|
<label class="header2" id="settings-alternativePaste">Alternative paste</label>
|
||||||
|
<input class="tgl tgl-light left" id="alternativePaste" type="checkbox" />
|
||||||
|
<label class="tgl-btn left" for="alternativePaste"></label>
|
||||||
|
<p class="description2">to be used on gnome DE or when accelerator doesn't work on platform of choice</p>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
<div class="switch">
|
<div class="switch">
|
||||||
<select name="channel" id="channel" class="left dropdown">
|
<select name="channel" id="channel" class="left dropdown">
|
||||||
<option value="stable">Stable</option>
|
<option value="stable">Stable</option>
|
||||||
|
@ -147,6 +154,7 @@
|
||||||
document.getElementById("csp").checked = await settings.get("armcordCSP");
|
document.getElementById("csp").checked = await settings.get("armcordCSP");
|
||||||
document.getElementById("tray").checked = await settings.get("minimizeToTray");
|
document.getElementById("tray").checked = await settings.get("minimizeToTray");
|
||||||
document.getElementById("websocket").checked = await settings.get("inviteWebsocket");
|
document.getElementById("websocket").checked = await settings.get("inviteWebsocket");
|
||||||
|
document.getElementById("alternativePaste").checked = await settings.get("alternativePaste");
|
||||||
document.getElementById("mobile").checked = await settings.get("mobileMode");
|
document.getElementById("mobile").checked = await settings.get("mobileMode");
|
||||||
document.getElementById("patches").value = await settings.get("automaticPatches");
|
document.getElementById("patches").value = await settings.get("automaticPatches");
|
||||||
document.getElementById("mod").value = await settings.get("mods");
|
document.getElementById("mod").value = await settings.get("mods");
|
||||||
|
@ -162,6 +170,7 @@
|
||||||
channel: document.getElementById("channel").value,
|
channel: document.getElementById("channel").value,
|
||||||
armcordCSP: document.getElementById("csp").checked,
|
armcordCSP: document.getElementById("csp").checked,
|
||||||
minimizeToTray: document.getElementById("tray").checked,
|
minimizeToTray: document.getElementById("tray").checked,
|
||||||
|
alternativePaste: document.getElementById("alternativePaste").checked,
|
||||||
automaticPatches: document.getElementById("patches").checked,
|
automaticPatches: document.getElementById("patches").checked,
|
||||||
mods: document.getElementById("mod").value,
|
mods: document.getElementById("mod").value,
|
||||||
mobileMode: document.getElementById("mobile").checked,
|
mobileMode: document.getElementById("mobile").checked,
|
||||||
|
|
|
@ -39,6 +39,7 @@ export function setup() {
|
||||||
armcordCSP: true,
|
armcordCSP: true,
|
||||||
minimizeToTray: true,
|
minimizeToTray: true,
|
||||||
automaticPatches: false,
|
automaticPatches: false,
|
||||||
|
alternativePaste: false,
|
||||||
mods: "cumcord",
|
mods: "cumcord",
|
||||||
performanceMode: "none",
|
performanceMode: "none",
|
||||||
inviteWebsocket: true,
|
inviteWebsocket: true,
|
||||||
|
@ -182,6 +183,7 @@ export interface Settings {
|
||||||
armcordCSP: boolean;
|
armcordCSP: boolean;
|
||||||
minimizeToTray: boolean;
|
minimizeToTray: boolean;
|
||||||
automaticPatches: boolean;
|
automaticPatches: boolean;
|
||||||
|
alternativePaste: boolean;
|
||||||
mods: string;
|
mods: string;
|
||||||
mobileMode: boolean,
|
mobileMode: boolean,
|
||||||
performanceMode: string;
|
performanceMode: string;
|
||||||
|
|
Loading…
Reference in a new issue