MCPcopy
hub / github.com/wavetermdev/waveterm / handleWindowsMenuAccelerators

Function handleWindowsMenuAccelerators

emain/emain-tabview.ts:24–94  ·  view source on GitHub ↗
(
    waveEvent: WaveKeyboardEvent,
    tabView: WaveTabView,
    fullConfig: FullConfigType
)

Source from the content-addressed store, hash-verified

22import { ElectronWshClient } from "./emain-wsh";
23
24function handleWindowsMenuAccelerators(
25 waveEvent: WaveKeyboardEvent,
26 tabView: WaveTabView,
27 fullConfig: FullConfigType
28): boolean {
29 const waveWindow = getWaveWindowById(tabView.waveWindowId);
30
31 if (checkKeyPressed(waveEvent, "Ctrl:Shift:n")) {
32 createNewWaveWindow();
33 return true;
34 }
35
36 if (checkKeyPressed(waveEvent, "Ctrl:Shift:r")) {
37 tabView.webContents.reloadIgnoringCache();
38 return true;
39 }
40
41 if (checkKeyPressed(waveEvent, "Ctrl:v")) {
42 const ctrlVPaste = fullConfig?.settings?.["app:ctrlvpaste"];
43 const shouldPaste = ctrlVPaste ?? true;
44 if (!shouldPaste) {
45 return false;
46 }
47 tabView.webContents.paste();
48 return true;
49 }
50
51 if (checkKeyPressed(waveEvent, "Ctrl:0")) {
52 resetZoomLevel(tabView.webContents);
53 return true;
54 }
55
56 if (checkKeyPressed(waveEvent, "Ctrl:=") || checkKeyPressed(waveEvent, "Ctrl:Shift:=")) {
57 increaseZoomLevel(tabView.webContents);
58 return true;
59 }
60
61 if (checkKeyPressed(waveEvent, "Ctrl:-") || checkKeyPressed(waveEvent, "Ctrl:Shift:-")) {
62 decreaseZoomLevel(tabView.webContents);
63 return true;
64 }
65
66 if (checkKeyPressed(waveEvent, "F11")) {
67 if (waveWindow) {
68 waveWindow.setFullScreen(!waveWindow.isFullScreen());
69 }
70 return true;
71 }
72
73 for (let i = 1; i <= 9; i++) {
74 if (checkKeyPressed(waveEvent, `Alt:Ctrl:${i}`)) {
75 const workspaceNum = i - 1;
76 RpcApi.WorkspaceListCommand(ElectronWshClient).then((workspaceList) => {
77 if (workspaceList && workspaceNum < workspaceList.length) {
78 const workspace = workspaceList[workspaceNum];
79 if (waveWindow) {
80 waveWindow.switchWorkspace(workspace.workspacedata.oid);
81 }

Callers 1

getOrCreateWebViewForTabFunction · 0.85

Calls 8

getWaveWindowByIdFunction · 0.90
checkKeyPressedFunction · 0.90
createNewWaveWindowFunction · 0.90
resetZoomLevelFunction · 0.90
increaseZoomLevelFunction · 0.90
decreaseZoomLevelFunction · 0.90
switchWorkspaceMethod · 0.80
WorkspaceListCommandMethod · 0.65

Tested by

no test coverage detected