force 2x tray icon depending on scaleFactor

This commit is contained in:
Stephen Birarda 2016-01-18 13:55:32 -08:00
parent 552b2d2bdc
commit d6c7c772ab
3 changed files with 12 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -115,9 +115,6 @@ const configPath = path.join(getApplicationDataDirectory(), 'config.json');
var userConfig = new Config();
userConfig.load(configPath);
const TRAY_FILENAME = (osType == "Darwin" ? "console-tray-Template.png" : "console-tray.png");
const TRAY_ICON = path.join(__dirname, '../resources/' + TRAY_FILENAME);
// print out uncaught exceptions in the console
process.on('uncaughtException', function(err) {
console.error(err);
@ -516,8 +513,19 @@ app.on('ready', function() {
app.dock.hide();
}
var trayFilename = null;
if (osType == "Darwin") {
trayFilename = "console-tray-Template.png";
} else {
const scaleFactor = require('screen').getPrimaryDisplay().scaleFactor
trayFilename = (scaleFactor > 1 ? "console-tray@2x.png" : "console-tray.png");
}
const trayIcon = path.join(__dirname, '../resources/' + trayFilename);
// Create tray icon
tray = new Tray(TRAY_ICON);
tray = new Tray(trayIcon);
tray.setToolTip('High Fidelity Server Console');
tray.on('click', function() {