<commit_before>const electron = window.nativeRequire('electron')
const { ipcRenderer, remote } = electron
const {Tray, Menu, nativeImage} = remote
const React = require('react')
const {mailboxDispatch} = require('../Dispatch')
const mailboxActions = require('../stores/mailbox/mailboxActions')
const { BLANK_PNG } = require('shared/b64Assets')
const { TrayRenderer } = require('../Components')

module.exports = React.createClass({
  /* **************************************************************************/
  // Class
  /* **************************************************************************/
  displayName: 'Tray',

  // Pretty strict on updating. If you're changing these, change shouldComponentUpdate :)
  propTypes: {
    unreadCount: React.PropTypes.number.isRequired,
    unreadMessages: React.PropTypes.object.isRequired,
    traySettings: React.PropTypes.object.isRequired
  },
  statics: {
    platformSupportsDpiMultiplier: () => {
      return process.platform === 'darwin' || process.platform === 'linux'
    }
  },

  /* **************************************************************************/
  // Component Lifecycle
  /* **************************************************************************/

  componentDidMount () {
    this.appTray = new Tray(nativeImage.createFromDataURL(BLANK_PNG))
    if (process.platform === 'win32') {
      this.appTray.on('double-click', () => {
        ipcRenderer.send('focus-app')
      })
    }
  },

  componentWillUnmount () {
    if (this.appTray) {<commit_msg>Linux focus app on tray click when os doesn't support application indicator. #322<commit_after>const electron = window.nativeRequire('electron')
const { ipcRenderer, remote } = electron
const {Tray, Menu, nativeImage} = remote
const React = require('react')
const {mailboxDispatch} = require('../Dispatch')
const mailboxActions = require('../stores/mailbox/mailboxActions')
const { BLANK_PNG } = require('shared/b64Assets')
const { TrayRenderer } = require('../Components')

module.exports = React.createClass({
  /* **************************************************************************/
  // Class
  /* **************************************************************************/
  displayName: 'Tray',

  // Pretty strict on updating. If you're changing these, change shouldComponentUpdate :)
  propTypes: {
    unreadCount: React.PropTypes.number.isRequired,
    unreadMessages: React.PropTypes.object.isRequired,
    traySettings: React.PropTypes.object.isRequired
  },
  statics: {
    platformSupportsDpiMultiplier: () => {
      return process.platform === 'darwin' || process.platform === 'linux'
    }
  },

  /* **************************************************************************/
  // Component Lifecycle
  /* **************************************************************************/

  componentDidMount () {
    this.appTray = new Tray(nativeImage.createFromDataURL(BLANK_PNG))
    if (process.platform === 'win32') {
      this.appTray.on('double-click', () => {
        ipcRenderer.send('focus-app')
      })
    } else if (process.platform === 'linux') {
      // On platforms that have app indicator support - i.e. ubuntu clicking on the
      // icon will launch the context menu. On other linux platforms the context
      // menu is opened on right click. For app indicator platforms click event
      // is ignored
      this.appTray.on('click', () => {
        ipcRenderer.send('focus-app')
      })
    }
  },

  componentWillUnmount () {
    if (this.appTray) {
{'fraction_non_alphanumeric': 0.28526912181303116, 'fraction_numerical': 0.0031161473087818695, 'mean_word_length': 4.254464285714286, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6797460', 'n_tokens_mistral': 953, 'n_tokens_neox': 905, 'n_words': 196}