mirror of
https://github.com/smartfrigde/armcord.git
synced 2024-08-14 23:56:58 +00:00
Compare commits
5 commits
3957bb1c57
...
b7a0d1face
Author | SHA1 | Date | |
---|---|---|---|
|
b7a0d1face | ||
|
0b165e64bc | ||
|
8c62d9dd86 | ||
|
86f885c41f | ||
dfa1665b19 |
11 changed files with 73 additions and 20 deletions
|
@ -14,7 +14,6 @@
|
|||
"setup_question4": "Select a client mod you want to install:",
|
||||
"setup_question4_clientmodnotice": "Why not all of them? Having many client mods at the same time can cause issues. If you really want to do it though, check our documentation.",
|
||||
"settings-theme": "ArmCord Theme:",
|
||||
"settings-theme-tabs": "Tabs (experimental)",
|
||||
"settings-theme-default": "Default",
|
||||
"settings-theme-native": "Native",
|
||||
"settings-tray": "Minimize to tray",
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
"settings-updater": "Controlla gli aggiornamenti",
|
||||
"settings-mod": "Client mod:",
|
||||
"settings-theme": "ArmCord Theme:",
|
||||
"settings-theme-tabs": "Tabs (experimental)",
|
||||
"settings-theme-default": "Default",
|
||||
"settings-theme-native": "Native",
|
||||
"settings-patches": "Automatic Patches",
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
"settings-save": "Save settings",
|
||||
"settings-updater": "Check for updates",
|
||||
"settings-theme": "ArmCord Theme:",
|
||||
"settings-theme-tabs": "Tabs (experimental)",
|
||||
"settings-theme-default": "Default",
|
||||
"settings-theme-native": "Native",
|
||||
"settings-patches": "Automatic Patches",
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
"settings-updater": "Check voor updates",
|
||||
"settings-patches": "Automatische Patches",
|
||||
"settings-theme": "ArmCord Thema:",
|
||||
"settings-theme-tabs": "Tabs (experimenteel)",
|
||||
"settings-theme-default": "Standaard",
|
||||
"settings-theme-native": "Native",
|
||||
"settings-invitewebsocket": "discord.gg support",
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
"settings-save": "Zapisz ustawienia",
|
||||
"settings-mod": "Modyfikacja klienta:",
|
||||
"settings-theme": "Motyw ArmCord:",
|
||||
"settings-theme-tabs": "Karty (eksperymentalne)",
|
||||
"settings-theme-default": "Domyślny",
|
||||
"settings-theme-native": "Natywny",
|
||||
"settings-patches": "Automatyczne łatki",
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
{
|
||||
"loading_screen_start": "กำลังเริ่ม ArmCord…",
|
||||
"loading_screen_start": "เริ่มต้น ArmCord…",
|
||||
"loading_screen_offline": "ดูเหมือนว่าคุณออฟไลน์อยู่ โปรดเชื่อมต่ออินเทอร์เน็ตและลองใหม่อีกครั้ง",
|
||||
"loading_screen_update": "ArmCord เวอร์ชันใหม่พร้อมใช้งานแล้ว โปรดอัปเดตเป็นเวอร์ชันล่าสุด",
|
||||
"setup_question1": "เลือกประเภทการติดตั้งที่คุณต้องการ:",
|
||||
"setup_question1_answer1": "ติดตั้งแบบน้ำหนักเบา",
|
||||
"setup_question1_answer2": "ติดตั้งแบบเต็ม",
|
||||
"setup_question1_answer1": "ติดตั้งแบบรวดเร็ว",
|
||||
"setup_question1_answer2": "การตั้งค่าเต็มรูปแบบ",
|
||||
"setup_offline": "ดูเหมือนว่าคุณออฟไลน์อยู่ โปรดเชื่อมต่ออินเทอร์เน็ตและลองใหม่อีกครั้ง",
|
||||
"setup_question2": "เลือกช่อง/อินสแตนส์ Discord:",
|
||||
"setup_question3": "ต้องการให้ ArmCord จัดการการติดตั้งมอดของไคลเอนต์หรือไม่?",
|
||||
|
|
20
src/ipc.ts
20
src/ipc.ts
|
@ -1,7 +1,7 @@
|
|||
//ipc stuff
|
||||
import {app, ipcMain, shell, desktopCapturer} from "electron";
|
||||
import {mainWindow} from "./window";
|
||||
import {setConfigBulk, getVersion, getConfig, setLang, getLang} from "./utils";
|
||||
import {setConfigBulk, getVersion, getConfig, setLang, getLang, getWindowState} from "./utils";
|
||||
import {customTitlebar} from "./main";
|
||||
import {createSettingsWindow} from "./settings/main";
|
||||
export function registerIpc() {
|
||||
|
@ -41,8 +41,22 @@ export function registerIpc() {
|
|||
ipcMain.on("get-app-version", (event) => {
|
||||
event.returnValue = getVersion();
|
||||
});
|
||||
ipcMain.on("splashEnd", (event, arg) => {
|
||||
mainWindow.setSize(800, 600);
|
||||
ipcMain.on("splashEnd", async (event, arg) => {
|
||||
try {
|
||||
var width = await getWindowState("width") ?? 800;
|
||||
var height= await getWindowState("height") ?? 600;
|
||||
var isMaximized = await getWindowState("isMaximized") ?? false;
|
||||
} catch (e) {
|
||||
console.log("No window state file found. Fallbacking to default values.")
|
||||
mainWindow.setSize(800, 600);
|
||||
}
|
||||
if (isMaximized) {
|
||||
mainWindow.setSize(800, 600); //just so the whole thing doesn't cover whole screen
|
||||
mainWindow.maximize()
|
||||
} else {
|
||||
mainWindow.setSize(width, height);
|
||||
console.log("Not maximized.")
|
||||
}
|
||||
});
|
||||
ipcMain.on("restart", (event, arg) => {
|
||||
app.relaunch();
|
||||
|
|
|
@ -15,7 +15,6 @@ contextBridge.exposeInMainWorld("armcord", {
|
|||
},
|
||||
electron: process.versions.electron,
|
||||
channel: ipcRenderer.sendSync("channel"),
|
||||
openTab: (number: number) => ipcRenderer.sendSync("openTab", number),
|
||||
setLang: (lang: string) => ipcRenderer.send("setLang", lang),
|
||||
getLang: (toGet: string) =>
|
||||
ipcRenderer.invoke("getLang", toGet).then((result) => {
|
||||
|
|
22
src/tray.ts
22
src/tray.ts
|
@ -1,9 +1,9 @@
|
|||
import {app, Menu, Tray} from "electron";
|
||||
import {mainWindow} from "./window";
|
||||
import {getConfig} from "./utils";
|
||||
import { app, Menu, Tray } from "electron";
|
||||
import { mainWindow } from "./window";
|
||||
import { getConfig, setWindowState } from "./utils";
|
||||
import * as path from "path";
|
||||
import {createSettingsWindow} from "./settings/main";
|
||||
import {platform} from "process";
|
||||
import { createSettingsWindow } from "./settings/main";
|
||||
import { platform } from "process";
|
||||
let tray: any = null;
|
||||
let defaultIcon = "ac_plug_colored";
|
||||
app.whenReady().then(async () => {
|
||||
|
@ -22,6 +22,12 @@ app.whenReady().then(async () => {
|
|||
{
|
||||
label: "Quit ArmCord",
|
||||
click: function () {
|
||||
let [width, height] = mainWindow.getSize()
|
||||
setWindowState({
|
||||
width: width,
|
||||
height: height,
|
||||
isMaximized: mainWindow.isMaximized()
|
||||
})
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
@ -64,6 +70,12 @@ app.whenReady().then(async () => {
|
|||
{
|
||||
label: "Quit ArmCord",
|
||||
click: function () {
|
||||
let [width, height] = mainWindow.getSize()
|
||||
setWindowState({
|
||||
width: width,
|
||||
height: height,
|
||||
isMaximized: mainWindow.isMaximized()
|
||||
})
|
||||
app.quit();
|
||||
}
|
||||
}
|
||||
|
|
31
src/utils.ts
31
src/utils.ts
|
@ -1,7 +1,7 @@
|
|||
import * as fs from "fs";
|
||||
import {app, dialog} from "electron";
|
||||
import { app, dialog } from "electron";
|
||||
import path from "path";
|
||||
import {defaultMaxListeners} from "events";
|
||||
import { defaultMaxListeners } from "events";
|
||||
export var firstRun: boolean;
|
||||
export var isSetup: boolean;
|
||||
export var contentPath: string;
|
||||
|
@ -137,6 +137,33 @@ export async function getLang(object: string) {
|
|||
let parsed = JSON.parse(rawdata);
|
||||
return parsed[object];
|
||||
}
|
||||
|
||||
//ArmCord Window State manager
|
||||
export interface WindowState {
|
||||
width: number;
|
||||
height: number;
|
||||
isMaximized: boolean;
|
||||
}
|
||||
export async function setWindowState(object: WindowState) {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const storagePath = path.join(userDataPath, "/storage/");
|
||||
const saveFile = storagePath + "window.json";
|
||||
if (!fs.existsSync(saveFile)) {
|
||||
fs.writeFileSync(saveFile, "{}", "utf-8");
|
||||
}
|
||||
let toSave = JSON.stringify(object);
|
||||
fs.writeFileSync(saveFile, toSave, "utf-8");
|
||||
}
|
||||
export async function getWindowState(object: string) {
|
||||
const userDataPath = app.getPath("userData");
|
||||
const storagePath = path.join(userDataPath, "/storage/");
|
||||
const settingsFile = storagePath + "window.json";
|
||||
let rawdata = fs.readFileSync(settingsFile, "utf-8");
|
||||
let returndata = JSON.parse(rawdata);
|
||||
console.log(object + ": " + returndata[object]);
|
||||
return returndata[object];
|
||||
|
||||
}
|
||||
//ArmCord Settings/Storage manager
|
||||
|
||||
export interface Settings {
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// I'm sorry for this mess but I'm not sure how to fix it.
|
||||
import {BrowserWindow, shell, app, dialog} from "electron";
|
||||
import path from "path";
|
||||
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang} from "./utils";
|
||||
import {checkIfConfigIsBroken, firstRun, getConfig, contentPath, isSetup, setConfig, setLang, setWindowState} from "./utils";
|
||||
import {registerIpc} from "./ipc";
|
||||
import startServer from "./socket";
|
||||
import contextMenu from "electron-context-menu";
|
||||
|
@ -72,6 +72,12 @@ async function doAfterDefiningTheWindow() {
|
|||
return callback({});
|
||||
});
|
||||
mainWindow.on("close", async (e) => {
|
||||
let [width, height] = mainWindow.getSize()
|
||||
setWindowState({
|
||||
width: width,
|
||||
height: height,
|
||||
isMaximized: mainWindow.isMaximized()
|
||||
})
|
||||
if (await getConfig("minimizeToTray")) {
|
||||
e.preventDefault();
|
||||
mainWindow.hide();
|
||||
|
|
Loading…
Reference in a new issue