linux support

This commit is contained in:
2021-04-07 12:00:09 +02:00
parent eeae431e79
commit f5741e381d
6 changed files with 33 additions and 23 deletions

View File

@@ -1,6 +1,7 @@
import dayjs from 'dayjs'
import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
import { join } from 'path'
import os from 'os'
import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
import dayjs from 'dayjs'
import logger from 'electron-log'
import { DEV } from '.'
@@ -48,30 +49,33 @@ export default class Banner {
},
width: 1200,
height: 600,
}
if (!DEV) {
Object.assign(options, {
resizable: false,
movable: false,
simpleFullscreen: true,
fullscreen: true,
transparent: true,
})
fullscreen: !DEV,
}
this.window = new BrowserWindow(options)
const entry = join(__dirname, '../front/banner/index.html')
this.window.loadFile(entry)
if (!DEV) {
this.window.maximize()
if (DEV) {
this.window.webContents.toggleDevTools()
} else {
switch (os.platform()) {
case 'win32':
break
case 'linux':
break
case 'darwin':
this.window.setSimpleFullScreen(true)
this.window.setFullScreenable(false)
break
}
// this.window.maximize()
this.window.setAlwaysOnTop(true, 'floating', 99)
this.window.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })
this.window.setFullScreenable(false)
} else {
this.window.webContents.toggleDevTools()
this.window.setMovable(false)
this.window.setResizable(false)
this.window.focus()
}
this.window.focus()
}
static close() {

View File

@@ -6,13 +6,11 @@ import Settings from './settings'
import Banner from './banner'
import Updater from './updater'
export const DEV = !app.isPackaged
export const DEV = !app.isPackaged && false
// Enforce single instance
const isMain = app.requestSingleInstanceLock()
if (!isMain) {
app.quit()
}
if (!isMain) app.quit()
// Disable gpu
app.disableHardwareAcceleration()

View File

@@ -61,7 +61,7 @@ export default class Settings {
static open() {
if (this.win) return
this.win = new BrowserWindow({
Settings.win = new BrowserWindow({
width: 400,
height: 575,
center: true,
@@ -74,6 +74,7 @@ export default class Settings {
const entry = join(__dirname, '../front/settings/index.html')
Settings.win.loadFile(entry)
Settings.win.setMenu(null)
if (DEV) {
Settings.win.setSize(800, 485)