GithubHelp home page GithubHelp logo

lowfront / electget Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 0.0 75 KB

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

TypeScript 82.84% HTML 5.42% JavaScript 11.11% CSS 0.64%
electron macos napi node-ffi windows

electget's Introduction

Electget


electget

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

  • [Windows, macOS] 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.

Install

This package uses ffi-napi, so you must meet the ffi-napi requirements before installation.

npm i electget

Usage

Electget is available in the Electron main process.

import electget from '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, macOS] 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, macOS] preventFromShowDesktop(win)

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

Prevent BrowserWindow from being hidden in ShowDesktop and minimized.

[Windows, macOS] 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.

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 package and remove the node package from the bundle with the Webpack externals setting as follows:

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

Roadmap

  • Method failure check.
  • Add MacOS support.
  • Add test code.

electget's People

Contributors

lowfront avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

electget's Issues

Add Working Example

Hi!
I'm having trouble making it work, could you please share a simple working example?

Thanks!

preventChangeZOrder hide the desktop icon

When press Win+D to show desktop,The window is pinned to the desktop but all the desktop icons are hidden.
When active another window, the desktop icons shown.

OS: Windows 10 1709
Code:

win.show();
electget.alwaysOnBottom(win);

image

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.