terminal menu

rdesktop2
filip mertens 1 year ago
parent 12c0894079
commit 35a7690591
  1. 6
      apps/remixdesktop/src/engine.ts
  2. 1
      apps/remixdesktop/src/main.ts
  3. 5
      apps/remixdesktop/src/menus/commands.ts
  4. 20
      apps/remixdesktop/src/menus/terminal.ts
  5. 10
      apps/remixdesktop/src/plugins/xtermPlugin.ts

@ -36,6 +36,12 @@ ipcMain.on('fs:openFolder', async (event) => {
fsPlugin.openFolder(event)
})
ipcMain.on('terminal:new', async (event) => {
console.log('terminal:new', event)
xtermPlugin.new(event)
})
ipcMain.on('template:open', async (event) => {
console.log('template:open', event)
templatesPlugin.openTemplate(event)

@ -96,6 +96,7 @@ import WindowMenu from './menus/window';
import EditMenu from './menus/edit';
import GitMenu from './menus/git';
import ViewMenu from './menus/view';
import TerminalMenu from './menus/terminal';
import { execCommand } from './menus/commands';

@ -12,6 +12,11 @@ const commands: Record<string, (focusedWindow?: BrowserWindow) => void> = {
ipcMain.emit('fs:openFolder', focusedWindow.webContents.id);
}
},
'terminal:new': (focusedWindow) => {
if (focusedWindow) {
ipcMain.emit('terminal:new', focusedWindow.webContents.id);
}
},
'template:open': (focusedWindow) => {
if (focusedWindow) {
ipcMain.emit('template:open', focusedWindow.webContents.id);

@ -0,0 +1,20 @@
import {BrowserWindow, MenuItemConstructorOptions} from 'electron';
export default (
commandKeys: Record<string, string>,
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
): MenuItemConstructorOptions => {
const isMac = process.platform === 'darwin';
return {
label: 'Terminal',
submenu: [
{
label: 'New Terminal',
click(item, focusedWindow) {
execCommand('terminal:new', focusedWindow);
}
}
]
};
};

@ -49,6 +49,13 @@ export class XtermPlugin extends ElectronBasePlugin {
super(profile, clientProfile, XtermPluginClient)
}
new(webContentsId: any): void {
const client = this.clients.find(c => c.webContentsId === webContentsId)
if (client) {
client.new()
}
}
}
const clientProfile: Profile = {
@ -114,4 +121,7 @@ class XtermPluginClient extends ElectronBasePluginClient {
this.emit('data', data, pid)
}
async new(): Promise<void> {
}
}
Loading…
Cancel
Save