<ul dir="auto">
<li>Electron version: 0.37.6</li>
<li>Operating system: Ubuntu 16 64-bit</li>
</ul>
<p dir="auto">Hi guys,</p>
<p dir="auto">Trying to bring Electron app on top &amp; focus it when the user pushes a registered globalShortcut. Nor App.focus() nor BrowserWindow.focus() seems working on Ubuntu. Could only bring it on top by calling:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mainWin.setAlwaysOnTop(true);
mainWin.setAlwaysOnTop(false);"><pre class="notranslate"><code class="notranslate">mainWin.setAlwaysOnTop(true);
mainWin.setAlwaysOnTop(false);
</code></pre></div>
<p dir="auto">But still no success in focusing it.</p>
<ul dir="auto">
<li>Electron version: the one bundled with Atom 1.7.1, also 0.36.0</li>
<li>Operating system: Linux</li>
</ul>
<p dir="auto">The "focus()" call does not actually focus the window, it only raises it. Focus remains in the caller app (terminal, for instance).</p>
<p dir="auto">No "focus stealing prevention" is used. This can be reproduced on multiple window managers (xfwm, unity).</p>
<p dir="auto">Steps to reproduce, using Atom (as an example -- works with any other Electron-based app that focuses itself):</p>
<ol dir="auto">
<li>open terminal</li>
<li><code class="notranslate">atom myfile.txt</code></li>
<li>switch back to terminal</li>
<li><code class="notranslate">atom myfile.txt</code></li>
<li>note that Atom raised itself, but the focus is still in terminal.</li>
</ol>