Skip to content

Instantly share code, notes, and snippets.

@amorist
Created November 15, 2018 12:47
Show Gist options
  • Save amorist/26b1f370a98641808ce902c8ec949e63 to your computer and use it in GitHub Desktop.
Save amorist/26b1f370a98641808ce902c8ec949e63 to your computer and use it in GitHub Desktop.
const getWindowPosition = () => {
const windowBounds = window.getBounds()
const trayBounds = tray.getBounds()
// Center window horizontally below the tray icon
const x = Math.round(trayBounds.x + (trayBounds.width / 2) - (windowBounds.width / 2))
// Position window 4 pixels vertically below the tray icon
const y = Math.round(trayBounds.y + trayBounds.height + 4)
return {x: x, y: y}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment