diff --git a/apps/remixdesktop/package.json b/apps/remixdesktop/package.json index 8f52daa806..f229c2c50c 100644 --- a/apps/remixdesktop/package.json +++ b/apps/remixdesktop/package.json @@ -1,6 +1,6 @@ { "name": "remixdesktop", - "version": "0.1.0-Alpha", + "version": "2.0.0-Alpha", "main": "build/main.js", "license": "MIT", "type": "commonjs", diff --git a/apps/remixdesktop/src/engine.ts b/apps/remixdesktop/src/engine.ts index 0908425947..2a92603534 100644 --- a/apps/remixdesktop/src/engine.ts +++ b/apps/remixdesktop/src/engine.ts @@ -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 }) diff --git a/apps/remixdesktop/src/plugins/xtermPlugin.ts b/apps/remixdesktop/src/plugins/xtermPlugin.ts index 0dda9a9156..a00fd843f4 100644 --- a/apps/remixdesktop/src/plugins/xtermPlugin.ts +++ b/apps/remixdesktop/src/plugins/xtermPlugin.ts @@ -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 { + 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 { - 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) } } diff --git a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx index 95951f2337..cf5daed645 100644 --- a/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx +++ b/libs/remix-ui/xterm/src/lib/components/remix-ui-xterminals.tsx @@ -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])