1import * as Electron from "electron";
2
3const WINDOW_ANIMATIONS_DISABLED = "wm-window-animations-disabled";
4
5/** Show capture feedback without Aura's extra 200 ms fade/scale on transparent windows. */
6export function showWindowsCaptureOverlay(window: Electron.BaseWindow): void {
7 // Chromium reads this switch synchronously inside Show(). Restore it before returning
8 // so other windows and CSS animations keep their normal behavior.
9 const alreadyDisabled = Electron.app.commandLine.hasSwitch(WINDOW_ANIMATIONS_DISABLED);
10 if (!alreadyDisabled) Electron.app.commandLine.appendSwitch(WINDOW_ANIMATIONS_DISABLED);
11 try {
12 window.showInactive();
13 } finally {
14 if (!alreadyDisabled) Electron.app.commandLine.removeSwitch(WINDOW_ANIMATIONS_DISABLED);
15 }
16}