const { Tray, nativeImage } = require('electron');

class SystemTray {
  constructor(options = {}) {
    const { onClick, logger } = options;

    this.logger = logger;
    this.tray = new Tray(
      nativeImage.createEmpty(),
    );

    this.logger.debug('System tray created.');

    if (typeof onClick === 'function') {
      this.tray.on('click', onClick);
    }
  }

  getBounds() {
    return this.tray.getBounds();
  }

  getLabel() {
    return this.tray.getTitle();
  }

  setLabel(label) {
    const { tray } = this;

    if (tray.isDestroyed()) {
      this.logger.debug('Unable to set label since tray is destroyed.');

      return this;
    }

    tray.setTitle(this.label = label, {
      fontType: 'monospacedDigit',
    });

    return this;
  }
}

module.exports = SystemTray;

@@ -162,16 +162,38 @@
 logger;%0A
+    this.prefix = '';%0A
     this
@@ -440,24 +440,138 @@
 nds();%0A  %7D%0A%0A
+  getPrefix() %7B%0A    return this.prefix;%0A  %7D%0A%0A  setPrefix(value) %7B%0A    this.prefix = value;%0A%0A    return this;%0A  %7D%0A%0A
   getLabel()
@@ -707,21 +707,21 @@
 .logger.
-debug
+error
 ('Unable
@@ -807,16 +807,38 @@
 etTitle(
+%60$%7Bthis.getPrefix()%7D$%7B
 this.lab
@@ -847,16 +847,18 @@
  = label
+%7D%60
 , %7B%0A    

allow prefixes in system tray title