Electron-SWD - Set The Window Down
Electron add-on for setting the window down by z-index
- Windows
npm install electron-swd
import { app, BrowserWindow, ipcMain } from "electron";
import { toBottom } from "electron-swd";
let win: BrowserWindow | null = null;
const createWindow = () => {
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: true,
contextIsolation: false,
},
});
win.loadFile("../index.html");
};
ipcMain.handle("to-bottom", (_) => {
if (win !== null) {
// get the hwnd Buffer and pass it to the toBottom parameters
toBottom(win.getNativeWindowHandle());
}
});
// ...
If you want the window to always be set lower than everyone else, create the following code for yourself
win.on("focus", () => {
toBottom(win.getNativeWindowHandle());
});