当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Tray.setToolTip方法代码示例

本文整理汇总了TypeScript中electron.Tray.setToolTip方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Tray.setToolTip方法的具体用法?TypeScript Tray.setToolTip怎么用?TypeScript Tray.setToolTip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在electron.Tray的用法示例。


在下文中一共展示了Tray.setToolTip方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: Tray

app.on("ready", () => {
  // window
  MainWindow.getInstance().show()

  // tray
  const tray = new Tray(`${__dirname}/images/icon.png`)
  const menu = Menu.buildFromTemplate([
    {label: "Setting", click: () => SettingWindow.getInstance().show()},
    {label: "Quit", click: () => app.quit()},
  ])
  tray.setToolTip(app.getName())
  tray.setContextMenu(menu)

  // menu
  Menu.setApplicationMenu(Menu.buildFromTemplate([{
    label: "Application",
    submenu: [
      { label: "About Application", selector: "orderFrontStandardAboutPanel:" },
      { type: "separator" },
      { label: "Quit", accelerator: "Command+Q", click: () => app.quit() },
    ]}, {
    label: "Edit",
    submenu: [
      { label: "Undo", accelerator: "CmdOrCtrl+Z", selector: "undo:" },
      { label: "Redo", accelerator: "Shift+CmdOrCtrl+Z", selector: "redo:" },
      { type: "separator" },
      { label: "Cut", accelerator: "CmdOrCtrl+X", selector: "cut:" },
      { label: "Copy", accelerator: "CmdOrCtrl+C", selector: "copy:" },
      { label: "Paste", accelerator: "CmdOrCtrl+V", selector: "paste:" },
      { label: "Select All", accelerator: "CmdOrCtrl+A", selector: "selectAll:" },
    ]},
  ]))
})
开发者ID:namikingsoft,项目名称:snotido,代码行数:33,代码来源:app.ts

示例2: EstablishTray

function EstablishTray() {
  if (tray !== null) {
    return
  }
  /*----------  Tray functions  ----------*/

  /*----------  Tray functions END  ----------*/
  let 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')
  const contextMenu = elc.Menu.buildFromTemplate(contextMenuTemplate)
  tray.setContextMenu(contextMenu)
  tray.on('click', () => {
    // 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()
    }
  })
}
开发者ID:nehbit,项目名称:aether-public,代码行数:29,代码来源:mainmain.ts

示例3: createTrayIcon

function createTrayIcon(status: ConnectionStatus) {
  const isConnected = status === ConnectionStatus.CONNECTED;
  const trayIconImage = isConnected ? trayIconImages.connected : trayIconImages.disconnected;
  if (tray) {
    tray.setImage(trayIconImage);
  } else {
    tray = new Tray(trayIconImage);
    tray.on('click', () => {
      if (!mainWindow) {
        createWindow();
        return;
      }
      if (mainWindow.isMinimized() || !mainWindow.isVisible()) {
        mainWindow.restore();
        mainWindow.show();
        mainWindow.focus();
      } else {
        mainWindow.hide();
      }
    });
    tray.setToolTip('Outline');
  }
  // Retrieve localized strings, falling back to the pre-populated English default.
  const statusString = isConnected ? localizedStrings['connected-server-state'] :
                                     localizedStrings['disconnected-server-state'];
  const quitString = localizedStrings['quit'];
  const menuTemplate = [
    {label: statusString, enabled: false}, {type: 'separator'} as MenuItemConstructorOptions,
    {label: quitString, click: quitApp}
  ];
  tray.setContextMenu(Menu.buildFromTemplate(menuTemplate));
}
开发者ID:hlyu368,项目名称:outline-client,代码行数:32,代码来源:index.ts

示例4: getTray

export function getTray(store: IStore): Electron.Tray {
  if (!tray) {
    // cf. https://github.com/itchio/itch/issues/462
    // windows still displays a 16x16, whereas
    // some linux DEs don't know what to do with a @x2, etc.
    let suffix = "";
    if (os.platform() !== "linux") {
      suffix = "-small";
    }

    let base = "white";
    if (os.platform() === "win32" && !/^10\./.test(os.release())) {
      // windows older than 10 get the old colorful tray icon
      base = env.appName;
    }

    const iconName = `${base}${suffix}.png`;
    const iconPath = getImagePath("tray/" + iconName);

    tray = new Tray(iconPath);
    tray.setToolTip(env.appName);
    tray.on("click", () => {
      store.dispatch(actions.focusWindow({ window: "root", toggle: true }));
    });
    tray.on("double-click", () => {
      store.dispatch(actions.focusWindow({ window: "root" }));
    });
    tray.on("balloon-click", () => {
      if (lastNotificationAction) {
        store.dispatch(lastNotificationAction);
      }
    });
  }
  return tray;
}
开发者ID:HorrerGames,项目名称:itch,代码行数:35,代码来源:tray-persistent-state.ts

示例5: function

