Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save bsdshell/90fd4f78037a8cdeafe5f2a7f6642d50 to your computer and use it in GitHub Desktop.
Save bsdshell/90fd4f78037a8cdeafe5f2a7f6642d50 to your computer and use it in GitHub Desktop.
electron Floating Window
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();
};
@bsdshell
Copy link
Author

Create a floating Window in Electron

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment