<ul dir="auto">
<li>Electron version: 1.7.x</li>
<li>Operating system: Windows 10 (1703 OS Build 15063.540)</li>
</ul>
<h3 dir="auto">Expected behavior</h3>
<p dir="auto">Setting a windows position and asking for it should return the same value.</p>
<h3 dir="auto">Actual behavior</h3>
<p dir="auto">The Y-Position is always wrong when the window is on a secondary monitor.</p>
<h3 dir="auto">How to reproduce</h3>
<ul dir="auto">
<li>connect a secondary monitor that is larger to the right of the primary monitor</li>
<li>run below code</li>
<li>notice how the Y-Position as returned by <code class="notranslate">win.getPosition()</code> is not the same that was set when creating the window</li>
</ul>
<p dir="auto">My monitor setup is like the following (secondary monitor is larger):</p>
<p dir="auto"><a target="_blank" rel="noopener noreferrer nofollow" href="https://user-images.githubusercontent.com/900690/31489848-5df835da-af42-11e7-96ac-0a2a353f5f5e.png"><img src="https://user-images.githubusercontent.com/900690/31489848-5df835da-af42-11e7-96ac-0a2a353f5f5e.png" alt="image" style="max-width: 100%;"></a></p>
<p dir="auto">Code:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="const { app, BrowserWindow } = require('electron')
const path = require('path')
const url = require('url')

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let win

function createWindow() {

    // Create the browser window.
    let y = 184;
    console.log(&quot;Setting Y: &quot; + y)
    win = new BrowserWindow({ width: 800, height: 600, x: 1600, y: y })

    setInterval(function () {
        console.log(&quot;Y is: &quot; + win.getPosition()[1])
    }, 2000);

    // and load the index.html of the app.
    win.loadURL(url.format({
        pathname: path.join(__dirname, 'index.html'),
        protocol: 'file:',
        slashes: true
    }))

    // Open the DevTools.
    win.webContents.openDevTools()

    // Emitted when the window is closed.
    win.on('closed', () =&gt; {
        // Dereference the window object, usually you would store windows
        // in an array if your app supports multi windows, this is the time
        // when you should delete the corresponding element.
        win = null
    })
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow)

// Quit when all windows are closed.
app.on('window-all-closed', () =&gt; {
    // On macOS it is common for applications and their menu bar
    // to stay active until the user quits explicitly with Cmd + Q
    if (process.platform !== 'darwin') {
        app.quit()
    }
})

app.on('activate', () =&gt; {
    // On macOS it's common to re-create a window in the app when the
    // dock icon is clicked and there are no other windows open.
    if (win === null) {
        createWindow()
    }
})

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and require them here."><pre class="notranslate"><span class="pl-k">const</span> <span class="pl-kos">{</span> app<span class="pl-kos">,</span> BrowserWindow <span class="pl-kos">}</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'electron'</span><span class="pl-kos">)</span>
<span class="pl-k">const</span> <span class="pl-s1">path</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'path'</span><span class="pl-kos">)</span>
<span class="pl-k">const</span> <span class="pl-s1">url</span> <span class="pl-c1">=</span> <span class="pl-en">require</span><span class="pl-kos">(</span><span class="pl-s">'url'</span><span class="pl-kos">)</span>

<span class="pl-c">// Keep a global reference of the window object, if you don't, the window will</span>
<span class="pl-c">// be closed automatically when the JavaScript object is garbage collected.</span>
<span class="pl-k">let</span> <span class="pl-s1">win</span>

<span class="pl-k">function</span> <span class="pl-en">createWindow</span><span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>

    <span class="pl-c">// Create the browser window.</span>
    <span class="pl-k">let</span> <span class="pl-s1">y</span> <span class="pl-c1">=</span> <span class="pl-c1">184</span><span class="pl-kos">;</span>
    <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"Setting Y: "</span> <span class="pl-c1">+</span> <span class="pl-s1">y</span><span class="pl-kos">)</span>
    <span class="pl-s1">win</span> <span class="pl-c1">=</span> <span class="pl-k">new</span> <span class="pl-v">BrowserWindow</span><span class="pl-kos">(</span><span class="pl-kos">{</span> <span class="pl-c1">width</span>: <span class="pl-c1">800</span><span class="pl-kos">,</span> <span class="pl-c1">height</span>: <span class="pl-c1">600</span><span class="pl-kos">,</span> <span class="pl-c1">x</span>: <span class="pl-c1">1600</span><span class="pl-kos">,</span> <span class="pl-c1">y</span>: <span class="pl-s1">y</span> <span class="pl-kos">}</span><span class="pl-kos">)</span>

    <span class="pl-en">setInterval</span><span class="pl-kos">(</span><span class="pl-k">function</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-smi">console</span><span class="pl-kos">.</span><span class="pl-en">log</span><span class="pl-kos">(</span><span class="pl-s">"Y is: "</span> <span class="pl-c1">+</span> <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-en">getPosition</span><span class="pl-kos">(</span><span class="pl-kos">)</span><span class="pl-kos">[</span><span class="pl-c1">1</span><span class="pl-kos">]</span><span class="pl-kos">)</span>
    <span class="pl-kos">}</span><span class="pl-kos">,</span> <span class="pl-c1">2000</span><span class="pl-kos">)</span><span class="pl-kos">;</span>

    <span class="pl-c">// and load the index.html of the app.</span>
    <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-en">loadURL</span><span class="pl-kos">(</span><span class="pl-s1">url</span><span class="pl-kos">.</span><span class="pl-en">format</span><span class="pl-kos">(</span><span class="pl-kos">{</span>
        <span class="pl-c1">pathname</span>: <span class="pl-s1">path</span><span class="pl-kos">.</span><span class="pl-en">join</span><span class="pl-kos">(</span><span class="pl-s1">__dirname</span><span class="pl-kos">,</span> <span class="pl-s">'index.html'</span><span class="pl-kos">)</span><span class="pl-kos">,</span>
        <span class="pl-c1">protocol</span>: <span class="pl-s">'file:'</span><span class="pl-kos">,</span>
        <span class="pl-c1">slashes</span>: <span class="pl-c1">true</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span><span class="pl-kos">)</span>

    <span class="pl-c">// Open the DevTools.</span>
    <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-c1">webContents</span><span class="pl-kos">.</span><span class="pl-en">openDevTools</span><span class="pl-kos">(</span><span class="pl-kos">)</span>

    <span class="pl-c">// Emitted when the window is closed.</span>
    <span class="pl-s1">win</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'closed'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
        <span class="pl-c">// Dereference the window object, usually you would store windows</span>
        <span class="pl-c">// in an array if your app supports multi windows, this is the time</span>
        <span class="pl-c">// when you should delete the corresponding element.</span>
        <span class="pl-s1">win</span> <span class="pl-c1">=</span> <span class="pl-c1">null</span>
    <span class="pl-kos">}</span><span class="pl-kos">)</span>
<span class="pl-kos">}</span>

<span class="pl-c">// This method will be called when Electron has finished</span>
<span class="pl-c">// initialization and is ready to create browser windows.</span>
<span class="pl-c">// Some APIs can only be used after this event occurs.</span>
<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'ready'</span><span class="pl-kos">,</span> <span class="pl-s1">createWindow</span><span class="pl-kos">)</span>

<span class="pl-c">// Quit when all windows are closed.</span>
<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'window-all-closed'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c">// On macOS it is common for applications and their menu bar</span>
    <span class="pl-c">// to stay active until the user quits explicitly with Cmd + Q</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">process</span><span class="pl-kos">.</span><span class="pl-c1">platform</span> <span class="pl-c1">!==</span> <span class="pl-s">'darwin'</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">quit</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-s1">app</span><span class="pl-kos">.</span><span class="pl-en">on</span><span class="pl-kos">(</span><span class="pl-s">'activate'</span><span class="pl-kos">,</span> <span class="pl-kos">(</span><span class="pl-kos">)</span> <span class="pl-c1">=&gt;</span> <span class="pl-kos">{</span>
    <span class="pl-c">// On macOS it's common to re-create a window in the app when the</span>
    <span class="pl-c">// dock icon is clicked and there are no other windows open.</span>
    <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">win</span> <span class="pl-c1">===</span> <span class="pl-c1">null</span><span class="pl-kos">)</span> <span class="pl-kos">{</span>
        <span class="pl-en">createWindow</span><span class="pl-kos">(</span><span class="pl-kos">)</span>
    <span class="pl-kos">}</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span>

<span class="pl-c">// In this file you can include the rest of your app's specific main process</span>
<span class="pl-c">// code. You can also put them in separate files and require them here.</span></pre></div>
<p dir="auto">Note: in this example I am setting <code class="notranslate">Y</code> to <code class="notranslate">184</code> and the output I get is <code class="notranslate">146</code>.</p>
<p dir="auto">Maybe related to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="264856998" data-permission-text="Title is private" data-url="https://github.com/electron/electron/issues/10768" data-hovercard-type="issue" data-hovercard-url="/electron/electron/issues/10768/hovercard" href="https://github.com/electron/electron/issues/10768">#10768</a></p>
<p dir="auto">We are seeing an issue in VS Code on Ubuntu 15 where top level menu items show up duplicate or are even missing. This seems to be caused by updating the menu via setApplicationMenu() after it has already been set. Since that is the only way to update a menu, we need to do it that way (I guess Atom has to too).</p>
<p dir="auto">We are sitting on Electron 0.28.3. Have you guys heard of this issue before?</p>