コード例 #1
0
app.on('ready', function(){
  mainWindow = createMainWindow();
  aboutWindow = createAboutWindow();
  appIcon = new Tray(iconPath);
  var contextMenu = Menu.buildFromTemplate([
    {
        label: 'About',
        click: function () {
          About();
        }
    },
    {
      label: 'Toggle DevTools',
      click: function() {
        mainWindow.openDevTools();
      }
    },
    { label: 'Quit',
      click: function() {
        app.quit();
      }
    }
  ]);
  appIcon.setToolTip('Multiwindow');
  appIcon.setContextMenu(contextMenu);
});
コード例 #2
0
ファイル: main.js プロジェクト: RacZo/MaterialColorsApp
function updateUiMode() {
  // Build or teardown tray
  if (isTrayMode) {
    if (!trayIcon) {
      trayIcon = new electron.Tray(__dirname + '/assets/TrayIconTemplate.png');
      trayIcon.setToolTip(app.getName());
    }
  } else if (trayIcon) {
    trayIcon.destroy();
    trayIcon = null;
  }

  // Build or teardown dock
  if (!isTrayMode) {
    app.dock.show();
  } else {
    app.dock.hide();
  }

  // Update menu
  var menuItems = [];

  if (isTrayMode) {
    menuItems.push({
      label: mainWindow.isVisible() ? 'Hide Colors' : 'Show Colors',
      click: () => {
        mainWindow[mainWindow.isVisible() ? 'hide' : 'show']();
        updateUiMode();
      }
    });
  }

  menuItems.push({
    label: isTrayMode ? 'Switch to Normal App Mode' : 'Switch to Menu Bar Mode',
    click: () => {
      isTrayMode = !isTrayMode;
      updateUiMode();
    }
  });

  menuItems.push({ type: 'separator' });
  menuItems.push({ label: 'About ' + app.getName(), role: 'about' });

  if (isTrayMode) {
    menuItems.push({ label: 'Quit', click: () => app.quit() });
  }

  var contextMenu = electron.Menu.buildFromTemplate(menuItems);

  if (isTrayMode) {
    trayIcon.setContextMenu(contextMenu);
    mainWindow.setAlwaysOnTop(true);
  } else {
    app.dock.setMenu(contextMenu);
    mainWindow.setAlwaysOnTop(false);
  }

  //electron.Menu.setApplicationMenu(contextMenu);
  writePrefs();
}
コード例 #3
0
ファイル: main.js プロジェクト: gencebay/banoty
electron_1.app.on('ready', function () {
    mainWindow = new electron_1.BrowserWindow({ show: false });
    mainWindow.loadURL('file://' + __dirname + '/window.html');
    appIcon = new electron_1.Tray(iconPath);
    var contextMenu = electron_1.Menu.buildFromTemplate([
        {
            label: 'Bilge Adam Bilgilendirme Merkezi',
            icon: iconPath
        },
        {
            label: 'Duyuru',
            click: function () {
                let options = { body: "Sistem ayarları güncellemesi başlatılacaktır!" };
                createNotification("Bilge Adam Bilgilendirme", options);
            }
        },
        {
            label: 'Aç',
            click: function () {
                mainWindow.show();
            }
        },
        {
            label: 'Kapat',
            click: function () {
                mainWindow.hide();
            }
        }
    ]);
    appIcon.setToolTip('Bilge Adam Bilgilendirme');
    appIcon.setContextMenu(contextMenu);
});
コード例 #4
0
  constructor(splashWindow, mainWindow) {
    this.splashWindow = splashWindow;
    this.mainWindow = mainWindow;

    let image;
    let file;
    if (process.platform === 'linux') {
      file = path.join(__dirname, config.tray.icon);
      image = nativeImage.createFromPath(file);
    } else {
      file = path.join(__dirname, config.tray.iconMac);
      image = nativeImage.createFromPath(file);
    }
    image.setTemplateImage(true);

    this.tray = new Tray(image);
    this.tray.setToolTip(config.tray.title);

    if (process.platform === 'linux') {
      let contextMenu = Menu.buildFromTemplate([
        {
          label: 'Show', click: () => this.hideSplashAndShowWeChat()
        },
        {
          label: 'Exit',
          click: () => app.exit(0)
        }

      ]);
      this.tray.setContextMenu(contextMenu);
    } else {
      this.tray.on('click', () => this.hideSplashAndShowWeChat());
    }
  }
