electron-buttons
v1.0.5
Published
Lets you add custom WindowsTitleBarOverlay buttons to your app
Downloads
4
Readme
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-buttons
in 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-buttons
dependency usingnpm
$ npm install electron-buttons@latest
- Require
electron-buttons
in the Main or Preload process, or otherwise in a process which has access to bothNode
andElectron
APIs
const { TitleBarButton } = require('electron-buttons').Main
// Or depending on the process
const { TitleBarButton } = require('electron-buttons').Renderer
API
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