Skip to content

jaythemanchs/Electron-Buttons

Repository files navigation

Banner

Electron-Buttons GitHub issues GitHub forks GitHub stars GitHub license

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

  1. Install electron-buttons.
$ npm install electron-buttons@latest
  1. 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'
        })
})

A clonable quick-start can be found at electron-buttons-quick-start.

Installation

Follow the steps below to start using electron-buttons.

  1. Install Node.js from https://nodejs.org/en/download/

  2. Install the electron-buttons dependency using npm.

$ npm install electron-buttons@latest
  1. Require electron-buttons in the Main or Preload process, or otherwise in a process which has access to both Node and Electron APIs.
const { TitleBarButton } = require('electron-buttons').Main
// Or depending on the process
const { TitleBarButton } = require('electron-buttons').Renderer

API

Currently work in progress.

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

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.

About

A simple node module that grants the ability to create additional WindowsTitleBar buttons.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors