WIP terminal integration

This commit is contained in:
2025-09-04 00:26:22 -05:00
parent 73f25aae1c
commit ed89f34d40
16 changed files with 234 additions and 1 deletions

View File

@@ -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)

View File

@@ -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
View 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
}
};