1
- import { ipcMain , app , Menu , session } from 'electron' ;
1
+ import { ipcMain , app , Menu , session , globalShortcut , Tray } from 'electron' ;
2
2
import { resolve } from 'path' ;
3
3
import { platform , homedir } from 'os' ;
4
4
import { AppWindow } from './app-window' ;
@@ -13,7 +13,7 @@ import { DotOptions } from '~/renderer/app/models/dotoptions';
13
13
import { makeId } from '~/shared/utils/string' ;
14
14
import store from '~/renderer/app/store'
15
15
import console = require( 'console' ) ;
16
-
16
+ const nativeImage = require ( "electron" ) . nativeImage ;
17
17
18
18
ipcMain . setMaxListeners ( 0 ) ;
19
19
@@ -60,6 +60,7 @@ app.commandLine.appendSwitch('auto-detect', 'false')
60
60
app . commandLine . appendSwitch ( 'no-proxy-server' )
61
61
// Fixes any proxy bypass settings
62
62
63
+ var tray = null ;
63
64
app . on ( 'ready' , ( ) => {
64
65
// Create our menu entries so that we can use macOS shortcuts
65
66
Menu . setApplicationMenu (
@@ -90,6 +91,24 @@ app.on('ready', () => {
90
91
] ) ,
91
92
) ;
92
93
94
+ globalShortcut . register ( 'Alt+Backspace' , ( ) => {
95
+ console . log ( "fsd" )
96
+ appWindow . webContents . goBack ( ) ;
97
+ } ) ;
98
+
99
+ tray = new Tray ( resolve ( app . getAppPath ( ) , 'src/shared/resources/icons/logo.png' ) )
100
+ const contextMenu = Menu . buildFromTemplate ( [
101
+ { label : `Dot ${ app . getVersion ( ) } ` , type : 'normal' , enabled : false , icon : resolve ( app . getAppPath ( ) , 'src/shared/resources/icons/tray-icon.png' ) } ,
102
+ { type : 'separator' } ,
103
+ { label : 'History' , type : 'normal' } ,
104
+ { label : 'Bookmarks' , type : 'normal' } ,
105
+ { label : 'Settings' , type : 'normal' } ,
106
+ { type : 'separator' } ,
107
+ { label : `Quit Dot ${ app . getVersion ( ) } ` , type : 'normal' , role : 'quit' , icon : resolve ( app . getAppPath ( ) , 'src/shared/resources/icons/tray-close.png' ) } ,
108
+ ] )
109
+ tray . setToolTip ( `Dot ${ app . getVersion ( ) } ` )
110
+ tray . setContextMenu ( contextMenu )
111
+
93
112
session . defaultSession . setPermissionRequestHandler (
94
113
( webContents , permission , callback ) => {
95
114
if ( permission === 'notifications' || permission === 'fullscreen' ) {
0 commit comments