Skip to content

Instantly share code, notes, and snippets.

@PsychoLlama
Created March 3, 2023 00:08
Show Gist options
  • Save PsychoLlama/fcb2790372b6e4957beac9be7e543d3d to your computer and use it in GitHub Desktop.
Save PsychoLlama/fcb2790372b6e4957beac9be7e543d3d to your computer and use it in GitHub Desktop.
Electron Overlay Duplicate Dock Icon Repro
const { app, BrowserWindow } = require("electron");
async function createWindow() {
const win = new BrowserWindow({
width: 600,
height: 400,
});
win.setVisibleOnAllWorkspaces(true, {
// Transforms process type to `UIElementApplication`.
visibleOnFullScreen: true,
});
await win.loadFile("./plain-window.html");
// Waits 1s, then transforms process type to `ForegroundApplication`.
// The timer avoids contention with `dock.hide()` to avoid the same
// bug demonstrated here.
app.dock.show();
return win;
}
app.on("ready", async () => {
(await createWindow()).close();
(await createWindow()).close();
(await createWindow()).close();
await createWindow();
});
{
"name": "duplicate-dock-icon-repro",
"productName": "duplicate-dock-icon-repro",
"description": "My Electron application description",
"keywords": [],
"main": "./main.js",
"version": "1.0.0",
"author": "Jesse Gibson",
"scripts": {
"start": "electron ."
},
"dependencies": {},
"devDependencies": {
"electron": "23.1.1"
}
}
<!DOCTYPE html>
<html>
<head>
<title>Plain Window</title>
</head>
<body>
<p>
<em>This page intentionally left blank</em>
</p>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment