1.0.5 • Published 3 years ago
electron-buttons v1.0.5
Electron-Buttons

Made with ❤️ by JayTheManCHS
Introduction
Electron-Buttons is a lightweight Electron Node Module which allows the creation of custom WindowsTitlebarOverlay Buttons inside of your app.
Quickstart
- 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'
})
})Installation
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').RendererAPI
Currently work in progress.
Contributing Guidelines
Currently, contributions are not currently accepted until after the full release. If you have any suggestions, please create an issue with the enhancement label.
License
All code is licensed under the MIT License.
Features
- 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