All Projects → sfatihk → Electron Tray Window

sfatihk / Electron Tray Window

Licence: mit
🖼️ Generates custom tray windows with Electron.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Electron Tray Window

nativescript-menu
A plugin that adds a pop-up menu to NativeScript
Stars: ✭ 17 (-76.06%)
Mutual labels:  popup, menu
Selectmenu
Simple, easily and diversity menu solution
Stars: ✭ 284 (+300%)
Mutual labels:  menu, popup
Menu
The most customizable menu for macOS apps.
Stars: ✭ 84 (+18.31%)
Mutual labels:  popup, menu
Dropdownmenukit
UIKit drop down menu, simple yet flexible and written in Swift
Stars: ✭ 246 (+246.48%)
Mutual labels:  menu, popup
Debuguisystem
Create a runtime menu system with buttons and windows for debugging in one line of code.
Stars: ✭ 48 (-32.39%)
Mutual labels:  window, menu
React Layer Stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 152 (+114.08%)
Mutual labels:  window, popup
Tana
Bringing the Picture-in-Picture experience to the desktop.
Stars: ✭ 109 (+53.52%)
Mutual labels:  window, electronjs
Tippyjs
Tooltip, popover, dropdown, and menu library
Stars: ✭ 9,433 (+13185.92%)
Mutual labels:  menu, popup
Django Admin Interface
django's default admin interface made customizable. popup windows replaced by modals. :mage: ⚡️
Stars: ✭ 717 (+909.86%)
Mutual labels:  window, popup
Fwpopupview
弹窗控件:支持AlertView、Sheet、自定义视图的PopupView。AlertView中可以嵌套自定义视图,各组件的显示隐藏可配置;Sheet仿微信样式;同时提供自定义弹出。更多配置请参考”可设置参数“,提供OC使用Demo。
Stars: ✭ 361 (+408.45%)
Mutual labels:  menu, popup
Material Ui Popup State
boilerplate for common Material-UI Menu, Popover and Popper use cases
Stars: ✭ 186 (+161.97%)
Mutual labels:  menu, popup
Ybpopupmenu
快速集成popupMenu
Stars: ✭ 816 (+1049.3%)
Mutual labels:  menu, popup
Cascade
Nested popup menus with smooth height animations
Stars: ✭ 1,493 (+2002.82%)
Mutual labels:  menu, popup
react-layer-stack
Layering system for React. Useful for popover/modals/tooltip/dnd application
Stars: ✭ 158 (+122.54%)
Mutual labels:  popup, window
Customalertviewdialogue
Custom AlertView Dialogue is the world's most advanced alert view library. Custom AlertView Dialogue includes simple message popups, confirmation alerts, selector popups, action sheet bottom menus, and input/feedback contact forms.
Stars: ✭ 100 (+40.85%)
Mutual labels:  menu, popup
plain-modal
The simple library for customizable modal window.
Stars: ✭ 21 (-70.42%)
Mutual labels:  popup, window
Fwpopupviewoc
信手拈来的OC弹窗库:1、继承 FWPopupBaseView 即可轻松实现各种位置、动画类型的弹窗;2、新功能引导弹窗。更多弹窗场景等你来挑战,总之,想怎么弹就怎么弹!!!
Stars: ✭ 70 (-1.41%)
Mutual labels:  menu, popup
Vc Popup
一个行为标准的vue popup组件集
Stars: ✭ 289 (+307.04%)
Mutual labels:  menu, popup
Anylayer
Android稳定高效的浮层创建管理框架
Stars: ✭ 745 (+949.3%)
Mutual labels:  menu, popup
Fepopupmenucontroller
A simple, elegant pop-up menu view
Stars: ✭ 32 (-54.93%)
Mutual labels:  menu, popup

npm version npm version npm version npm version npm version

Quickly create customizable menu/pop-up for your application in system tray.


Electron Tray Window, basically places the window near the tray icon. While these happening, you can customize window / tray or tracking the events.

Preview demo project

Install

npm install electron-tray-window

or

yarn add electron-tray-window

Usage

const trayWindow = require("electron-tray-window");

You can use different ways. "setOptions()" function accepts object value.

If you have already created tray or window outside TrayWindow, you can pass as arguments to .setOptions() function,

//...

tray = new Tray(...);
window = new BrowserWindow(...);
window.loadUrl(...);

trayWindow.setOptions({tray: tray,window: window});

//...

or if you pass just tray icon path or window url, it prepare automatically.

//...

trayWindow.setOptions({
  trayIconPath: "...",
  windowUrl: "..."
});

//...

By the way you can make different combines. But object must contains;

  • tray or trayIconPath
  • window or windowUrl
//...

tray = new Tray(...);
trayWindow.setOptions({
  tray: tray,
  windowUrl: "..."
});

//...

window = new BrowserWindow(...);

trayWindow.setOptions({
  trayIconPath: "...",
  window: window
});

//...

Other Functions

You can always change TrayWindow with setOptions() and you can use different functions after setOptions().

.setTray( tray )

//...

trayWindow.setOptions({...});

//...

differentTray = new Tray(...);

trayWindow.setTray(differentTray); //now, follows different tray

//..

.setWindow( window )

//...

trayWindow.setOptions({...});

//...

differentWindow = new BrowserWindow(...);

trayWindow.setWindow(differentWindow); //now, shows different window

//..

.setWindowSize( object )

//...

trayWindow.setOptions({...});

//...

differentWindow = new BrowserWindow(...);

trayWindow.setWindowSize({
    width    : 200,    //optional
    height   : 300,   //optional
    margin_x : 10,  //optional
    margin_y : 10   //optional
});

//..

Events

You can listen events. All event contains window and tray objects

//...
const { ipcMain } = electron;

ipcMain.on("tray-window-ready", (e, a) => {
  console.log("tray window is ready");
  //console.log(e.window)
  //console.log(e.tray)
});

ipcMain.on("tray-window-clicked", (e, a) => {
  console.log("clicked the tray icon");
  //console.log(e.window)
  //console.log(e.tray)
});

ipcMain.on("tray-window-visible", (e, a) => {
  console.log("tray window is visible now");
  //console.log(e.window)
  //console.log(e.tray)
});

ipcMain.on("tray-window-hidden", (e, a) => {
  console.log("tray window is hidden now");
  //console.log(e.window)
  //console.log(e.tray)
});

//..

Overview

All parameters of setOptions()

parameter description default
tray Electron's tray object type
trayIconPath Image file path
window Electron's BrowserWindow object type
windowUrl Html etc. file path or website url
width Window width 200px
height Window height 200px
margin_x Vertical distance between window and tray icon 0px
margin_y Horizontal distance between window and tray icon 0px
framed Is it window framed? false

Other functions

function description
setTray Electron's tray object type.
setWindow Electron's BrowserWindow object type
setWindowSize Object type. Optional arguments width, height, margin_x, margin_y

IPC (Inter-Process Communication) Events

event description
tray-window-ready when created TrayWindow.
tray-window-clicked when clicked tray icon
tray-window-visible when window show up
tray-window-hidden when window close down

Default Window Properties

properties default in TrayWindow
width 200px
height 300px
maxWidth 200px
maxHeight 300px
show false
frame false
fullscreenable false
resizable false
useContentSize true
transparent true
alwaysOnTop true
webPreferences{backgroundThrottling} false

P.S. : if you use this way setOptions({windowUrl:"..."}), default window values uses.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].