MCPcopy Index your code
hub / github.com/CapSoftware/Cap / pressHotkey

Function pressHotkey

apps/desktop/scripts/desktop-memory-soak.js:319–330  ·  view source on GitHub ↗
(hotkey)

Source from the content-addressed store, hash-verified

317}
318
319function pressHotkey(hotkey) {
320 const keyCode = APPLE_KEY_CODES[hotkey.code];
321
322 if (keyCode === undefined) {
323 throw new Error(`Unsupported hotkey code: ${hotkey.code}`);
324 }
325
326 execFileSync("osascript", [
327 "-e",
328 `tell application "System Events" to key code ${keyCode} using {${modifiersForHotkey(hotkey)}}`,
329 ]);
330}
331
332function sleepDisplay() {
333 execFileSync("pmset", ["displaysleepnow"]);

Callers 1

runAutomatedCycleFunction · 0.85

Calls 1

modifiersForHotkeyFunction · 0.85

Tested by

no test coverage detected