@@ -5,14 +5,19 @@ const electronLocalshortcut = require("electron-localshortcut");
55const config = require ( "../../config" ) ;
66const { injectCSS } = require ( "../utils" ) ;
77
8+ const { setupTitlebar, attachTitlebarToWindow } = require ( 'custom-electron-titlebar/main' ) ;
9+ setupTitlebar ( ) ;
10+
811//tracks menu visibility
9- let visible = true ;
12+ let visible = ! config . get ( "options.hideMenu" ) ;
1013
1114module . exports = ( win ) => {
1215 // css for custom scrollbar + disable drag area(was causing bugs)
1316 injectCSS ( win . webContents , path . join ( __dirname , "style.css" ) ) ;
1417
1518 win . once ( "ready-to-show" , ( ) => {
19+ attachTitlebarToWindow ( win ) ;
20+
1621 //register keyboard shortcut && hide menu if hideMenu is enabled
1722 if ( config . get ( "options.hideMenu" ) ) {
1823 electronLocalshortcut . register ( win , "Esc" , ( ) => {
@@ -21,13 +26,8 @@ module.exports = (win) => {
2126 }
2227 } ) ;
2328
24- win . webContents . once ( "did-finish-load" , ( ) => {
25- // fix bug with menu not applying on start when no internet connection available
26- setMenuVisibility ( ! config . get ( "options.hideMenu" ) ) ;
27- } ) ;
28-
2929 function setMenuVisibility ( value ) {
3030 visible = value ;
31- win . webContents . send ( "updateMenu " , visible ) ;
31+ win . webContents . send ( "refreshMenu " , visible ) ;
3232 }
3333} ;
0 commit comments