MCPcopy Index your code
hub / github.com/gitify-app/gitify / takeScreenshot

Function takeScreenshot

src/main/utils.ts:24–42  ·  view source on GitHub ↗
(mb: Menubar)

Source from the content-addressed store, hash-verified

22 * @param mb - The menubar instance whose window is captured.
23 */
24export function takeScreenshot(mb: Menubar) {
25 const date = new Date();
26 const dateStr = date.toISOString().replaceAll(':', '-');
27
28 const capturedPicFilePath = path.join(
29 os.homedir(),
30 `${dateStr}-${APPLICATION.NAME}-screenshot.png`,
31 );
32
33 if (!mb.window) {
34 return;
35 }
36
37 mb.window.capturePage().then((img) => {
38 fs.writeFile(capturedPicFilePath, img.toPNG(), () =>
39 logInfo('takeScreenshot', `Screenshot saved ${capturedPicFilePath}`),
40 );
41 });
42}
43
44/**
45 * Open the directory containing the application log file in the OS file manager.

Callers 2

utils.test.tsFile · 0.90
buildMenuMethod · 0.90

Calls 1

logInfoFunction · 0.90

Tested by

no test coverage detected