forked from MoeFE/GoogleTranslate
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
38 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import path from 'path'; | ||
|
||
import { app, Tray, globalShortcut, MenuItem, Menu } from 'electron'; | ||
import AutoLaunch from 'auto-launch'; | ||
|
||
|
@@ -17,7 +19,7 @@ if (!config.isDebug) { | |
} | ||
}); | ||
checkForUpdates(); | ||
app.dock.hide(); | ||
app.dock?.hide(); | ||
|
||
const menu = new Menu(); | ||
// 加了菜单才有 cmd + shift + i 的功能 | ||
|
@@ -35,27 +37,26 @@ if (!config.isDebug) { | |
let tray: Tray; | ||
app.on('ready', () => { | ||
const window = new Window({}); | ||
|
||
// tray = new Tray(`${__public}/[email protected]`); | ||
// tray | ||
// .on('click', () => { | ||
// if (window.isVisible()) { | ||
// window.fadeOut(); | ||
// } else { | ||
// window.fadeIn(); | ||
// } | ||
// }) | ||
// .on('right-click', () => { | ||
// const contextMenu = Menu.buildFromTemplate([ | ||
// { | ||
// label: 'Quit', | ||
// click() { | ||
// app.exit(); | ||
// }, | ||
// }, | ||
// ]); | ||
// tray.popUpContextMenu(contextMenu); | ||
// }); | ||
tray = new Tray(path.resolve(__public, '[email protected]')); | ||
tray | ||
.on('click', () => { | ||
if (window.isVisible()) { | ||
window.fadeOut(); | ||
} else { | ||
window.fadeIn(); | ||
} | ||
}) | ||
.on('right-click', () => { | ||
const contextMenu = Menu.buildFromTemplate([ | ||
{ | ||
label: 'Quit', | ||
click() { | ||
app.exit(); | ||
}, | ||
}, | ||
]); | ||
tray.popUpContextMenu(contextMenu); | ||
}); | ||
|
||
globalShortcut.register('CommandOrControl+Q', async () => { | ||
if (!window) return; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters