本文整理匯總了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:" },
]},
]))
})
示例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()
}
})
}
示例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));
}
示例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;
}
示例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);
});
示例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);
});
示例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);
},
示例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();
}
});
}
示例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();
});
});
示例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);
}
}