Created
January 2, 2026 15:57
-
-
Save anechunaev/c2a8f0991cc017889018e9242d6053f1 to your computer and use it in GitHub Desktop.
Wayland error on minimized windows with custom (hidden) title bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <title>Hello World!</title> | |
| </head> | |
| <body> | |
| <h1>Hello World!</h1> | |
| </body> | |
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const { app, BaseWindow, WebContentsView, nativeImage, Tray } = require('electron'); | |
| let mainWindow = null; | |
| const trayIconDataString = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAABzUlEQVRYR+2Xy0oDMRSGz5l6i1XUiqkKulAUBG9t7MaFC0V8HR/F53EhSHFl0xZdWl2ISDvVtl5oajGJzGih0ykqQ0o38y+HmZwv/39OwiD0Wdjn+iGA34HiZjEaGZx40QARk/EggKy91GMrhenX9nV9PWAnhQLsXTSUE09NPwAT2uTOOxUCGHYAj78t1if/jc0YAALWZvjIlFO4zBpVDXryPxCGAFBoVIfxzOiFC5BsMo0qDaDJXxCBATTgUZyPnFbYx0aMD193K2TvNBM0M5SzE2IPLDjv9k5ggM4Pn5IfaxJlGjVYoAb2aX4o317QTgoJCJa5MdRwQ7Nk1VmwuPm2bg0OeF2QMkHzYy5EiYkrBNgw6oCjlgtlJp41QKyjQJ1yEnWe/XaYBY6gHcBmjSr4u75BOXGbsFcAD5STBdfixPsWWhFP5qhUaiYXzfwAFABg2WgEvibcbqakJdPoNJqGA5olaU8TMvEJXW7UwBEoDQezWXL2yCqL8zx23213pVRtKX45eVfaru9iBN0zwtwUeIQCpLXbGj1nJBVq3tODqFN9Popb6uNlFFSBm9CUQoA/HbhllYlxIFUw/9OipfqMz+XGy+1xhr9moQNfj8L1Idb+4ZYAAAAASUVORK5CYII="; | |
| if (!app.requestSingleInstanceLock()) { | |
| app.quit(); | |
| process.exit(0); | |
| } else { | |
| app.on('second-instance', () => { | |
| if (mainWindow) { | |
| if (mainWindow.isMinimized()) mainWindow.restore(); | |
| mainWindow.show(); | |
| mainWindow.focus(); | |
| } | |
| }); | |
| app.on('window-all-closed', (event) => { | |
| if (process.platform !== 'darwin') { | |
| event.preventDefault(); | |
| } | |
| }); | |
| app.whenReady().then(() => { | |
| // Create main window | |
| mainWindow = new BaseWindow({ | |
| title: 'Hello World!', | |
| width: 200, | |
| height: 120, | |
| titleBarStyle: 'hidden', | |
| titleBarOverlay: { | |
| color: "#FFFFFF", | |
| height: 40, | |
| }, | |
| }); | |
| const view = new WebContentsView(); | |
| mainWindow.contentView.addChildView(view); | |
| view.setBounds({ | |
| x: 0, | |
| y: 40, | |
| width: 200, | |
| height: 120, | |
| }); | |
| view.webContents.loadFile('index.html'); | |
| mainWindow.on('minimize', function (event) { | |
| event.preventDefault(); | |
| mainWindow.hide(); | |
| }); | |
| mainWindow.on('close', function (event) { | |
| event.preventDefault(); | |
| mainWindow.hide(); | |
| }); | |
| // Create tray | |
| const icon = nativeImage.createFromDataURL(trayIconDataString); | |
| const tray = new Tray(icon); | |
| tray.on('click', () => { | |
| if (mainWindow.isVisible()) { | |
| mainWindow.hide(); | |
| } else { | |
| mainWindow.show(); | |
| } | |
| }); | |
| }); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "name": "organic-bee-eliminate-staw9", | |
| "productName": "organic-bee-eliminate-staw9", | |
| "description": "My Electron application description", | |
| "keywords": [], | |
| "main": "./main.js", | |
| "version": "1.0.0", | |
| "author": "an", | |
| "scripts": { | |
| "start": "electron ." | |
| }, | |
| "dependencies": {}, | |
| "devDependencies": { | |
| "electron": "38.2.0" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment