You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Oct 16, 2020. It is now read-only.
If you create a PanelWindow with show: false, the blur event will never be sent. In my example below, I have a keyboard shortcut to show a window, and the blur never fires in that case.
If you enable the show property, the blur event will fire until the window is hidden for the first time. So, in my example below, the blur event fires, but once barWindow.hide() is called (either using the shortcut or by activating a different application), it will never fire again.
Example (Electron 4.2.5):
const{ app, globalShortcut, BrowserWindow }=require('electron');const{ PanelWindow }=require('electron-panel-window');letbarWindow=null;constdebug=false;app.on('ready',function(){constbarWindow=newPanelWindow({width: 700,backgroundColor: '#FF0000',height: 700,show: false,// frameless does not work in PanelWindow// frame: false});barWindow.loadFile(`./main.html`);if(debug===false){barWindow.on('blur',function(event){console.log('BLUR');barWindow.hide();app.hide();});}constshortcut='Alt+CommandOrControl+Space'// 'CommandOrControl+Space'globalShortcut.register(shortcut,()=>{if(barWindow.isVisible()){barWindow.hide();// app.hide();}else{barWindow.show();}console.log(`${shortcut} is pressed`);// barWindow.webContents.openDevTools({ options: { mode: 'detach' } });});});
The text was updated successfully, but these errors were encountered:
If you create a PanelWindow with
show: false
, theblur
event will never be sent. In my example below, I have a keyboard shortcut to show a window, and theblur
never fires in that case.If you enable the
show
property, the blur event will fire until the window is hidden for the first time. So, in my example below, theblur
event fires, but oncebarWindow.hide()
is called (either using the shortcut or by activating a different application), it will never fire again.Example (Electron 4.2.5):
The text was updated successfully, but these errors were encountered: