# @moehuhu/electget

> Electron tools for creating Windows widgets that are fixed to desktop.

Latest version **0.3.0** (published 2026-09-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install @moehuhu/electget
pnpm add @moehuhu/electget
yarn add @moehuhu/electget
bun add @moehuhu/electget
```

## Health

**Score 55/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads; no types; no esm support; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2026-09-24 |
| First published | 2026-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | lowfront |
| Maintainers | moehuhu |
| Keywords | electron, always on bottom, prevent showdesktop, prevent aeropeek, widget, windows, koffi |

## Links

- npm: https://www.npmjs.com/package/@moehuhu/electget
- Repository: https://github.com/moehuhu/electget
- Issues: https://github.com/moehuhu/electget/issues
- npm.io page: https://npm.io/package/@moehuhu/electget

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2026-09-24
- 0.2.3 — 2026-09-24
- 0.2.2 — 2026-09-24
- 0.2.1 — 2026-09-24
- 0.2.0 — 2026-09-24

## README

# Electget
<br>
<div align="center">
  <img alt="electget" src="https://raw.githubusercontent.com/moehuhu/electget/master/logo.svg" height="170px" />
</div>
<br>

`Electron` tools for creating Windows widgets that are fixed to desktop. This package provides features for widget creation of your Electron application.

- [Windows] Prevent `BrowserWindow` from being hidden in ShowDesktop.
- [Windows] Prevent `BrowserWindow` from being minimized.
- [Windows] Prevent `BrowserWindow` from being hidden in AeroPeek.
- [Windows] Prevent changes in the `BrowserWindow` order.
- [Windows] Move `BrowserWindow` to the bottom of the windows.
- [Windows] Move `BrowserWindow` to the top of the windows.

## Install

This package uses [`koffi`](https://koffi.dev), which ships prebuilt binaries for Node.js and Electron.

```
npm i @moehuhu/electget
```

## Usage

Electget is available in the Electron main process.

```js
import electget from '@moehuhu/electget';

function createWindow() {
  const win = new BrowserWindow({
    title: 'Electget Test',
    height: 600,
    width: 800,
  });

  loadWindow(win);

  // [Windows] Prevent BrowserWindow from being hidden in AeroPeek.
  electget.preventFromAeroPeek(win);

  // [Windows] Prevent BrowserWindow from being hidden in ShowDesktop.
  electget.preventFromShowDesktop(win);

  // [Windows] Prevent changes in the BrowserWindow order.
  electget.preventChangeZOrder(win);

  // [Windows] Move BrowserWindow to the bottom of the windows
  electget.moveToBottom(win);

  return win;
}
```

### Methods

#### [`Windows`] alwaysOnBottom(browserWindow)

- `win` BrowserWindow - Target BrowserWindow object.

`BrowserWindow` is fixed to the bottom without being minimized.
Apply `moveToBottom`, `preventChangeZOrder`, `preventFromShowDesktop` at once.

#### [`Windows`] cancelAlwaysOnBottom(browserWindow)

- `win` BrowserWindow - Target BrowserWindow object.

Cancel of `alwaysOnBottom` method.

#### [`Windows`] preventFromAeroPeek(win)

- `win` Buffer|BrowserWindow - Target BrowserWindow object or Buffer returned by getNativeWindowHandle.

Prevent `BrowserWindow` from being hidden in AeroPeek.

#### [`Windows`] preventFromShowDesktop(win)

- `win` Buffer|BrowserWindow - Target BrowserWindow object or Buffer returned by getNativeWindowHandle.

Prevent `BrowserWindow` from being hidden in ShowDesktop and minimized.

#### [`Windows`] cancelPreventFromShowDesktop(win)

- `win` Buffer|BrowserWindow - Target BrowserWindow object or Buffer returned by getNativeWindowHandle.

Cancel of `preventFromShowDesktop` method.

#### [`Windows`] preventChangeZOrder(browserWindow)

- `win` BrowserWindow - Target BrowserWindow object.

Returns `function` - Cancel of `preventChangeZOrder` method.

Prevent changes in the `BrowserWindow` order.

#### [`Windows`] cancelPreventChangeZOrder(browserWindow)

- `win` BrowserWindow - Target BrowserWindow object.

Returns `function` - Cancel of `preventChangeZOrder` method.

Cancel of `preventChangeZOrder` method.

#### [`Windows`] moveToBottom(win)

- `win` Buffer|BrowserWindow - Target BrowserWindow object or Buffer returned by getNativeWindowHandle.

Move `BrowserWindow` to the bottom of the windows.

#### [`Windows`] moveToTop(win)

- `win` Buffer|BrowserWindow - Target BrowserWindow object or Buffer returned by getNativeWindowHandle.

Move `BrowserWindow` to the top of the windows.

#### [`Windows`] alwaysOnTop(browserWindow)

- `win` BrowserWindow - Target BrowserWindow object.

`BrowserWindow` is fixed to the top of the windows.
Apply `moveToTop`, `preventChangeZOrder` at once.

#### [`Windows`] cancelAlwaysOnTop(browserWindow)

- `win` BrowserWindow - Target BrowserWindow object.

Cancel of `alwaysOnTop` method.

## Guidelines for Using Webpack

Because `Webpack` bundles the source code, the following error occurs when `Webpack` is used for the main process: `Error: No native build was found ...`

You can install the [webpack-node-externals](https://www.npmjs.com/package/webpack-node-externals) package and remove the node package from the bundle with the `Webpack` externals setting as [follows](https://github.com/node-ffi-napi/node-ffi-napi/issues/157#issuecomment-846426023):

```js
// webpack.config.js
const nodeExternals = require('webpack-node-externals');
module.exports = {
  ...
  externals: [nodeExternals()],
  ...
}
```

## Roadmap

- [ ] Method failure check.
- [ ] Add test code.

---
_Source: https://npm.io/package/@moehuhu/electget · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
