npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

electray

v2.0.3

Published

Full support for tray notify icon of windows shell on electron

Downloads

3

Readme

npm version npm bundle size npm downloads GitHub last commit
platform npm dev dependency version node-current

Electray

Full support for tray notify icon of Windows Shell on Electron

Installation

You can install Electray using npm:

npm install electray

Example

Electray is very simple to use:

Typescript:

import * as electron from 'electron';
import * as electray from 'electray';
electron.app.on("ready", (event, launchInfo) => {
    let window: electron.BrowserWindow = new electron.BrowserWindow({
        width: 1024,
        height: 768
    });
    let tray: electray.Electray = new electray.Electray({
        window: window,
        icon: "default",
        showIcon: true,
        tips: "This is a Electray icon",
        showTips: true
    });
    tray.on('Select', (x, y) => {
        tray.showBalloon({
            title: `title`,
            information: `information`,
            icon: `info`,
            timeoutMilliSeconds: 15000
        });
    });
    window.on('close', (event) => {
        tray.showIcon = false;
    });
    window.loadURL(`http://www.baidu.com`);
});
electron.app.on("window-all-closed", () => {
    process.exit();
});

Javascript:

const electron = require('electron');
const electray = require('electray');
electron.app.on("ready", (event, launchInfo) => {
    let window = new electron.BrowserWindow({
        width: 1024,
        height: 768
    });
    let tray = new electray.Electray({
        window: window,
        icon: "default",
        showIcon: true,
        tips: "This is a Electray icon",
        showTips: true
    });
    tray.on('Select', (x, y) => {
        tray.showBalloon({
            title: `title`,
            information: `information`,
            icon: `info`,
            timeoutMilliSeconds: 15000
        });
    });
    window.on('close', (event) => {
        tray.showIcon = false;
    });
    window.loadURL(`http://www.baidu.com`);
});
electron.app.on("window-all-closed", () => {
    process.exit();
});

Properties

showTips

Specifics whether the tips will be show or not when user cursor stay at the icon.

tips

Tips content to popup when user cursor stay at the icon.

  • PopupOpen and PopupClose event can be trigger only if tips has been set.

showIcon

Specifics whether the icon will be show or not.

icon

Icon use of notify icon tray.

Values of icon:

|Value|note| |-----|----| |'none'|Empty icon.| |'default'|Windows system default application icon.| |'window'|Use icon of window from construction options, this window must has icon settled.| |Buffer|A buffer has a .ico file inside.|

Methods

|Method|note| |------|----| |showBalloon|Popup a balloon to show message.|

Events

|Event|params|note| |-----|------|----| |Select|x, y|Mouse click select tray icon.| |KeySelect|x, y|Keyboard select tray icon| |ContextMenu|x, y|Mouse right click on icon or context menu key pressed| |-|-|| |PopupOpen|x, y|Popup tips when cursor stay at notify tray icon. This event can be trigger only if tips has been set.| |PopupClose|-|Popup tips closed.| |-|-|| |BalloonShow|x, y|| |BalloonHide|x, y|When does this event will be trigger is a mystery| |BalloonTimeout|x, y|| |BalloonUserClick|x, y|| |-|-|| |MouseMove|x, y|| |MouseLeftButtonDown|x, y|| |MouseLeftButtonUp|x, y|| |MouseLeftButtonDoubleClick|x, y|| |MouseRightButtonDown|x, y|| |MouseRightButtonUp|x, y|| |MouseRightButtonDoubleClick|x, y|| |MouseMiddleButtonDown|x, y|| |MouseMiddleButtonUp|x, y|| |MouseMiddleButtonDoubleClick|x, y||

devDependencies

  • @types/node
  • electron

Remarks

Electray has pre-build both ia32 and x64 binaries of Windows native Node.JS add-on module, it will auto detect the arch you need and copy 2 files during postinstall, If you got problems with arch, you can simplely re-install Electray.

Links