diff --git a/package.json b/package.json index bcbd372..503aee5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/back/banner.ts b/src/back/banner.ts index f55cb99..b0042dc 100644 --- a/src/back/banner.ts +++ b/src/back/banner.ts @@ -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() { diff --git a/src/back/index.ts b/src/back/index.ts index 00a93df..da5e367 100644 --- a/src/back/index.ts +++ b/src/back/index.ts @@ -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() diff --git a/src/back/settings.ts b/src/back/settings.ts index 79dee76..ffcb0a1 100644 --- a/src/back/settings.ts +++ b/src/back/settings.ts @@ -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) diff --git a/tsconfig.json b/tsconfig.json index f7d3e16..d713675 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -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. */ diff --git a/yarn.lock b/yarn.lock index 94c1374..8b0a892 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"