iconformat depending on os

This commit is contained in:
smartfridge 2021-05-08 16:52:23 +02:00
parent ce7699bb4c
commit 83219fb8d3

12
main.js
View file

@ -2,9 +2,17 @@
const { app, BrowserWindow, session, Tray, Menu } = require("electron"); const { app, BrowserWindow, session, Tray, Menu } = require("electron");
const path = require("path"); const path = require("path");
const contextMenu = require("electron-context-menu"); const contextMenu = require("electron-context-menu");
const os = require("os");
require("v8-compile-cache"); require("v8-compile-cache");
require("./utils/updater"); require("./utils/updater");
if (os.type() == 'Linux'){
var iconformat = __dirname + "/discord.png"
} else {
console.log("Running Non-Linux")
var iconformat = __dirname + "/discord.ico";
}
contextMenu({ contextMenu({
prepend: (defaultActions, parameters, browserWindow) => [ prepend: (defaultActions, parameters, browserWindow) => [
{ {
@ -21,7 +29,7 @@ function createWindow() {
mainWindow = new BrowserWindow({ mainWindow = new BrowserWindow({
width: 800, width: 800,
height: 600, height: 600,
icon: __dirname + "/discord.ico", icon: iconformat,
title: "ArmCord", title: "ArmCord",
frame: false, frame: false,
webPreferences: { webPreferences: {
@ -31,7 +39,7 @@ function createWindow() {
}, },
}); });
var appIcon = new Tray(__dirname + "/discord.ico"); var appIcon = new Tray(iconformat);
mainWindow.webContents.userAgent = mainWindow.webContents.userAgent =
"Mozilla/5.0 (X12; FreeBSD x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent "Mozilla/5.0 (X12; FreeBSD x86) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36"; //fake useragent
mainWindow.loadFile("index.html"); mainWindow.loadFile("index.html");