rdesktop^2
filip mertens 1 year ago
parent 1d36d50ab6
commit 21e85f6881
  1. 4
      apps/remixdesktop/src/main.ts
  2. 22
      apps/remixdesktop/src/menus/edit.ts
  3. 87
      apps/remixdesktop/src/menus/view.ts

@ -95,6 +95,7 @@ import darwinMenu from './menus/darwin';
import WindowMenu from './menus/window';
import EditMenu from './menus/edit';
import GitMenu from './menus/git';
import ViewMenu from './menus/view';
import { execCommand } from './menus/commands';
const commandKeys: Record<string, string> = {
@ -104,9 +105,10 @@ const commandKeys: Record<string, string> = {
const menu = [...(process.platform === 'darwin' ? [darwinMenu(commandKeys, execCommand, showAbout)] : []),
FileMenu(commandKeys, execCommand),
GitMenu(commandKeys, execCommand),
EditMenu(commandKeys, execCommand),
ViewMenu(commandKeys, execCommand),
WindowMenu(commandKeys, execCommand, []),
GitMenu(commandKeys, execCommand)
]
Menu.setApplicationMenu(Menu.buildFromTemplate(menu))

@ -5,11 +5,6 @@ export default (
execCommand: (command: string, focusedWindow?: BrowserWindow) => void
) => {
const submenu: MenuItemConstructorOptions[] = [
{
label: 'Cut',
accelerator: commandKeys['editor:cut'],
enabled: false
},
{
role: 'copy',
command: 'editor:copy',
@ -20,7 +15,22 @@ export default (
role: 'paste',
accelerator: commandKeys['editor:paste'],
registerAccelerator: true
}
},
{
role: 'cut',
accelerator: commandKeys['editor:cut'],
registerAccelerator: true
},
{
role: 'selectAll',
accelerator: commandKeys['editor:selectall'],
registerAccelerator: true
},
{
role: 'undo',
accelerator: commandKeys['editor:undo'],
registerAccelerator: true
},
];
if (process.platform !== 'darwin') {

@ -0,0 +1,87 @@
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: 'View',
submenu: [
{
label: 'Toggle Developer Tools',
accelerator: (function() {
if (process.platform === 'darwin')
return 'Alt+Command+I';
else
return 'Ctrl+Shift+I';
})(),
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.webContents.toggleDevTools();
}
},
{
label: 'Reload',
accelerator: 'CmdOrCtrl+R',
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.reload();
}
},
{
label: 'Toggle Full Screen',
accelerator: (function() {
if (process.platform === 'darwin')
return 'Ctrl+Command+F';
else
return 'F11';
})(),
click: function(item, focusedWindow) {
if (focusedWindow)
focusedWindow.setFullScreen(!focusedWindow.isFullScreen());
}
},
{
label: 'Zoom In',
accelerator: 'CmdOrCtrl+=',
click: function(item, focusedWindow) {
if (focusedWindow){
let factor = focusedWindow.webContents.getZoomFactor()
if (factor < 4) {
factor = factor + 0.25
focusedWindow.webContents.setZoomFactor(factor)
}
}
}
},
{
label: 'Zoom Out',
accelerator: 'CmdOrCtrl+-',
click: function(item, focusedWindow) {
if (focusedWindow){
let factor = focusedWindow.webContents.getZoomFactor()
if (factor > 1.25) {
factor = factor - 1.25
focusedWindow.webContents.setZoomFactor(factor)
}
}
}
},
{
label: 'Reset Zoom',
accelerator: 'CmdOrCtrl+0',
click: function(item, focusedWindow) {
if (focusedWindow)
{
focusedWindow.webContents.setZoomFactor(1)
}
}
},
]
};
};
Loading…
Cancel
Save