mirror of
https://github.com/cupcakearmy/unpixel.git
synced 2024-12-22 08:06:33 +00:00
linux support
This commit is contained in:
parent
eeae431e79
commit
f5741e381d
@ -11,7 +11,7 @@
|
|||||||
"repository": {
|
"repository": {
|
||||||
"url": "https://github.com/cupcakearmy/unpixel"
|
"url": "https://github.com/cupcakearmy/unpixel"
|
||||||
},
|
},
|
||||||
"version": "1.0.0",
|
"version": "1.0.1",
|
||||||
"main": "./dist/back/index.js",
|
"main": "./dist/back/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "electron .",
|
"start": "electron .",
|
||||||
@ -53,6 +53,7 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0-0",
|
"@babel/core": "^7.0.0-0",
|
||||||
|
"@types/auto-launch": "^5.0.1",
|
||||||
"@types/react": "^17.0.3",
|
"@types/react": "^17.0.3",
|
||||||
"@types/react-dom": "^17.0.3",
|
"@types/react-dom": "^17.0.3",
|
||||||
"electron": "^12.0.0",
|
"electron": "^12.0.0",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import dayjs from 'dayjs'
|
|
||||||
import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
|
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
import os from 'os'
|
||||||
|
import { BrowserWindow, BrowserWindowConstructorOptions, ipcMain } from 'electron'
|
||||||
|
import dayjs from 'dayjs'
|
||||||
import logger from 'electron-log'
|
import logger from 'electron-log'
|
||||||
|
|
||||||
import { DEV } from '.'
|
import { DEV } from '.'
|
||||||
@ -48,30 +49,33 @@ export default class Banner {
|
|||||||
},
|
},
|
||||||
width: 1200,
|
width: 1200,
|
||||||
height: 600,
|
height: 600,
|
||||||
}
|
fullscreen: !DEV,
|
||||||
if (!DEV) {
|
|
||||||
Object.assign(options, {
|
|
||||||
resizable: false,
|
|
||||||
movable: false,
|
|
||||||
simpleFullscreen: true,
|
|
||||||
fullscreen: true,
|
|
||||||
transparent: true,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
this.window = new BrowserWindow(options)
|
this.window = new BrowserWindow(options)
|
||||||
|
|
||||||
const entry = join(__dirname, '../front/banner/index.html')
|
const entry = join(__dirname, '../front/banner/index.html')
|
||||||
this.window.loadFile(entry)
|
this.window.loadFile(entry)
|
||||||
|
|
||||||
if (!DEV) {
|
if (DEV) {
|
||||||
this.window.maximize()
|
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.setAlwaysOnTop(true, 'floating', 99)
|
||||||
this.window.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })
|
this.window.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })
|
||||||
this.window.setFullScreenable(false)
|
this.window.setMovable(false)
|
||||||
} else {
|
this.window.setResizable(false)
|
||||||
this.window.webContents.toggleDevTools()
|
this.window.focus()
|
||||||
}
|
}
|
||||||
this.window.focus()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static close() {
|
static close() {
|
||||||
|
@ -6,13 +6,11 @@ import Settings from './settings'
|
|||||||
import Banner from './banner'
|
import Banner from './banner'
|
||||||
import Updater from './updater'
|
import Updater from './updater'
|
||||||
|
|
||||||
export const DEV = !app.isPackaged
|
export const DEV = !app.isPackaged && false
|
||||||
|
|
||||||
// Enforce single instance
|
// Enforce single instance
|
||||||
const isMain = app.requestSingleInstanceLock()
|
const isMain = app.requestSingleInstanceLock()
|
||||||
if (!isMain) {
|
if (!isMain) app.quit()
|
||||||
app.quit()
|
|
||||||
}
|
|
||||||
|
|
||||||
// Disable gpu
|
// Disable gpu
|
||||||
app.disableHardwareAcceleration()
|
app.disableHardwareAcceleration()
|
||||||
|
@ -61,7 +61,7 @@ export default class Settings {
|
|||||||
|
|
||||||
static open() {
|
static open() {
|
||||||
if (this.win) return
|
if (this.win) return
|
||||||
this.win = new BrowserWindow({
|
Settings.win = new BrowserWindow({
|
||||||
width: 400,
|
width: 400,
|
||||||
height: 575,
|
height: 575,
|
||||||
center: true,
|
center: true,
|
||||||
@ -74,6 +74,7 @@ export default class Settings {
|
|||||||
|
|
||||||
const entry = join(__dirname, '../front/settings/index.html')
|
const entry = join(__dirname, '../front/settings/index.html')
|
||||||
Settings.win.loadFile(entry)
|
Settings.win.loadFile(entry)
|
||||||
|
Settings.win.setMenu(null)
|
||||||
|
|
||||||
if (DEV) {
|
if (DEV) {
|
||||||
Settings.win.setSize(800, 485)
|
Settings.win.setSize(800, 485)
|
||||||
|
@ -53,6 +53,7 @@
|
|||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
|
"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. */
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
|
||||||
/* Source Map Options */
|
/* Source Map Options */
|
||||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
@ -1584,6 +1584,11 @@
|
|||||||
dependencies:
|
dependencies:
|
||||||
defer-to-connect "^1.0.1"
|
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":
|
"@types/debug@^4.1.5":
|
||||||
version "4.1.5"
|
version "4.1.5"
|
||||||
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
|
resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.5.tgz#b14efa8852b7768d898906613c23f688713e02cd"
|
||||||
|
Loading…
Reference in New Issue
Block a user