Compare commits

...

2 Commits

6 changed files with 26 additions and 5 deletions

View File

@@ -79,7 +79,7 @@ const getStartType = () => {
return startType; return startType;
} }
const debugMode = () => { const getDebugMode = () => {
return isDebug; return isDebug;
} }
@@ -89,6 +89,6 @@ module.exports = {
loadArgs: loadArgs, loadArgs: loadArgs,
getArgs: getArgs, getArgs: getArgs,
getStartType: getStartType, getStartType: getStartType,
debugMode: debugMode, getDebugMode: getDebugMode,
} }
}; };

View File

@@ -16,7 +16,7 @@ let hasExitSaved = false;
const createWindow = () => { const createWindow = () => {
window = newton.createWindow( window = newton.createWindow(
newton.args.getStartType(), newton.args.getStartType(),
newton.args.debugMode(), newton.args.getDebugMode(),
newton.args.getArgs(), newton.args.getArgs(),
); );
} }
@@ -65,6 +65,8 @@ const loadProcessSignalHandlers = () => {
} }
const loadHandlers = () => { const loadHandlers = () => {
ipcMain.handle('quit', (eve) => app.quit());
ipcMain.handle('toggleFullScreen', (eve) => { window.setFullScreen(!window.isFullScreen()); });
ipcMain.handle('getLspConfigData', (eve) => newton.fs.getLspConfigData()); ipcMain.handle('getLspConfigData', (eve) => newton.fs.getLspConfigData());
ipcMain.handle('getFileContents', (eve, path) => newton.fs.getFileContents(path)); ipcMain.handle('getFileContents', (eve, path) => newton.fs.getFileContents(path));
ipcMain.handle('openFiles', (eve, startPath) => newton.fs.openFiles(startPath)); ipcMain.handle('openFiles', (eve, startPath) => newton.fs.openFiles(startPath));
@@ -108,5 +110,4 @@ app.on('window-all-closed', () => {
if (process.platform !== 'darwin') { if (process.platform !== 'darwin') {
app.quit() app.quit()
}; };
}); });

View File

@@ -9,6 +9,8 @@ contextBridge.exposeInMainWorld('electron', {
contextBridge.exposeInMainWorld('main', { contextBridge.exposeInMainWorld('main', {
onMenuActions: (callback) => ipcRenderer.on('menu-actions', (_event, action) => callback(action)), onMenuActions: (callback) => ipcRenderer.on('menu-actions', (_event, action) => callback(action)),
quit: () => ipcRenderer.invoke("quit"),
toggleFullScreen: () => ipcRenderer.invoke("toggleFullScreen"),
}); });
contextBridge.exposeInMainWorld('fs', { contextBridge.exposeInMainWorld('fs', {

View File

@@ -1,5 +1,13 @@
export const Keybindings: Array<{}> = [ export const Keybindings: Array<{}> = [
{ {
name: "quit",
bindKey: {win: "Ctrl-q", mac: "Ctrl-q"},
readOnly: false
}, {
name: "toggleFullScreen",
bindKey: {win: "F11", mac: "F11"},
readOnly: false
}, {
name: "showSettingsMenu", name: "showSettingsMenu",
bindKey: {win: "Ctrl-Shift-m", mac: "Ctrl-Shift-m"}, bindKey: {win: "Ctrl-Shift-m", mac: "Ctrl-Shift-m"},
readOnly: false readOnly: false

View File

@@ -54,6 +54,14 @@ export class NewtonEditorBase {
this.editor.session.destroy(); this.editor.session.destroy();
} }
protected quit() {
window.main.quit();
}
protected toggleFullScreen() {
window.main.toggleFullScreen();
}
protected openFiles() { protected openFiles() {
let startDir = ""; let startDir = "";
if (this.activeFile) { if (this.activeFile) {

View File

@@ -20,6 +20,8 @@ declare global {
}, },
main: { main: {
onMenuActions: (arg0: any) => Promise<string>, onMenuActions: (arg0: any) => Promise<string>,
quit: any,
toggleFullScreen: any,
}, },
fs: { fs: {
getLspConfigData: () => Promise<string>, getLspConfigData: () => Promise<string>,