Last active
March 10, 2022 11:34
-
-
Save geekeren/ac1e92ed7d0df4260f334522c5beee5c to your computer and use it in GitHub Desktop.
electron Floating Window
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let floatingWindow; | |
const createFloatingWindow = function() { | |
const electron = require('electron'); | |
const BrowserWindow = electron.BrowserWindow; | |
if (!floatingWindow) { | |
floatingWindow = new BrowserWindow({ | |
width: 1000, | |
height: 80, | |
titleBarStyle: 'hide', | |
transparent: true, | |
frame: false, | |
resizable: false, | |
hasShadow: false, | |
// opacity: 0.5, | |
}); | |
floatingWindow.setAutoHideMenuBar(true); | |
floatingWindow.loadURL(`file://${__dirname}/floatingWindow.html`); | |
floatingWindow.setAlwaysOnTop(true, 'floating'); | |
} | |
floatingWindow.show(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment