From 06aff69adb97385e9a84eb8c2bd7d1472f6f722a Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 18 Jan 2023 10:14:03 +0500 Subject: [PATCH] desktop: hide window thumbnail on Windows in privacy mode --- apps/web/desktop/electron.js | 3 ++- apps/web/desktop/ipc/actions/setPrivacyMode.js | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/web/desktop/electron.js b/apps/web/desktop/electron.js index 21edbe534..b28d9d2b0 100644 --- a/apps/web/desktop/electron.js +++ b/apps/web/desktop/electron.js @@ -34,6 +34,7 @@ import { sendMessageToRenderer } from "./ipc/utils"; import { EVENTS } from "./events"; import "./ipc/index.js"; import getPrivacyMode from "./ipc/calls/getPrivacyMode"; +import setPrivacyMode from "./ipc/actions/setPrivacyMode"; if (!RELEASE) { require("electron-reloader")(module); @@ -88,7 +89,7 @@ async function createWindow() { mainWindow.webContents.openDevTools({ mode: "right", activate: true }); if (getPrivacyMode()) { - global.win.setContentProtection(true); + setPrivacyMode({ privacyMode: getPrivacyMode() }); } try { diff --git a/apps/web/desktop/ipc/actions/setPrivacyMode.js b/apps/web/desktop/ipc/actions/setPrivacyMode.js index 43378f5cc..facdde2b3 100644 --- a/apps/web/desktop/ipc/actions/setPrivacyMode.js +++ b/apps/web/desktop/ipc/actions/setPrivacyMode.js @@ -23,5 +23,10 @@ export default (args) => { if (!global.win) return; const { privacyMode } = args; global.win.setContentProtection(privacyMode); + global.win.setThumbnailClip( + privacyMode + ? { x: 0, y: 0, width: 1, height: 1 } + : { x: 0, y: 0, width: 0, height: 0 } + ); setPrivacyMode(privacyMode); };