Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Armaldio/electron-bottom-most

Repository files navigation

image (PR welcome for linux and Mac!)

This module allow you to set the window attached to the HWND handle to be placed at the lowest z-index available aka bottom-most

It's the inverse of top-most.

Electron indeed have a top-most property but do not have a bottom-most one.

This native module is a wrapper around SetWindowPosition Win32 API function.

Installation

npm i -S electron-bottom-most   # install the module

./node_modules/.bin/electron-rebuild -f -w electron-bottom-most   # rebuild the module to match your electron version

Usage

Look at the index.html, index.js and package.json file to integrate it into your Electron application

Basically it consists of 2 steps

  • Include the module in your .js file:
import { SetBottomMost } from 'electron-bottom-most';
 - or -
const { SetBottomMost } = require('electron-bottom-most');
  • Create your Electron BrowserWindow
let mainWindow = new BrowserWindow({
    height: 800,
    width: 800,
    useContentSize: true,
    transparent: !isDev,
    frame: isDev,
    focusable: isDev,
    show: false
});

// load it
mainWindow.loadURL(__dirname + "/index.html");

//show it
mainWindow.show();

// get the native HWND handle
let handle = mainWindow.getNativeWindowHandle();

// set bottom most!
SetBottomMost(handle);

Todo

  • Make it safe please

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE file for details