コード例 #5
0
ファイル: index.js プロジェクト: droghio/Sia-UI
app.on('ready', () => {
	// Load mainWindow
	mainWindow = initWindow(config)
	appIcon = new Tray(Path.join(app.getAppPath(), 'assets', 'tray.png'))
	appIcon.setToolTip('Sia - The Collaborative Cloud.')
	appIcon.setContextMenu(appTray(mainWindow))
})
コード例 #6
0
ファイル: app_tray.js プロジェクト: 1-Hash/electronic-wechat
  constructor(splashWindow, wechatWindow) {
    this.splashWindow = splashWindow;
    this.wechatWindow = wechatWindow;

    let image;
    if (process.platform == "linux") {
      image = nativeImage.createFromPath(path.join(__dirname, '../../../assets/status_bar_linux.png'));
    } else {
      image = nativeImage.createFromPath(path.join(__dirname, '../../../assets/status_bar.png'));
    }
    image.setTemplateImage(true);

    this.tray = new Tray(image);
    this.tray.setToolTip(Common.ELECTRONIC_WECHAT);

    if (process.platform == "linux") {
      let contextMenu = Menu.buildFromTemplate([
        {label: 'Show', click: () => this.hideSplashAndShowWeChat()},
        {label: 'Exit', click: () => app.exit(0)}
      ]);
      this.tray.setContextMenu(contextMenu);
    } else {
      this.tray.on('click', () => this.hideSplashAndShowWeChat());
    }
  }
コード例 #7
0
ファイル: main.js プロジェクト: andrewleech/rcBrowser
app.on('ready', function(){
  createWindow();

  appIcon = new Tray(iconPath);
  var contextMenu = Menu.buildFromTemplate([
    {
      label: 'Toggle DevTools',
      accelerator: 'Alt+Command+I',
      click: function() {
        win.show();
        win.toggleDevTools();
      }
    },
    { label: 'Show',
      click: function() {
        win.setFullScreen(true);
        win.show();
        console.log('manual show');
        console.log(win);
      }
    },
    { label: 'Quit',
      accelerator: 'Command+Q',
      selector: 'terminate:',
    }
  ]);
  appIcon.setToolTip('rcBrowser');
  appIcon.setContextMenu(contextMenu);
});
コード例 #8
0
ファイル: mainmain.js プロジェクト: nehbit/aether-public
function EstablishTray() {
    if (tray !== null) {
        return;
    }
    /*----------  Tray functions  ----------*/
    /*----------  Tray functions END  ----------*/
    var trayIconLocation = '';
    if (process.platform === 'darwin') {
        trayIconLocation = 'ext_dep/images/TrayTemplate.png';
    }
    if (process.platform === 'win32') {
        trayIconLocation = 'ext_dep/images/WindowsTrayIconAlt3.png';
        // trayIconLocation = "ext_dep/images/WindowsTrayIcon.ico"
    }
    if (process.platform === 'linux') {
        trayIconLocation = 'ext_dep/images/LinuxTrayIcon.png';
    }
    tray = new elc.Tray(path.join(__dirname, trayIconLocation));
    tray.setToolTip('Aether');
    var contextMenu = elc.Menu.buildFromTemplate(contextMenuTemplate);
    tray.setContextMenu(contextMenu);
    tray.on('click', function () {
        // On windows, the convention is that when an icon in the tray is clicked, it should spawn the app window.
        if (process.platform === 'win32') {
            openAppWindow();
        }
    });
}
コード例 #9
0
ファイル: main.js プロジェクト: ekonstantinidis/gitify
  function createAppIcon() {
    let trayIcon = new Tray(iconIdle);

    const trayMenu = Menu.buildFromTemplate([
      {
        label: 'Show Gitify',
        click() {
          appWindow.show();
        },
      },
      {
        type: 'separator',
      },
      {
        label: 'Quit',
        accelerator: isDarwin ? 'Command+Q' : 'Alt+F4',
        role: 'quit',
      },
    ]);

    trayIcon.setToolTip('GitHub Notifications on your menu bar.');

    if (isLinux) {
      trayIcon.setContextMenu(trayMenu);
    } else {
      trayIcon.on('click', () => {
        appWindow.isFocused() ? appWindow.hide() : appWindow.show();
      });
    }

    return trayIcon;
  }
