Skip to content

Instantly share code, notes, and snippets.

View t57ser's full-sized avatar

t57ser

  • Vienna, Austria
View GitHub Profile
@t57ser
t57ser / index.html
Created September 20, 2024 12:11
Electron Crash when trying to focus a webview
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<webview src="https://www.google.com"/>
</body>
</html>
@t57ser
t57ser / main.js
Created August 8, 2024 09:39
WebContentsView does not apply bounds until visible
const {app, BrowserWindow, ipcMain, WebContentsView} = require('electron')
const path = require('path')
let mainWindow
function createWindow () {
const mainWindow1 = new BrowserWindow({
x: 0,
y: 0,
@t57ser
t57ser / main.js
Created June 24, 2024 12:18
[Bug]: Using app.disableHardwareAcceleration() makes window disappear
const {app, BrowserWindow, ipcMain, WebContentsView} = require('electron')
let mainWindow
function createWindow () {
const mainWindow1 = new BrowserWindow({
x: 0,
y: 0,
width: 1000,
@t57ser
t57ser / main.js
Created June 19, 2024 07:25
webContentsView steals focus after loading url
const {app, BrowserWindow, ipcMain, WebContentsView} = require('electron')
let mainWindow
function createWindow () {
const mainWindow1 = new BrowserWindow({
x: 0,
y: 0,
width: 1000,
@t57ser
t57ser / main.js
Created February 20, 2024 13:19
Electron 29 incorrect key
let { app, BrowserWindow, ipcMain, session} = require("electron")
const electron = require("electron");
function createWindow() {
let win = new BrowserWindow({
})
win.loadURL("https://www.example.com");
win.webContents.on("before-input-event", (event, input) => {
console.log("before-input-event",input);
let { app, BrowserWindow, ipcMain, session} = require("electron")
const electron = require("electron");
function createWindow() {
let win = new BrowserWindow({
})
win.loadURL("https://www.example.com");
win.webContents.openDevTools({mode: "undocked"});
}
@t57ser
t57ser / main.js
Created November 30, 2023 12:43
Can not reopen devtools with electron 28.0.0-beta.10
let { app, BrowserWindow, ipcMain, session} = require("electron")
const electron = require("electron");
function createWindow() {
let win = new BrowserWindow({
})
win.loadURL("https://www.example.com");
win.webContents.on("context-menu", (e, props) => {
const menu = new electron.Menu();
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
Text
</body>
</html>
@t57ser
t57ser / index.html
Created October 20, 2023 06:52
Electron transparency issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
CLICK ME
</body>
</html>
<!DOCTYPE html>
<html>
<style>
body {
background: black;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;