Added systray2

This commit is contained in:
Thomas Cole 2022-04-29 12:30:40 -04:00
parent 451af8155d
commit 68c8f7af11
4 changed files with 53 additions and 1 deletions

View File

@ -1,4 +1,5 @@
require('dotenv').config(); require('dotenv').config();
require('./lib/Systray.js')
const sd = require('./lib/Deck'); const sd = require('./lib/Deck');
const web = require('./webserver/WebServer'); const web = require('./webserver/WebServer');
const cm = require('./lib/ConfigManager'); const cm = require('./lib/ConfigManager');

View File

@ -5,4 +5,7 @@ module.exports = {
CONFIG_CHANGED: "config_changed", CONFIG_CHANGED: "config_changed",
GET_CONFIG: "get_config", GET_CONFIG: "get_config",
GET_ACTIVE_DECK: "get_deck", GET_ACTIVE_DECK: "get_deck",
OPEN_CONFIG: "open_config",
ABOUT: "about",
QUIT: "quit"
} }

View File

@ -0,0 +1,47 @@
const SysTray = require('systray2');
const os = require('os');
const EVENTS = require('./Events');
const systray = new SysTray.default({
menu: {
icon: "iVBORw0KGgoAAAANSUhEUgAAAGgAAABoCAYAAAAdHLWhAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyhpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLm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GbydW9zbx7kHNG3FLBoh7o52tFXURt1CBDfI/ETBYCN7Bv8TlU9hSiDT4hsNkpOG0Or1MONl8nBvwSa5VLM8rVAAmXsZXLNehLVeQBVbmehs6zxEhJgky5XPAUb8kAmdaUK9ISuvxyyaD/zK4IE5dmTRqEXdNJBRL3+poCoRfdUoPEDagaNnBVdAyQymXrTKO7WxXeBuJXsU/47gPx+9stZdVrIr8LPl8H5FMVft8SW0q0hfiHiBr5EFkZnuHbCpjuDiBzpPiYQEG/IjjsD51SETWUaxNZKTlH8O3c2gD8F6/s1poa2E59kWyBIofWwYYP9TCCgepgRwcgGuIEtwAT0fW1wJP8G5CxDi9ZychA2FQGBSgtp6jswBiwE1pXHTHJnJPdDhWDXYJ5EGRhGt2NWvBBvbJiMQMx4OcVAxX2Gf//AgwAVVBGwOPLD74AAAAASUVORK5CYII=",
title: "",
tooltip: "Tips",
items: [
{
title: "Open Configurator",
enabled: true,
checked: false,
},
SysTray.default.separator,
{
title: "About YASD",
enabled: true,
},
{
title: "Quit",
enabled: true,
checked: false,
},
]
},
debug: false,
copyDir: true,
})
systray.onClick(action => {
switch(action.seq_id){
case 0:
eventBus.emit(EVENTS.OPEN_CONFIG)
break;
case 2:
eventBus.emit(EVENTS.ABOUT)
break;
case 3:
eventBus.emit(EVENTS.QUIT)
break;
default:
console.log("SYSTRAY HAS NOTHING TO DO WITH THIS")
}
})

View File

@ -13,7 +13,8 @@
"open": "^8.4.0", "open": "^8.4.0",
"dotenv": "16.0.0", "dotenv": "16.0.0",
"@nut-tree/nut-js": "2.0.1", "@nut-tree/nut-js": "2.0.1",
"sharp": "0.30.4" "sharp": "0.30.4",
"systray2": "2.1.4"
}, },
"devDependencies": { "devDependencies": {
"nodemon": "^2.0.15" "nodemon": "^2.0.15"