Compare commits

...

5 commits

Author SHA1 Message Date
smartfridge
3e2efad943 Add alternative paste setting 2022-07-14 20:37:03 +02:00
smartfridge
a1f91d4d89 Redesign settings 2022-07-14 19:46:01 +02:00
smartfridge
c8e6855a02 Merge remote-tracking branch 'origin/dev' into dev 2022-07-14 17:26:10 +02:00
smartfridge
c933981420 Add fixes for pasting images using keyboard shortcuts 2022-07-14 17:25:59 +02:00
smartfridge
9f9b4deae9
Update issue templates 2022-07-14 17:12:04 +02:00
13 changed files with 2398 additions and 24 deletions

32
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View file

@ -0,0 +1,32 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Screenshots**
If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. Linux, Windows, macOS]
- Method of installation [e.g. snap, setup exe, aur]
- Version [e.g. 3.0.7]
**Additional context**
Add any other context about the problem here.

View file

@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.

View file

@ -8,6 +8,7 @@
"watch": "tsc -w",
"start": "npm run build && electron ./ts-out/main.js",
"package": "npm run build && electron-builder",
"packageQuick": "npm run build && electron-builder --dir",
"format": "prettier --write src/**/*",
"CIbuild": "npm run build && electron-builder --linux zip && electron-builder --windows zip && electron-builder --macos zip",
"postinstall": "husky install"
@ -26,7 +27,7 @@
"@types/node": "^17.0.42",
"@types/ws": "^8.5.3",
"copyfiles": "^2.4.1",
"electron": "^19.0.7",
"electron": "^19.0.8",
"electron-builder": "^23.0.3",
"husky": "^8.0.1",
"prettier": "^2.7.0",

2179
pnpm-lock.yaml Normal file

File diff suppressed because it is too large Load diff

View file

@ -66,14 +66,52 @@ body::-webkit-scrollbar-thumb {
}
.left {
float: right;
vertical-align: right !important;
}
p {
pointer-events: none;
user-select: none;
}
.switch {
vertical-align: middle;
border-radius: 10px;
background: var(--background-floating);
border: 20px;
border-color: var(--background-floating);
border-style: solid;
}
.header {
color: var(--header-primary);
font-size: 1.46em;
font-size: 1.5em;
position: relative;
bottom: 20px;
font-weight: bold;
}
.header2 {
color: var(--header-primary);
font-size: 1.5em;
position: relative;
bottom: 0px;
font-weight: bold;
}
.description2 {
position: relative;
color: white;
font-size: 1.2em;
font-weight: lighter;
bottom: 15px;
}
.description {
position: relative;
color: white;
font-size: 1.2em;
font-weight: lighter;
white-space: pre-line;
bottom: 40px;
}
.dropdown {
position: relative;
top: 40px !important;
font-size: 25px;
}
.center {
text-align: center;

View file

@ -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

View file

@ -6,7 +6,6 @@ import "./extensions/mods";
import "./extensions/plugin";
import "./tray";
import {createCustomWindow, createNativeWindow} from "./window";
import "./shortcuts";
export var settings: any;
export var customTitlebar: boolean;

63
src/menu.ts Normal file
View file

@ -0,0 +1,63 @@
import { Menu, app, clipboard, globalShortcut } from "electron";
import {mainWindow} from "./window";
import {getConfig} from "./utils";
function paste(contents: any) {
const contentTypes = clipboard.availableFormats().toString();
//Workaround: fix pasting the images.
if(contentTypes.includes('image/') && contentTypes.includes('text/html')) {
clipboard.writeImage(clipboard.readImage());
}
contents.paste();
}
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: [
{label: "About ArmCord", role: "about"},//orderFrontStandardAboutPanel
{type: "separator"},
{
label: "Developer tools", accelerator: "CmdOrCtrl+Shift+I", click: function () {
mainWindow.webContents.openDevTools()
}
},
{
label: "Quit", accelerator: "CmdOrCtrl+Q", click: function () {
app.quit();
}
}
]
}, {
label: "Edit",
submenu: [
{label: "Undo", accelerator: "CmdOrCtrl+Z", role: "undo"},
{label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", role: "redo"},
{type: "separator"},
{label: "Cut", accelerator: "CmdOrCtrl+X", role: "cut"},
{label: "Copy", accelerator: "CmdOrCtrl+C", role: "copy"},
{
label: "Paste", accelerator: "CmdOrCtrl+V", click: function () {
paste(mainWindow.webContents)
}
},
{label: "Select All", accelerator: "CmdOrCtrl+A", role: "selectAll"}
]
}
]
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
}

View file

@ -14,8 +14,8 @@ export function createSettingsWindow() {
}
} else {
settingsWindow = new BrowserWindow({
width: 500,
height: 555,
width: 660,
height: 670,
title: "ArmCord Settings",
darkTheme: true,
frame: true,

View file

@ -10,70 +10,109 @@
<body>
<div class="switch">
<select name="theme" id="theme" class="left">
<select name="theme" id="theme" class="left dropdown">
<option value="default">Default</option>
<option value="native">Native</option>
</select>
<p class="header" id="settings-theme">ArmCord theme:</p>
<p class="description">
ArmCord "themes" are basically behaviour packs.
<br />
<b>Default</b> - this is how ArmCord looks when you first launch it. It includes recreation of Discord's
custom titlebar and ArmCord specific styles injected into Discord.
<br />
<b>Native</b> - uses native titlebar of OS you're currently running (e.g Windows 7/10). Functions more
similar to actual Discord app.
</p>
</div>
<br />
<div class="switch">
<label class="header">ArmCord CSP</label>
<label class="header2">ArmCord CSP</label>
<input class="tgl tgl-light left" id="csp" type="checkbox" />
<label class="tgl-btn left" for="csp"></label>
<p class="description2">
ArmCord CSP is our system that manages loading custom content loading into the Discord app. Stuff like
client mods and themes depend on it. Disable if you want to get rid of mods and custom styles.
</p>
</div>
<br />
<div class="switch">
<label class="header" id="settings-tray">Minimize to tray</label>
<label class="header2" id="settings-tray">Minimize to tray</label>
<input class="tgl tgl-light left" id="tray" type="checkbox" />
<label class="tgl-btn left" for="tray"></label>
<p class="description2">
If enabled, when you close the Discord window, ArmCord will sit back and relax in your system tray.
Otherwise it'll shutdown completely.
</p>
</div>
<br />
<div class="switch">
<label class="header" id="settings-patches">Automatic Patches</label>
<label class="header2" id="settings-patches">Automatic Patches</label>
<input class="tgl tgl-light left" id="patches" type="checkbox" />
<label class="tgl-btn left" for="patches"></label>
<p class="description2">
Fetches automatic patches that are distributed if release turns out to have bugs after release. Usually
you don't have to keep this enabled, unless notified in support Discord.
</p>
</div>
<br />
<div class="switch">
<label class="header" id="settings-invitewebsocket">Invite Websocket</label>
<label class="header2" id="settings-invitewebsocket">Invite Websocket</label>
<input class="tgl tgl-light left" id="websocket" type="checkbox" />
<label class="tgl-btn left" for="websocket"></label>
<p class="description2">short description, describing this great feature</p>
</div>
<br />
<div class="switch">
<label class="header" id="settings-mobileMode">Mobile mode</label>
<label class="header2" id="settings-mobileMode">Mobile mode</label>
<input class="tgl tgl-light left" id="mobile" type="checkbox" />
<label class="tgl-btn left" for="mobile"></label>
<p class="description2">short description, describing this great feature</p>
</div>
<br />
<div class="switch">
<select name="channel" id="channel" class="left">
<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">
<select name="channel" id="channel" class="left dropdown">
<option value="stable">Stable</option>
<option value="canary">Canary</option>
<option value="ptb">PTB</option>
<option value="hummus">Hummus (unofficial)</option>
</select>
<p class="header" id="settings-channel">Discord channel:</p>
<div>
<p class="header" id="settings-channel">Discord channel:</p>
<p class="description">short description, describing this great feature</p>
</div>
</div>
<br />
<div class="switch">
<select name="mod" id="mod" class="left">
<select name="mod" id="mod" class="left dropdown">
<option value="cumcord">Cumcord</option>
<option value="goosemod">GooseMod</option>
<option value="flicker">Flicker</option>
<option value="none">None</option>
</select>
<p class="header" id="settings-mod">Client mod:</p>
<p class="description">short description, describing this great feature</p>
</div>
<br />
<div class="switch">
<select name="prfmMode" id="prfmMode" class="left">
<select name="prfmMode" id="prfmMode" class="left dropdown">
<option value="performance">Performance</option>
<option value="battery">Battery</option>
<option value="none">None</option>
</select>
<p class="header" id="settings-prfmMode">Performance mode:</p>
<p class="description">short description, describing this great feature</p>
</div>
<br />
<div class="switch">
<select name="trayIcon" id="trayIcon" class="left">
<select name="trayIcon" id="trayIcon" class="left dropdown">
<option value="ac_plug_colored">Default</option>
<option value="dsc-tray">Discord Icon</option>
<option value="ac_white_plug">White Icon</option>
@ -82,6 +121,7 @@
<option value="ac_black_plug_hollow">Black Hollowed Icon</option>
</select>
<p class="header" id="settings-trayIcon">Tray icon:</p>
<p class="description">short description, describing this great feature</p>
</div>
<button id="settings-save" class="center">Save Settings</button>
</body>
@ -114,6 +154,7 @@
document.getElementById("csp").checked = await settings.get("armcordCSP");
document.getElementById("tray").checked = await settings.get("minimizeToTray");
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("patches").value = await settings.get("automaticPatches");
document.getElementById("mod").value = await settings.get("mods");
@ -129,6 +170,7 @@
channel: document.getElementById("channel").value,
armcordCSP: document.getElementById("csp").checked,
minimizeToTray: document.getElementById("tray").checked,
alternativePaste: document.getElementById("alternativePaste").checked,
automaticPatches: document.getElementById("patches").checked,
mods: document.getElementById("mod").value,
mobileMode: document.getElementById("mobile").checked,

View file

@ -1,5 +0,0 @@
import {app} from "electron";
import {mainWindow} from "./window";
//https://github.com/electron/electron/issues/1334#issuecomment-716080005
// TO-DO add more

View file

@ -39,6 +39,7 @@ export function setup() {
armcordCSP: true,
minimizeToTray: true,
automaticPatches: false,
alternativePaste: false,
mods: "cumcord",
performanceMode: "none",
inviteWebsocket: true,
@ -182,6 +183,7 @@ export interface Settings {
armcordCSP: boolean;
minimizeToTray: boolean;
automaticPatches: boolean;
alternativePaste: boolean;
mods: string;
mobileMode: boolean,
performanceMode: string;

View file

@ -6,6 +6,7 @@ import { BrowserWindow, shell, app, dialog } from "electron";
import path from "path";
import { checkIfConfigIsBroken, firstRun, getConfig, contentPath, setConfig, setLang, setWindowState } from "./utils";
import { registerIpc } from "./ipc";
import { setMenu } from "./menu";
import * as fs from "fs";
import startServer from "./socket";
import contextMenu from "electron-context-menu";
@ -94,7 +95,7 @@ async function doAfterDefiningTheWindow() {
}
});
});
setMenu()
mainWindow.on("close", async (e) => {
let [width, height] = mainWindow.getSize()
setWindowState({