update xterm v2

pull/5370/head
filip mertens 7 months ago
parent c13662a705
commit 0b47074484
  1. 2
      apps/remixdesktop/package.json
  2. 6
      apps/remixdesktop/src/engine.ts
  3. 10
      apps/remixdesktop/src/plugins/xtermPlugin.ts
  4. 6
      libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx

@ -1,6 +1,6 @@
{
"name": "remixdesktop",
"version": "0.1.0-Alpha",
"version": "2.0.0-Alpha",
"main": "build/main.js",
"license": "MIT",
"type": "commonjs",

@ -56,12 +56,6 @@ ipcMain.on('git:startclone', async (event) => {
isoGitPlugin.startClone(event)
})
ipcMain.on('terminal:new', async (event) => {
console.log('new terminal')
xtermPlugin.new(event)
})
ipcMain.handle('getWebContentsID', (event, message) => {
return event.sender.id
})

@ -81,7 +81,9 @@ export class XtermPlugin extends ElectronBasePlugin {
new(webContentsId: any): void {
const client = this.clients.find((c) => c.webContentsId === webContentsId)
console.log('new terminal', webContentsId)
if (client) {
console.log('client exists')
client.new()
}
}
@ -137,6 +139,7 @@ class XtermPluginClient extends ElectronBasePluginClient {
}
async createTerminal(path?: string, shell?: string): Promise<number> {
console.log('createTerminal', path, shell || defaultShell)
let parsedEnv: any = null
if (!(process.platform === 'win32')) {
const { stdout } = spawnSync(defaultShell, getShellEnvArgs, {
@ -153,10 +156,12 @@ class XtermPluginClient extends ElectronBasePluginClient {
rows: 20,
cwd: path || process.cwd(),
env: env,
})
encoding: 'utf8',
});
const dataBatcher = new DataBatcher(ptyProcess.pid)
this.dataBatchers[ptyProcess.pid] = dataBatcher
ptyProcess.onData((data: string) => {
//console.log('data', data)
dataBatcher.write(Buffer.from(data))
})
ptyProcess.onExit(() => {
@ -213,8 +218,9 @@ class XtermPluginClient extends ElectronBasePluginClient {
}
async new(): Promise<void> {
console.log('new terminal')
console.log('new terminal in client')
const pid = await this.createTerminal(this.workingDir)
console.log('new terminal in client', pid)
this.emit('new', pid)
}
}

@ -34,8 +34,9 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
})
plugin.on('xterm', 'new', async (pid: number) => {
dispatchXterm({ type: 'SHOW_OUTPUT', payload: false })
dispatchXterm({ type: 'ADD_TERMINAL', payload: { pid, queue: '', timeStamp: Date.now(), ref: null, hidden: false } })
dispatchXterm({ type: 'SHOW_OUTPUT', payload: false })
dispatchXterm({ type: 'HIDE_ALL_TERMINALS', payload: null })
})
@ -136,7 +137,8 @@ export const RemixUiXterminals = (props: RemixUiXterminalsProps) => {
useEffect(() => {
if (!xtermState.showOutput) {
if (terminals.length === 0) createTerminal('', plugin, xtermState.workingDir, dispatchXterm)
console.log('create terminal because of showOutput')
//if (terminals.length === 0) createTerminal('', plugin, xtermState.workingDir, dispatchXterm)
}
}, [xtermState.showOutput])

Loading…
Cancel
Save