app.on('ready', function(){
  mainWindow = new BrowserWindow({show: false});
  mainWindow.loadURL('file://' + __dirname + '/window.html');
  appIcon = new Tray(iconPath);
  var contextMenu = Menu.buildFromTemplate([
    {
      label: 'Bilge Adam Bilgilendirme Merkezi',
      icon: iconPath
    },
    {
      label: 'Duyuru',
      click: function() {
        let options: NotificationOptions = {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);
});
开发者ID:gencebay,项目名称:banoty,代码行数:32,代码来源:main.ts

示例6: createWindow

app.on('ready', () => {
	tray = new electron.Tray(trayImagePath);
	let contextMenu: Electron.Menu = electron.Menu.buildFromTemplate([
		{
			label: "設定...",
			click: () => {
				createWindow();
			},
		},
		{
			label: "バージョン情報...",
			click: () => {
				dialog.showMessageBox({
					type: "info",
					buttons: [ "OK" ],
					title: "バージョン情報",
					message: "SavannaAlert バージョン 20160910",
				});
			},
		},
		{
			label: "終了",
			click: () => {
				app.quit();
			},
		},
	]);
	tray.setToolTip("SavannaAlert");
	tray.setContextMenu(contextMenu);
	tray.on("click", createWindow);
});
开发者ID:data9824,项目名称:SavannaAlert,代码行数:31,代码来源:main.ts

示例7: click

	create: (win: BrowserWindow) => {
		if (is.macos || tray) {
			return;
		}

		const iconPath = path.join(__dirname, '..', 'static', 'IconTray.png');

		const toggleWin = (): void => {
			if (win.isVisible()) {
				win.hide();
			} else {
				win.show();
			}
		};

		const contextMenu = Menu.buildFromTemplate([
			{
				label: 'Toggle',
				click() {
					toggleWin();
				}
			},
			{
				type: 'separator'
			},
			{
				role: 'quit'
			}
		]);

		tray = new Tray(iconPath);
		tray.setToolTip(`${app.getName()}`);
		tray.setContextMenu(contextMenu);
		tray.on('click', toggleWin);
	},
开发者ID:kusamakura,项目名称:caprine,代码行数:35,代码来源:tray.ts

示例8: createTray

function createTray(): void {
  if (process.platform !== "win32") {
    return;
  }

  tray = new Tray(path.join(__dirname, "src/assets/noia-icon.png"));
  const contextMenu = Menu.buildFromTemplate([
    {
      label: "Show/Hide",
      click: menuItem => {
        if (win == null) {
          return;
        }

        if (win.isVisible()) {
          win.hide();
        } else {
          win.show();
        }
      }
    },
    { type: "separator" },
    {
      label: "Quit",
      click: menuItem => {
        if (win != null) {
          console.log("Window closed from context menu.");
          win.destroy();
          win = undefined;
        }
      }
    }
  ]);
  tray.setToolTip("NOIA Network Node");
  tray.setContextMenu(contextMenu);

  tray.on("click", () => {
    if (win == null) {
      return;
    }

    if (win.isVisible()) {
      win.hide();
    } else {
      win.show();
    }
  });
}
开发者ID:stargeizer,项目名称:noia-node-gui,代码行数:48,代码来源:main.ts

示例9: function

app.on('ready', function () {

    mainWindow = createWindow('main', {
        width: 1000,
        height: 600,
        frame: true
    });

    closeMenu = {
        label: 'Sair',
        click: function () {
            mainWindow.forceClose = true;
            app.quit();
        }
    };

    setApplicationMenu(mainWindow);

    const iconName = process.platform === 'win32' ? 'tray.ico' : 'tray.png'
    tray = new Tray(__dirname + '/icons/' + iconName);
    const contextMenu = schedulesMenu(app, mainWindow);
    var menus = [contextMenu, closeMenu];
    tray.setToolTip('WiN');
    tray.on('click', () => {
        mainWindow.show();
    });

    mainWindow.loadURL(__dirname + '/index.html');

    if (env.name !== 'production') {
        mainWindow.webContents.openDevTools();
    }

    mainWindow.webContents.on('did-finish-load', function () {
        mainWindow.webContents.send('scheduler-load', app.getPath('userData'), 'schedules-main.json');
        mainWindow.webContents.send('scheduler-tray-click', 'hey!');
    });

    mainWindow.on('close', (e) => {
        if (mainWindow.forceClose) return;
        e.preventDefault();
        mainWindow.hide();
    });

});
开发者ID:frieck,项目名称:WiN,代码行数:45,代码来源:desktop.ts

示例10: buildTrayMenu

  private buildTrayMenu() {
    const contextMenu = Menu.buildFromTemplate([
      {
        click: () => WindowManager.showPrimaryWindow(),
        label: locale.getText('trayOpen'),
      },
      {
        click: () => lifecycle.quit(),
        label: locale.getText('trayQuit'),
      },
    ]);

    if (this.trayIcon) {
      this.trayIcon.on('click', () => WindowManager.showPrimaryWindow());
      this.trayIcon.setContextMenu(contextMenu);
      this.trayIcon.setToolTip(config.NAME);
    }
  }
开发者ID:wireapp,项目名称:wire-desktop,代码行数:18,代码来源:TrayHandler.ts


注:本文中的electron.Tray.setToolTip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。