linux support

This commit is contained in:
cupcakearmy 2021-04-07 12:00:09 +02:00
parent eeae431e79
commit f5741e381d
No known key found for this signature in database
GPG Key ID: D28129AE5654D9D9
6 changed files with 33 additions and 23 deletions

View File

@ -11,7 +11,7 @@
"repository": {
"url": "https://github.com/cupcakearmy/unpixel"
},
"version": "1.0.0",
"version": "1.0.1",
"main": "./dist/back/index.js",
"scripts": {
"start": "electron .",
@ -53,6 +53,7 @@
},
"devDependencies": {
"@babel/core": "^7.0.0-0",
"@types/auto-launch": "^5.0.1",
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3",
"electron": "^12.0.0",

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,31 +49,34 @@ 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()
}
}
static close() {
if (this.window) {

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)

View File

@ -53,6 +53,7 @@
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
"resolveJsonModule": true,
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */

View File

@ -1584,6 +1584,11 @@
dependencies:
defer-to-connect "^1.0.1"
"@types/auto-launch@^5.0.1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@types/auto-launch/-/auto-launch-5.0.1.tgz#388a047edc0e754d8e8978cbd9ed4672b36be2c4"
integrity sha512-+KQ+/koZ7sJXnf5cnCANofY6yXAdYJNEoVZEuWcwJfuWbUp9u6l09I7KhwD+ivU+cdz7JId4V5ukxscWtHdSuw==
"@types/debug@^4.1.5":
version "4.1.5"
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"