feat: More keyboard shortcuts
This commit is contained in:
parent
c7f765df03
commit
ea134d046e
|
@ -18,7 +18,8 @@ export const IPC_COMMANDS = {
|
||||||
MACHINE_RESTART: 'MACHINE_RESTART',
|
MACHINE_RESTART: 'MACHINE_RESTART',
|
||||||
MACHINE_STOP: 'MACHINE_STOP',
|
MACHINE_STOP: 'MACHINE_STOP',
|
||||||
MACHINE_RESET: 'MACHINE_RESET',
|
MACHINE_RESET: 'MACHINE_RESET',
|
||||||
MACHINE_ALTF4: 'MACHINE_ALTF4',
|
MACHINE_ALT_F4: 'MACHINE_ALT_F4',
|
||||||
|
MACHINE_ALT_ENTER: 'MACHINE_ALT_ENTER',
|
||||||
MACHINE_CTRL_ALT_DEL: 'MACHINE_CTRL_ALT_DEL',
|
MACHINE_CTRL_ALT_DEL: 'MACHINE_CTRL_ALT_DEL',
|
||||||
// Machine events
|
// Machine events
|
||||||
MACHINE_STARTED: 'MACHINE_STARTED',
|
MACHINE_STARTED: 'MACHINE_STARTED',
|
||||||
|
|
|
@ -111,6 +111,16 @@ async function createMenu({ isRunning } = { isRunning: false }) {
|
||||||
click: () => send(IPC_COMMANDS.MACHINE_CTRL_ALT_DEL),
|
click: () => send(IPC_COMMANDS.MACHINE_CTRL_ALT_DEL),
|
||||||
enabled: isRunning
|
enabled: isRunning
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Send Alt+F4",
|
||||||
|
click: () => send(IPC_COMMANDS.MACHINE_ALT_F4),
|
||||||
|
enabled: isRunning
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "Send Alt+Enter",
|
||||||
|
click: () => send(IPC_COMMANDS.MACHINE_ALT_ENTER),
|
||||||
|
enabled: isRunning
|
||||||
|
},
|
||||||
{
|
{
|
||||||
type: "separator"
|
type: "separator"
|
||||||
},
|
},
|
||||||
|
|
|
@ -119,6 +119,32 @@ export class Emulator extends React.Component<{}, EmulatorState> {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on(IPC_COMMANDS.MACHINE_ALT_F4, () => {
|
||||||
|
if (this.state.emulator && this.state.isRunning) {
|
||||||
|
this.state.emulator.keyboard_send_scancodes([
|
||||||
|
0x38, // alt
|
||||||
|
0x3E, // f4
|
||||||
|
|
||||||
|
// break codes
|
||||||
|
0x38 | 0x80,
|
||||||
|
0x3E | 0x80
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ipcRenderer.on(IPC_COMMANDS.MACHINE_ALT_ENTER, () => {
|
||||||
|
if (this.state.emulator && this.state.isRunning) {
|
||||||
|
this.state.emulator.keyboard_send_scancodes([
|
||||||
|
0x38, // alt
|
||||||
|
0, // enter
|
||||||
|
|
||||||
|
// break codes
|
||||||
|
0x38 | 0x80,
|
||||||
|
0 | 0x80
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
ipcRenderer.on(IPC_COMMANDS.MACHINE_STOP, this.stopEmulator);
|
ipcRenderer.on(IPC_COMMANDS.MACHINE_STOP, this.stopEmulator);
|
||||||
ipcRenderer.on(IPC_COMMANDS.MACHINE_RESET, this.resetEmulator);
|
ipcRenderer.on(IPC_COMMANDS.MACHINE_RESET, this.resetEmulator);
|
||||||
ipcRenderer.on(IPC_COMMANDS.MACHINE_START, this.startEmulator);
|
ipcRenderer.on(IPC_COMMANDS.MACHINE_START, this.startEmulator);
|
||||||
|
|
Loading…
Reference in a new issue