コード例 #10
0
ファイル: main.js プロジェクト: bencevans/lumenaire
app.on('ready', function (){
  win = new BrowserWindow({show: false});
  appIcon = new Tray(iconPath);
  var contextMenu = Menu.buildFromTemplate([
    {
      label: 'Links',
      submenu: [
        {
          label: 'Website / GitHub',
          click: () => {
            open('https://github.com/bencevans/lumenaire')
          }
        },
        {
          label: 'Discussion / Issues',
          click: () => {
            open('https://github.com/bencevans/lumenaire/issues')
          }
        }
      ]
    },
    { label: 'Quit',
      accelerator: 'Command+Q',
      selector: 'terminate:',
    }
  ]);
  appIcon.setContextMenu(contextMenu);
});
コード例 #11
0
ファイル: main.js プロジェクト: konsumer/livewallpaper
app.on('ready', () => {
  // multi-monitor support: https://github.com/electron/electron/pull/1016
  // console.log('screens', screen.getAllDisplays())

  tray = new Tray('icon.png')
  const contextMenu = Menu.buildFromTemplate([
    {label: 'Reload', click () { mainWindow.reload() }}
  ])
  tray.setToolTip('This is my application.')
  tray.setContextMenu(contextMenu)

  mainWindow = new BrowserWindow({
    transparent: true,
    frame: false,
    // type: 'desktop',
    skipTaskbar: true
  })
  mainWindow.webContents.openDevTools()
  mainWindow.loadURL(`file://${__dirname}/index.html`)
  mainWindow.on('closed', () => {
    mainWindow = null
    tray = null
  })
  mainWindow.maximize()
  mainWindow.show()
})
コード例 #12
0
ファイル: main.js プロジェクト: sylvain121/remoteComputerjs
app.on('ready', function () {

//  capture.setDistantScreenSize(1366, 768);
//  capture.toggle();

	var os = require('os');
	var socket = require('./socket');
	var interfaces = os.networkInterfaces();
	var addresses = [];
	for (var k in interfaces) {
		for (var k2 in interfaces[k]) {
			var address = interfaces[k][k2];
			if (address.family === 'IPv4' && !address.internal) {
				addresses.push({label :'http://' + address.address + ':3000/'});

			}

		}

	}

	win = new BrowserWindow({show: false});
	appIcon = new Tray(iconPath);
	var contextMenu = Menu.buildFromTemplate(addresses);
	appIcon.setToolTip('Virtual Keyboard');
	appIcon.setContextMenu(contextMenu);	


});
コード例 #13
0
app.on('ready', function() {
  // mainWindow = new BrowserWindow({ titleBarStyle: 'hidden-inset' });
  // mainWindow.loadURL('https://github.com');
  tray = new Tray(icons.logo);
  tray.setToolTip('Desktop Sharing');
  tray.setContextMenu(Menu.buildFromTemplate(menu));
});
コード例 #14
0
ファイル: index.js プロジェクト: kelleyblackmore/nteract
 .then(kernelSpecs => {
   if (Object.keys(kernelSpecs).length !== 0) {
     store.dispatch(setKernelSpecs(kernelSpecs));
     const menu = loadFullMenu();
     Menu.setApplicationMenu(menu);
     const logo =
       process.platform === "win32" ? "logoWhite" : "logoTemplate";
     const trayImage = join(__dirname, "..", "static", `${logo}.png`);
     tray = new Tray(trayImage);
     const trayMenu = loadTrayMenu();
     tray.setContextMenu(trayMenu);
   } else {
     dialog.showMessageBox(
       {
         type: "warning",
         title: "No Kernels Installed",
         buttons: [],
         message: "No kernels are installed on your system.",
         detail:
           "No kernels are installed on your system so you will not be " +
           "able to execute code cells in any language. You can read about " +
           "installing kernels at " +
           "https://ipython.readthedocs.io/en/latest/install/kernel_install.html"
       },
       index => {
         if (index === 0) {
           app.quit();
         }
       }
     );
   }
 })
