Skip to content

Instantly share code, notes, and snippets.

@roz3x
Created January 15, 2021 17:49
Show Gist options
  • Save roz3x/2bc91db1cc748fa4a121a8d60b500179 to your computer and use it in GitHub Desktop.
Save roz3x/2bc91db1cc748fa4a121a8d60b500179 to your computer and use it in GitHub Desktop.
brighness config
const { app, Menu, Tray } = require('electron');
const {exec } = require('child_process');
let tray = null ;
app.whenReady().then(()=> {
tray = new Tray('/home/roz/downloads/icon.jpeg')
const contextMenu = Menu.buildFromTemplate([
{label: '1%' , click(){
exec("xbacklight -set 1");
}} ,{label: '5%' , click(){
exec("xbacklight -set 5");
}} ,{label: '10%' , click(){
exec("xbacklight -set 10");
}} ,
])
tray.setToolTip("brighness!");
tray.setContextMenu(contextMenu);
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment