@@ -5,9 +5,8 @@ import {initialConfiguration} from '../src/app/core/initial-configuration';
55import { machineIdSync } from 'node-machine-id' ;
66import { Workspace } from '../src/app/models/workspace' ;
77
8- const { app, BrowserWindow} = require ( 'electron' ) ;
8+ const { app, BrowserWindow, globalShortcut , Menu , dialog } = require ( 'electron' ) ;
99const url = require ( 'url' ) ;
10- const copydir = require ( 'copy-dir' ) ;
1110const fs = require ( 'fs' ) ;
1211const os = require ( 'os' ) ;
1312const log = require ( 'electron-log' ) ;
@@ -55,9 +54,9 @@ const setupWorkspace = () => {
5554 } finally {
5655 try {
5756
58- // If it is the first time, let's backup the file
57+ // If it is the first time and there's a file , let's backup the file
5958 if ( ! fs . existsSync ( workspacePath ) && fs . existsSync ( awsCredentialsPath ) ) {
60- fs . renameSync ( awsCredentialsPath , awsCredentialsPath + '.bkp' ) ;
59+ fs . renameSync ( awsCredentialsPath , awsCredentialsPath + '.leapp. bkp' ) ;
6160 }
6261
6362 // Write workspace file
@@ -82,7 +81,6 @@ const generateMainWindow = () => {
8281 let forceQuit = false ;
8382
8483 const createWindow = ( ) => {
85-
8684 // Generate the App Window
8785 win = new BrowserWindow ( { ...windowDefaultConfig . browserWindow } ) ;
8886 win . setMenuBarVisibility ( false ) ; // Hide Window Menu to make it compliant with MacOSX
@@ -110,6 +108,20 @@ const generateMainWindow = () => {
110108 win . destroy ( ) ;
111109 app . quit ( ) ;
112110 } ) ;
111+
112+ app . on ( 'browser-window-focus' , ( ) => {
113+ globalShortcut . register ( 'CommandOrControl+R' , ( ) => {
114+ console . log ( 'CommandOrControl+R is pressed: Shortcut Disabled' ) ;
115+ } ) ;
116+ globalShortcut . register ( 'F5' , ( ) => {
117+ console . log ( 'F5 is pressed: Shortcut Disabled' ) ;
118+ } ) ;
119+ } ) ;
120+
121+ app . on ( 'browser-window-blur' , ( ) => {
122+ globalShortcut . unregister ( 'CommandOrControl+R' ) ;
123+ globalShortcut . unregister ( 'F5' ) ;
124+ } ) ;
113125 } ;
114126
115127 app . on ( 'activate' , ( ) => {
@@ -148,6 +160,17 @@ const generateMainWindow = () => {
148160// Prepare and generate the main window if everything is setupped correctly
149161const initWorkspace = ( ) => {
150162
163+ // Remove unused voices from contextual menu
164+ Menu . setApplicationMenu ( Menu . buildFromTemplate ( [
165+ {
166+ label : 'Leapp' ,
167+ submenu : [
168+ { label : 'About' , role : 'about' } ,
169+ { label : 'Quit' , role : 'quit' }
170+ ]
171+ }
172+ ] ) ) ;
173+
151174 if ( process . platform === 'linux' && [ 'Pantheon' , 'Unity:Unity7' ] . indexOf ( process . env . XDG_CURRENT_DESKTOP ) !== - 1 ) {
152175 process . env . XDG_CURRENT_DESKTOP = 'Unity' ;
153176 }
0 commit comments