positioner.js
function calculateYAlign (windowBounds, trayBounds, align) {
  const display = getDisplay()
  let y

  switch (align) {
    case 'up':
      y = trayBounds.y + trayBounds.height - windowBounds.height
      break
    case 'down':
      y = trayBounds.y
      break
    case 'center':
    default:
      y = Math.round((trayBounds.y + (trayBounds.height / 2)) - (windowBounds.height / 2))
      break
  }

  if (y + windowBounds.height > display.bounds.height && align !== 'up') {
    y = trayBounds.y + trayBounds.height - windowBounds.height
  } else if (y < 0 && align !== 'down') {
    y = 0
  }

  return y
}
function calculateYAlign (windowBounds, trayBounds, align) {
  const display = getDisplay()
  let y

  switch (align) {
    case 'up':
      y = trayBounds.y + trayBounds.height - windowBounds.height
      break
    case 'down':
      y = trayBounds.y
      break
    case 'center':
    default:
      y = Math.round((trayBounds.y + (trayBounds.height / 2)) - (windowBounds.height / 2))
      break
  }

  if (y + windowBounds.height > display.bounds.height && align !== 'up') {
    y = trayBounds.y + trayBounds.height - windowBounds.height
  } else if (y < 0 && align !== 'down') {
    y = 0
  }

  return y
}
function calculateYAlign ( windowBounds , trayBounds , align ) { const display = getDisplay ( ) let y switch ( align ) { case 'up' : y = trayBounds . y + trayBounds . height - windowBounds . height break case 'down' : y = trayBounds . y break case 'center' : default : y = Math . round ( ( trayBounds . y + ( trayBounds . height / 2 ) ) - ( windowBounds . height / 2 ) ) break } if ( y + windowBounds . height > display . bounds . height && align !== 'up' ) { y = trayBounds . y + trayBounds . height - windowBounds . height } else if ( y < 0 && align !== 'down' ) { y = 0 } return y }
Calculates the y position of the tray window

@param {Rectangle} windowBounds - electron BrowserWindow bounds
@param {Rectangle} trayBounds - tray bounds from electron Tray.getBounds()
@param {string} [align] - align up|middle|down, default: down

@return {integer} - calculated y position
Calculates the y position of the tray window