MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / quakeToggle

Function quakeToggle

emain/emain-window.ts:1004–1058  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1002}
1003
1004async function quakeToggle() {
1005 if (quakeToggleInProgress) {
1006 return;
1007 }
1008 quakeToggleInProgress = true;
1009 try {
1010 let window = quakeWindow;
1011 if (window?.isDestroyed()) {
1012 quakeWindow = null;
1013 window = null;
1014 }
1015 if (window == null) {
1016 await createNewWaveWindow();
1017 return;
1018 }
1019 // Some environments don't hide or move the window if it's fullscreen (even when hidden), so leave fullscreen first
1020 if (window.isFullScreen()) {
1021 // macos has a really long fullscreen animation and can have issues restoring from fullscreen, so we skip on macos
1022 quakeRestoreFullscreenOnShow = process.platform !== "darwin";
1023 const leavePromise = waitForFullscreenLeave(window);
1024 window.setFullScreen(false);
1025 try {
1026 await leavePromise;
1027 } catch {
1028 // timeout — proceed anyway
1029 }
1030 if (window.isDestroyed()) {
1031 return;
1032 }
1033 }
1034 if (window.isVisible()) {
1035 window.hide();
1036 } else {
1037 const targetDisplay = getDisplayForQuakeToggle();
1038 moveWindowToDisplay(window, targetDisplay);
1039 window.show();
1040 if (quakeRestoreFullscreenOnShow) {
1041 const enterPromise = waitForFullscreenEnter(window);
1042 window.setFullScreen(true);
1043 try {
1044 await enterPromise;
1045 } catch {
1046 // timeout — proceed anyway
1047 }
1048 }
1049 quakeRestoreFullscreenOnShow = false;
1050 window.focus();
1051 if (window.activeTabView?.webContents) {
1052 window.activeTabView.webContents.focus();
1053 }
1054 }
1055 } finally {
1056 quakeToggleInProgress = false;
1057 }
1058}
1059
1060let currentRawGlobalHotKey: string = null;
1061let currentGlobalHotKey: string = null;

Callers

nothing calls this directly

Calls 5

createNewWaveWindowFunction · 0.85
waitForFullscreenLeaveFunction · 0.85
getDisplayForQuakeToggleFunction · 0.85
moveWindowToDisplayFunction · 0.85
waitForFullscreenEnterFunction · 0.85

Tested by

no test coverage detected