Skip to content
Source
Sign inSign up

WindowsCaptureFeedback.ts

15 lines715 Bytes

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 // Show() reads the switch synchronously; restore it before other windows or animations can be affected.
8 const alreadyDisabled = Electron.app.commandLine.hasSwitch(WINDOW_ANIMATIONS_DISABLED);
9 if (!alreadyDisabled) Electron.app.commandLine.appendSwitch(WINDOW_ANIMATIONS_DISABLED);
10 try {
11 window.showInactive();
12 } finally {
13 if (!alreadyDisabled) Electron.app.commandLine.removeSwitch(WINDOW_ANIMATIONS_DISABLED);
14 }