fix default settings and window resizing
This commit is contained in:
parent
454ee6cf4c
commit
67ef2abb24
@ -40,16 +40,7 @@ export default () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("local-app:getServers", () => {
|
ipcMain.handle("local-app:getServers", () => {
|
||||||
return (
|
return settings.get("servers");
|
||||||
settings.get("servers") || [
|
|
||||||
// TODO: remove this default server
|
|
||||||
{
|
|
||||||
_id: `${Date.now()}-1`,
|
|
||||||
name: "WA Demo",
|
|
||||||
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
|
|
||||||
},
|
|
||||||
]
|
|
||||||
);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ipcMain.handle("local-app:selectServer", (event, serverId: string) => {
|
ipcMain.handle("local-app:selectServer", (event, serverId: string) => {
|
||||||
|
@ -14,7 +14,13 @@ let settings: SettingsData;
|
|||||||
const defaultSettings: SettingsData = {
|
const defaultSettings: SettingsData = {
|
||||||
log_level: "info",
|
log_level: "info",
|
||||||
auto_launch_enabled: true,
|
auto_launch_enabled: true,
|
||||||
servers: [],
|
servers: [
|
||||||
|
{
|
||||||
|
_id: `${Date.now()}-1`,
|
||||||
|
name: "WA Demo",
|
||||||
|
url: "https://play.staging.workadventu.re/@/tcm/workadventure/wa-village",
|
||||||
|
},
|
||||||
|
],
|
||||||
shortcuts: {
|
shortcuts: {
|
||||||
mute_toggle: "",
|
mute_toggle: "",
|
||||||
camera_toggle: "",
|
camera_toggle: "",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { BrowserView, BrowserWindow } from "electron";
|
import { BrowserView, BrowserWindow, app } from "electron";
|
||||||
import electronIsDev from "electron-is-dev";
|
import electronIsDev from "electron-is-dev";
|
||||||
import windowStateKeeper from "electron-window-state";
|
import windowStateKeeper from "electron-window-state";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
@ -7,7 +7,7 @@ import { loadCustomScheme } from "./serve";
|
|||||||
let mainWindow: BrowserWindow | undefined;
|
let mainWindow: BrowserWindow | undefined;
|
||||||
let appView: BrowserView | undefined;
|
let appView: BrowserView | undefined;
|
||||||
|
|
||||||
const sidebarWidth = 70;
|
const sidebarWidth = 75;
|
||||||
|
|
||||||
export function getWindow() {
|
export function getWindow() {
|
||||||
return mainWindow;
|
return mainWindow;
|
||||||
@ -22,11 +22,13 @@ function resizeAppView() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const { width, height } = mainWindow.getBounds();
|
||||||
|
|
||||||
appView.setBounds({
|
appView.setBounds({
|
||||||
x: sidebarWidth,
|
x: sidebarWidth,
|
||||||
y: 0,
|
y: 0,
|
||||||
width: mainWindow.getBounds().width - sidebarWidth,
|
width: width - sidebarWidth,
|
||||||
height: mainWindow.getBounds().height,
|
height: height,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +91,17 @@ export async function createWindow() {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
resizeAppView();
|
resizeAppView();
|
||||||
|
appView.setAutoResize({ width: true, height: true });
|
||||||
|
|
||||||
|
// TODO: workaround to fix appView resizing when window is resized
|
||||||
|
mainWindow.on("maximize", resizeAppView);
|
||||||
|
mainWindow.on("unmaximize", resizeAppView);
|
||||||
|
mainWindow.on("minimize", resizeAppView);
|
||||||
|
mainWindow.on("restore", resizeAppView);
|
||||||
mainWindow.on("resize", resizeAppView);
|
mainWindow.on("resize", resizeAppView);
|
||||||
|
mainWindow.on("show", resizeAppView);
|
||||||
|
mainWindow.on("enter-full-screen", resizeAppView);
|
||||||
|
mainWindow.on("leave-full-screen", resizeAppView);
|
||||||
|
|
||||||
mainWindow.once("ready-to-show", () => {
|
mainWindow.once("ready-to-show", () => {
|
||||||
mainWindow?.show();
|
mainWindow?.show();
|
||||||
|
Loading…
Reference in New Issue
Block a user