コード例 #15
0
ファイル: customtray.js プロジェクト: ulziibuyan/avdar
    var module = function(label, icons_path, controlPanelCallback, quitCallback)
    {
        idleIcon = {
            normal: icons_path + '/tray.png',
            pressed: icons_path + '/tray_pressed.png'
        };
        processIcon = {
            normal: icons_path + '/tray_process.png',
            pressed: icons_path + '/tray_process_pressed.png'
        };
        tray = new Tray(idleIcon.normal);
        tray.setToolTip(label);
        tray.setPressedImage(idleIcon.pressed);
        tray.setContextMenu(Menu.buildFromTemplate(
            [
                {
                    label: label,
                    enabled: false
                },
                {
                    type: 'separator'
                },
                {
                    label: 'Open control panel',
                    click: function()
                    {
                        controlPanelCallback();
                    }
                },
                {
                    type: 'separator'
                },
                {
                    label: 'About...',
                    selector: 'orderFrontStandardAboutPanel:'
                },
                {
                    label: 'Quit',
                    accelerator: 'Command+Q',
                    click: function()
                    {
                        quitCallback();
                    }
                }
            ]
        ));

        this.setIdle = function()
        {
            tray.setImage(idleIcon.normal);
            tray.setPressedImage(idleIcon.pressed);
        };

        this.setProcessing = function()
        {
            tray.setImage(processIcon.normal);
            tray.setPressedImage(processIcon.pressed);
        };
    };
コード例 #16
0
ファイル: main.js プロジェクト: mackenza/ottjs-electron
app.on('ready', () => {
  tray = new Tray('./npm.png');
  const contextMenu = Menu.buildFromTemplate([
    {label: 'Like my tray?', type: 'checkbox'}
  ]);
  tray.setToolTip('This is my tray tooltip');
  tray.setContextMenu(contextMenu);
});
コード例 #17
0
ファイル: tray.js プロジェクト: JodusNodus/syncthing-desktop
export default function TrayWrapper(store){
  tray = new Tray(path.join(__dirname, '../../resources/trayTemplate@4x.png'))

  const menu = buildMenu({state: store.getState()})

  tray.setContextMenu(menu)

  return tray
}
コード例 #18
0
ファイル: index.js プロジェクト: meswapnilwagh/whatsdesktop
function createTray() {
  appIcon = new Tray(path.join(__dirname, 'media', 'logo-tray.png'));
  appIcon.setPressedImage(path.join(__dirname, 'media', 'logo-tray-white.png'));
  appIcon.setContextMenu(appMenu.trayMenu);

  appIcon.on('double-click', () => {
    mainWindow.show();
  });
}
コード例 #19
0
 setUnreadStat(stat) {
   if (stat === this.lastUnreadStat) return;
   this.lastUnreadStat = stat;
   if (stat === 0) {
     this.tray.setImage(this.trayIcon);
   } else {
     this.tray.setImage(this.trayIconUnread);
   }
 }
コード例 #20
0
function createTray () {
  tray = new electron.Tray(getIconPath());

  // On Windows, left click opens the app, right click opens the context menu.
  // On Linux, any click (left or right) opens the context menu.
  tray.on('click', () => windows.main.show());

  // Show the tray context menu, and keep the available commands up to date
  updateTrayMenu()
}
コード例 #21
0
ファイル: tray.js プロジェクト: JustClear/Insplash
module.exports = function () {
    let icon = path.join(__dirname, '../../images/logo.png');
    icon = nativeImage.createFromPath(icon);
    tray = new Tray(icon);
    tray.setToolTip('Insplash.');
    tray.setContextMenu(Menu.buildFromTemplate([{
        label: 'About',
        type: 'radio',
    }]));
};
コード例 #22
0
ファイル: electron.js プロジェクト: ZpLucas/Here
function createWindow () {
  // 创建浏览器窗口,宽高自定义具体大小你开心就好
  mainWindow = new BrowserWindow({
    width: 980,
    height: 850,
    minWidth: 950,
    minHeight: 700,
    titleBarStyle: 'hiddenInset',
    backgroundColor: '#021524'
  });

  // 开发环境使用 http 协议 生产环境使用 file 协议
  if (process.argv[2] === 'dev') {
    mainWindow.loadURL('http://*****:*****@4x.png'));
  tray.setToolTip('显示窗口');

  tray.on('click', () => {
    mainWindow.show();
  });


  Object.keys(GLOBAL_SHORTCUT).forEach((key) => {
    globalShortcut.register(key, () => {
      mainWindow.webContents.send('store-data', GLOBAL_SHORTCUT[key]);
    });
  });

}
コード例 #23
0
ファイル: tray.js プロジェクト: epezhman/demand-manager-app
const createTray = ()=> {
    tray = new electron.Tray(config.APP_ICON_MENU)

    // On Windows, left click opens the app, right click opens the context menu.
    // On Linux, any click (left or right) opens the context menu.
    tray.on('click', () => windows.main.init(enums.WindowType.ABOUT))

    // Show the tray context menu, and keep the available commands up to date
    updateTrayMenu()
    tray.setToolTip(config.APP_NAME)
}
コード例 #24
0
	// Note: this must be called only after the "ready" event of the app has been dispatched
	createTray(contextMenu) {
		try {
			this.tray_ = new Tray(this.buildDir() + '/icons/' + this.trayIconFilename_())
			this.tray_.setToolTip(this.electronApp_.getName())
			this.tray_.setContextMenu(contextMenu)

			this.tray_.on('click', () => {
				this.window().show();
			});
		} catch (error) {
			console.error("Cannot create tray", error);
		}
	}
