WIP terminal integration
This commit is contained in:
@@ -5,6 +5,7 @@ const { menu } = require('./menu');
|
||||
const { systemTray } = require('./system-tray');
|
||||
const { argsParser } = require('./args-parser');
|
||||
const { settingsManager } = require('./settings-manager');
|
||||
const { terminal } = require('./terminal');
|
||||
const { newtonFs } = require('./fs');
|
||||
const { newtonIPC } = require('./ipc');
|
||||
|
||||
@@ -55,6 +56,7 @@ const createWindow = (startType = "build", debug = false, args = []) => {
|
||||
|
||||
menu.load(window);
|
||||
systemTray.load(menu.menuStruct);
|
||||
terminal.load(window);
|
||||
|
||||
// window.setAutoHideMenuBar(true)
|
||||
|
||||
|
@@ -9,6 +9,7 @@ contextBridge.exposeInMainWorld('electron', {
|
||||
|
||||
contextBridge.exposeInMainWorld('main', {
|
||||
onMenuActions: (callback) => ipcRenderer.on('menu-actions', (_event, action) => callback(action)),
|
||||
onTerminalActions: (callback) => ipcRenderer.on('terminal-actions', (_event, action) => callback(action)),
|
||||
quit: () => ipcRenderer.invoke("quit"),
|
||||
toggleFullScreen: () => ipcRenderer.invoke("toggleFullScreen"),
|
||||
});
|
||||
|
35
newton/terminal.js
Normal file
35
newton/terminal.js
Normal file
@@ -0,0 +1,35 @@
|
||||
|
||||
const { ipcMain } = require('electron');
|
||||
// const pty = require('node-pty');
|
||||
const os = require("os");
|
||||
|
||||
|
||||
const shell = "win32" === os.platform() ? "powershell.exe" : "bash";
|
||||
|
||||
|
||||
const load = (win) => {
|
||||
// const ptyProcess = pty.spawn(shell, [], {
|
||||
// name: "xterm-color",
|
||||
// cols: 172,
|
||||
// rows: 256,
|
||||
// cwd: process.env.HOME,
|
||||
// env: process.env
|
||||
// });
|
||||
|
||||
// ptyProcess.on('data', function(data) {
|
||||
// win.webContents.send("terminal-actions", data);
|
||||
// });
|
||||
|
||||
// ipcMain.on("terminal-keystroke", (event, key) => {
|
||||
// ptyProcess.write(key);
|
||||
// });
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
terminal: {
|
||||
load: load
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user