WIP linus seems to work

This commit is contained in:
Alexander Drozdov
2020-03-13 00:14:36 +02:00
parent 31d61e8b36
commit c83397833d
3 changed files with 14 additions and 13 deletions
+4 -1
View File
@@ -54,7 +54,10 @@ app.on('ready', async () => {
PoeWindow.startPolling()
setupConfig()
setupShowHide()
createWindow()
setTimeout(
createWindow, // fix: linux window black instead of transparent
process.platform === 'linux' ? 1000 : 0
)
createTray()
setupShortcuts()
+7 -11
View File
@@ -19,22 +19,16 @@ let browserViewExternal: BrowserView | undefined
export function showWindow () {
positionWindow(win)
const wasLockedLinux = isWindowLocked
if (isWindowShown && isWindowLocked) {
logger.debug('Hide the window (was left in background)', { source: 'price-check', fn: 'showWindow' })
hideWindow()
hideWindow(true)
}
isWindowShown = true
win.showInactive()
if (process.platform === 'linux') {
if (wasLockedLinux && config.get('altTabToGame')) {
win.setSkipTaskbar(true) // fix: GNOME window is ready
}
win.setAlwaysOnTop(true) // X11: alwaysOnTop resets on show/hide
}
}
function hideWindow () {
function hideWindow (willShow?: boolean) {
logger.verbose('Hide window', { source: 'price-check', fn: 'hideWindow', wasLocked: isWindowLocked })
isWindowShown = false
@@ -42,13 +36,15 @@ function hideWindow () {
win.setSkipTaskbar(true)
win.setAlwaysOnTop(true, 'screen-saver')
}
win.hide()
if (!willShow) {
win.hide()
}
win.setIgnoreMouseEvents(true)
if (isWindowLocked) {
isWindowLocked = false
PoeWindow.isActive = true
if (process.platform === 'win32') {
if (process.platform === 'win32' && !willShow) {
windowManager.focusWindowById(PoeWindow.pid!)
}
if (browserViewExternal) {
+3 -1
View File
@@ -19,6 +19,7 @@ export function createWindow () {
frame: false,
show: false,
transparent: true,
fullscreen: true, // linux does not support changing at runtime, add config?
resizable: false,
// backgroundColor: '#2d3748', // gray-800
webPreferences: {
@@ -38,9 +39,10 @@ export function createWindow () {
checkForUpdates()
}
win.setAlwaysOnTop(true, 'screen-saver')
win.setIgnoreMouseEvents(true)
win.once('ready-to-show', () => {
// place here because of linux
win.setAlwaysOnTop(true, 'screen-saver')
// win.show()
})
}