コード例 #25
0
ファイル: main.js プロジェクト: LaPalice/cozy-desktop
app.on('ready', () => {
  if (process.argv.indexOf('--hidden') === -1) {
    createWindow()
  }
  tray = new electron.Tray(`${__dirname}/images/tray-icon-linux/idle.png`)
  setTrayIcon('idle')
  const menu = electron.Menu.buildFromTemplate([
    { label: translate('Tray Show application'), click: showWindow },
    { label: translate('Tray Quit application'), click: app.quit }
  ])
  tray.setContextMenu(menu)
  tray.on('click', showWindow)
})
コード例 #26
0
ファイル: index.js プロジェクト: vevedh/electron-ionic2
ipc.on('put-in-tray', function(event) {
    const iconPath = path.join(__dirname, 'iconTemplate.png')
    appIcon = new electron.Tray(iconPath)
    const contextMenu = electron.Menu.buildFromTemplate([{
        label: 'Remove',
        click: function(menuItem, browserWindow) {
            event.sender.send('tray-removed')
            appIcon.destroy()
        }
    }])
    appIcon.setToolTip('Electron Demo in the tray.')
    appIcon.setContextMenu(contextMenu)
})
コード例 #27
0
const createTray = () => {
  tray = new Tray(path.join(assetsDirectory, '/images/8x8-new-Logo-16x16.png'));
  tray.on('right-click', toggleWindow)
  tray.on('double-click', toggleWindow)
  tray.on('click', function (event) {
    toggleWindow()

    // Show devtools when command clicked
    if (window.isVisible() && process.defaultApp && event.metaKey) {
      window.openDevTools({mode: 'detach'})
    }
  })
}
コード例 #28
0
ファイル: tray.js プロジェクト: rafajaques/electron-exemplos
app.on('ready', () => {
  tray = new Tray('/caminho/para/o/icone');

  const contextMenu = Menu.buildFromTemplate([
    {label: 'Opcao 1', type: 'radio'},
    {label: 'Opcao 2', type: 'radio'},
    {label: 'Opcao 3', type: 'radio', checked: true},
    {label: 'Opcao 4', type: 'radio'}
  ]);

  tray.setToolTip('Balãozinho com o nome da aplicação');
  tray.setContextMenu(contextMenu);
});
コード例 #29
0
ファイル: main.js プロジェクト: iven/electronic-wechat
let createTray = () => {
  appIcon = new electron.Tray(path.join(__dirname, '../assets/icon20x20.png'));
  appIcon.setToolTip('Electronic WeChat');

  if (process.platform == "linux") {
    let contextMenu = Menu.buildFromTemplate([
         {label: 'Show', click: () => browserWindow.show()},
         {label: 'Exit', click: () => app.exit(0)}
    ]);
    appIcon.setContextMenu(contextMenu);
  }else {
    appIcon.on('click', () => browserWindow.show());
  }
}
コード例 #30
0
ファイル: app.js プロジェクト: kressi/keeweb
app.minimizeApp = function () {
    if (process.platform !== 'darwin') {
        mainWindow.minimize();
        mainWindow.setSkipTaskbar(true);
        appIcon = new electron.Tray(path.join(__dirname, 'icon.png'));
        appIcon.on('click', restoreMainWindow);
        const contextMenu = electron.Menu.buildFromTemplate([
            {label: 'Open KeeWeb', click: restoreMainWindow},
            {label: 'Quit KeeWeb', click: closeMainWindow}
        ]);
        appIcon.setContextMenu(contextMenu);
        appIcon.setToolTip('KeeWeb');
    }
};