@@ -32,13 +32,13 @@ class MenuService {
3232 }
3333
3434 public refreshContextMenu ( ) : void {
35+ const trayMenuItems : MenuItemConstructorOptions [ ] = [ ] ;
3536 const menuItems : MenuItemConstructorOptions [ ] = [ ] ;
36- const windowMenuItems : MenuItemConstructorOptions [ ] = [ ] ;
3737 const s = AppState . strings . menu ;
3838
3939 if ( OS . IS_LINUX ) {
40- menuItems . push ( { label : s . showHidePage , click : ( ) => PageService . setupOrTogglePage ( ) } ) ;
41- menuItems . push ( { type : 'separator' } ) ;
40+ trayMenuItems . push ( { label : s . showHidePage , click : ( ) => PageService . setupOrTogglePage ( ) } ) ;
41+ trayMenuItems . push ( { type : 'separator' } ) ;
4242 }
4343
4444 const groupBySession = Storage . getSettings < boolean > ( Settings . GROUP_PAGES_BY_SESSION ) ;
@@ -53,28 +53,28 @@ class MenuService {
5353 sessionMap . get ( session ) ! . push ( p ) ;
5454 } ) ;
5555 sessionMap . forEach ( ( pages , session ) => {
56- windowMenuItems . push ( { label : session , submenu : pages . map ( this . createMenuPageItem ) } ) ;
56+ menuItems . push ( { label : session , submenu : pages . map ( this . createMenuPageItem ) } ) ;
5757 } ) ;
5858 } else {
59- validPages . forEach ( ( p ) => windowMenuItems . push ( this . createMenuPageItem ( p ) ) ) ;
59+ validPages . forEach ( ( p ) => menuItems . push ( this . createMenuPageItem ( p ) ) ) ;
6060 }
6161
62- windowMenuItems . push ( {
62+ menuItems . push ( {
6363 id : 'clipboard-url' ,
6464 type : 'checkbox' ,
6565 checked : PageService . isCurrentPage ( AppState . fromClipboardPage ) ,
6666 label : AppState . fromClipboardPage ! . labelWithStatus ,
6767 click : ( ) => this . onClipboardPageClick ( ) ,
6868 } ) ;
6969
70- windowMenuItems . push ( { type : 'separator' } ) ;
70+ menuItems . push ( { type : 'separator' } ) ;
7171
7272 const activePages = PageService . getAllActivePages ( ) ;
7373 let currentPageSubmenu ;
7474
7575 if ( activePages . length > 0 ) {
7676 const activePagesMenu : MenuItem = { label : s . activePages , submenu : [ ] } ;
77- windowMenuItems . push ( activePagesMenu ) ;
77+ menuItems . push ( activePagesMenu ) ;
7878
7979 // If there is a current page, create its submenu.
8080 // Void Scenario: The old current page was removed
@@ -95,26 +95,23 @@ class MenuService {
9595 activePagesMenu . submenu . push ( { label : p . labelWithStatus , submenu : this . createPageSubmenu ( p ) } ) ;
9696 } ) ;
9797
98- windowMenuItems . push ( {
98+ menuItems . push ( {
9999 label : s . closeOtherPages , click : ( ) =>
100100 otherActivePages . forEach ( ( p ) => PageService . closePageView ( p ) ) ,
101101 } ) ;
102102 }
103103 }
104104
105- windowMenuItems . push ( {
105+ menuItems . push ( {
106106 label : s . closeAllPages , enabled : ! ! activePages . length , click : ( ) => {
107107 FrameService . getFrame ( ) && FrameService . forceClose ( false ) ;
108108 activePages . forEach ( ( p ) => PageService . closePageView ( p ) ) ;
109109 } ,
110110 } ) ;
111111
112- windowMenuItems . push ( { type : 'separator' } ) ;
112+ menuItems . push ( { type : 'separator' } ) ;
113113
114- windowMenuItems . push ( { label : s . preferences , click : ( ) => PreferencesService . open ( ) } ) ;
115-
116- menuItems . push ( ...windowMenuItems ) ;
117- menuItems . push ( { label : s . exit , click : ( ) => app . quit ( ) } ) ;
114+ menuItems . push ( { label : s . preferences , click : ( ) => PreferencesService . open ( ) } ) ;
118115
119116 if ( currentPageSubmenu ) {
120117 AppState . viewContextMenu = [
@@ -126,7 +123,7 @@ class MenuService {
126123 } ,
127124 { type : 'separator' } ,
128125 { label : s . window , submenu : currentPageSubmenu } ,
129- { label : s . handbook , submenu : windowMenuItems } ,
126+ { label : s . handbook , submenu : menuItems } ,
130127 ] ;
131128
132129 const quickActions = this . getQuickActions ( ) ;
@@ -135,8 +132,11 @@ class MenuService {
135132 }
136133 }
137134
138- AppState . navbarContextMenu = windowMenuItems ;
139- AppState . trayContextMenu = menuItems ;
135+ trayMenuItems . push ( ...menuItems ) ;
136+ trayMenuItems . push ( { label : s . exit , click : ( ) => app . quit ( ) } ) ;
137+
138+ AppState . navbarContextMenu = menuItems ;
139+ AppState . trayContextMenu = trayMenuItems ;
140140
141141 TrayService . updateLinuxTrayContextMenu ( ) ;
142142 }
0 commit comments