From 87fc19248afa12eb89a3d1ca2dcbc4dd7ce51720 Mon Sep 17 00:00:00 2001 From: smartfridge <37928912+smartfrigde@users.noreply.github.com> Date: Sat, 1 May 2021 19:08:41 +0200 Subject: [PATCH] Update Readme, New ContextMenu stuff --- README.md | 7 +++- main.js | 1 + menu.js | 107 +++++++++++++++++++++++++++++++++++++++++++++++++++++ preload.js | 4 +- 4 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 menu.js diff --git a/README.md b/README.md index 1611070..e10018d 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,11 @@ Armcord is a custom Discord client for ARM Linux. It's goal is to bring a custom # To run this you need: nodejs, npm # How to run/install it? +Check releases tab for precompiled deb, rpm, tar.gz versions (arm64 only). +Alternative: 1.Run `npm install` 2.Run `npm start` -Alternative: Download pre-compiled version from releases tab. + # FAQ ## 1.Will I get banned from using it? @@ -14,4 +16,7 @@ Alternative: Download pre-compiled version from releases tab. ## 2.How does this work? -We are using official web app and adding GooseMod to it with some other tweaks. +## 3.Can I use this on other architectures or operating systems? + + -Yes! ArmCord should work normally under Windows, Mac OS, Linux as long as it has NodeJS, npm and Electron support. diff --git a/main.js b/main.js index 0876fa3..2bd9a3c 100644 --- a/main.js +++ b/main.js @@ -3,6 +3,7 @@ const { app, BrowserWindow, session } = require('electron') const path = require('path') require("v8-compile-cache"); let mainWindow +require("./menu.js") function createWindow() { mainWindow = new BrowserWindow({ diff --git a/menu.js b/menu.js new file mode 100644 index 0000000..832832f --- /dev/null +++ b/menu.js @@ -0,0 +1,107 @@ +const { app, Menu } = require("electron"); + +const isMac = process.platform === "darwin"; + +const template = [ + // { role: 'appMenu' } + ...(isMac + ? [ + { + label: app.name, + submenu: [ + { role: "about" }, + { type: "separator" }, + { role: "services" }, + { type: "separator" }, + { role: "hide" }, + { role: "hideothers" }, + { role: "unhide" }, + { type: "separator" }, + { role: "quit" }, + ], + }, + ] + : []), + // { role: 'fileMenu' } + { + label: "File", + submenu: [isMac ? { role: "close" } : { role: "quit" }], + }, + // { role: 'editMenu' } + { + label: "Edit", + submenu: [ + { role: "undo" }, + { role: "redo" }, + { type: "separator" }, + { role: "cut" }, + { role: "copy" }, + { role: "paste" }, + ...(isMac + ? [ + { role: "pasteAndMatchStyle" }, + { role: "delete" }, + { role: "selectAll" }, + { type: "separator" }, + { + label: "Speech", + submenu: [{ role: "startSpeaking" }, { role: "stopSpeaking" }], + }, + ] + : [{ role: "delete" }, { type: "separator" }, { role: "selectAll" }]), + ], + }, + // { role: 'viewMenu' } + { + label: "View", + submenu: [ + { role: "reload" }, + { role: "forceReload" }, + { role: "toggleDevTools" }, + { type: "separator" }, + { role: "resetZoom" }, + { role: "zoomIn" }, + { role: "zoomOut" }, + { type: "separator" }, + { role: "togglefullscreen" }, + ], + }, + // { role: 'windowMenu' } + { + label: "Window", + submenu: [ + { role: "minimize" }, + { role: "zoom" }, + ...(isMac + ? [ + { type: "separator" }, + { role: "front" }, + { type: "separator" }, + { role: "window" }, + ] + : [{ role: "close" }]), + ], + }, + { + role: "help", + submenu: [ + { + label: "Learn More", + click: async () => { + const { shell } = require("electron"); + await shell.openExternal("https://github.com/smartfrigde/armcord"); + }, + }, + { + label: "Support Server", + click: async () => { + const { shell } = require("electron"); + await shell.openExternal("https://discord.gg/F25bc4RYDt"); + }, + }, + ], + }, +]; + +const menu = Menu.buildFromTemplate(template); +Menu.setApplicationMenu(menu); diff --git a/preload.js b/preload.js index 62bdee0..2a5c1ff 100644 --- a/preload.js +++ b/preload.js @@ -3,8 +3,8 @@ const customTitlebar = require('custom-electron-titlebar') window.addEventListener('DOMContentLoaded', () => { new customTitlebar.Titlebar({ backgroundColor: customTitlebar.Color.fromHex("#2C2F33"), + titleHorizontalAlignment }); -}) - +}) \ No newline at end of file