Made with ❤️ by JayTheManCHS
Electron-Buttons is a lightweight Electron Node Module which allows the creation of custom WindowsTitlebarOverlay Buttons inside of your app.
- Install
electron-buttons.
$ npm install electron-buttons@latest- Require
electron-buttonsin the Main process.
// main.js
const { app, BrowserWindow } = require('electron')
const { TitleBarButton } = require('electron-buttons').Main
// Wait until the app is ready
app.on('ready', () => {
// Create a window
const window = new BrowserWindow({
width: 600,
height: 500,
frame: false,
show: false,
titleBarOverlay: {
height: 40,
color: '#ffffff',
symbolColor: 'black'
},
titleBarStyle: 'hidden'
})
// Load a file or URL into the window
window.loadFile('path-to-your-html-file-here')
// Create a new TitleBarButton
const button = new TitleBarButton(window, {
id: 'button1',
height: 40,
icon: 'path-to-you-icon-here,
color: '#aaaaaa',
tryToAnalyse: true,
buttonID: 'titleBarButton1'
})
})A clonable quick-start can be found at electron-buttons-quick-start.
Follow the steps below to start using electron-buttons.
-
Install Node.js from https://nodejs.org/en/download/
-
Install the
electron-buttonsdependency usingnpm.
$ npm install electron-buttons@latest- Require
electron-buttonsin the Main or Preload process, or otherwise in a process which has access to bothNodeandElectronAPIs.
const { TitleBarButton } = require('electron-buttons').Main
// Or depending on the process
const { TitleBarButton } = require('electron-buttons').RendererCurrently work in progress.
- Fully seamless creation of native-feeling titlebar buttons
- Easy Customization due to a direct interface of the DOM Element
- Event Listeners can be added easily
Currently, contributions are not currently accepted until after the full release. If you have any suggestions, please create an issue with the enhancement label.
All code is licensed under the MIT License.