mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
f57fe11769
* 2 new things (Read desc.) - Cleaned up ASAR packaging, ignoring unneeded files for building - Moved install location for Windows users ("AppData\Local\Programs" -> "AppData\Local" * 3 things (Read desc.) - Updated things related to Hummus (Hummus settings don't save nor load in it's respective settings window yet, idk why) - Added check for package version (ArmCord's internal version) - Made check for Kernel mod a bit cleaner, it still uses the same jank method * 3 things - Made macOS titlebar more accurate to Discord - Added "unFocused" class when window isn't focused - Added option to uninstall Husky hook for Windows users with reminder to run format script before committing * Resolved a dumb issue My dumbass not knowing the "echo" command existed smh * Made "precommit-fix" warning more noticable * Whoops * Fixed a CSS bug Discord updates are gonna hate us, huh? * 4 things (Formatted) - Updated coding for getting the current version - Updated some context menu and tray stuff - Added current version to the title of the settings window - Added the ability to restart the app within the settings * A few things - Updated tray menu to include the tray icon infront of the ArmCord version - Updated MacOS titlebar to not be broken in setup - Polished settings menu a bit - Polished the Discord tray icon - Added the Classic Discord icon as tray icon option
106 lines
3.8 KiB
TypeScript
106 lines
3.8 KiB
TypeScript
import {Menu, app, clipboard, globalShortcut} from "electron";
|
|
import {mainWindow} from "./window";
|
|
import {getConfig} from "./utils";
|
|
import {createSettingsWindow} from "./settings/main";
|
|
|
|
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("show", function () {
|
|
console.log("[Window state manager] Show");
|
|
mainWindow.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");
|
|
});
|
|
mainWindow.on("hide", function () {
|
|
console.log("[Window state manager] Hide");
|
|
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: "Open settings",
|
|
accelerator: "CmdOrCtrl+Shift+'",
|
|
click: function () {
|
|
createSettingsWindow();
|
|
}
|
|
},
|
|
{
|
|
label: "Reload",
|
|
accelerator: "CmdOrCtrl+R",
|
|
click: function () {
|
|
mainWindow.reload();
|
|
}
|
|
},
|
|
{
|
|
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"}
|
|
]
|
|
},
|
|
{
|
|
label: "Zoom",
|
|
submenu: [
|
|
{label: "Zoom in", accelerator: "CmdOrCtrl+Plus", role: "zoomIn"},
|
|
{label: "Zoom out", accelerator: "CmdOrCtrl+-", role: "zoomOut"}
|
|
]
|
|
}
|
|
];
|
|
|
|
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
|
|
}
|