simen-keyboard-listener 1.1.30 → 1.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -926,6 +926,15 @@ declare function createGlobalKeyboardListener(): IGlobalKeyboardListener;
926
926
  * Call this before starting the listener to provide better UX when permission is missing.
927
927
  */
928
928
  declare function checkKeyboardPermission(): boolean;
929
+ /**
930
+ * Check if the app has automation permission for System Events on macOS.
931
+ * Uses AEDeterminePermissionToAutomateTarget (Carbon API) to check
932
+ * if the app can send Apple Events to System Events.
933
+ * - On macOS: returns true if automation is permitted
934
+ * - On Windows: always returns true (not applicable)
935
+ * - On other platforms: returns false
936
+ */
937
+ declare function checkAutomationPermission(): boolean;
929
938
  /**
930
939
  * Request Input Monitoring permission on macOS.
931
940
  * Calls CGRequestListenEventAccess which triggers the system permission prompt
@@ -1006,4 +1015,4 @@ declare function setBlockSystemHotkeys(block: boolean): void;
1006
1015
  */
1007
1016
  declare function setBlockedShortcuts(shortcuts: string[]): void;
1008
1017
 
1009
- export { type IAgentContext$1 as IAgentContext, type IAgentContextOptions$1 as IAgentContextOptions, type IClipboardContent$1 as IClipboardContent, type IDesktopItem$1 as IDesktopItem, type IExecuteOptions$1 as IExecuteOptions, type IExecuteResult$1 as IExecuteResult, type IFileContent$1 as IFileContent, type IFileMetadata$1 as IFileMetadata, type IFinderContext, type IFinderItem, type IFinderSelection, type IFinderWindow, type IFinderWindowInfo, type IFinderWindowItem, type IFrontmostApp$1 as IFrontmostApp, type IFrontmostInfo, type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, type IPageContextInfo, type IPermissionLostListener, type IReadFileOptions$1 as IReadFileOptions, type IRecentFile$1 as IRecentFile, type IRunningApp$1 as IRunningApp, type ISelectedItem$1 as ISelectedItem, type ISystemContext$1 as ISystemContext, checkKeyboardPermission, createGlobalKeyboardListener, escapeForAppleScript, executeAndParse$1 as executeAndParse, executeAppleScript, executeAppleScriptLines, executeMultilineAndParse$1 as executeMultilineAndParse, getAgentContext$1 as getAgentContext, getClipboardContent$1 as getClipboardContent, getClipboardText$1 as getClipboardText, getDesktopItems, getDesktopPath, getFileMetadata, getFilesMetadata, getFinderContext, getFinderCurrentFolder, getFinderSelection, getFinderWindows, getFocusedValue, getFrontmostApp$1 as getFrontmostApp, getFrontmostFromRunning, getFrontmostInfo, getGlobalKeyboardListener, getPageContext, getRecentDocuments, getRecentFiles, getRunningApps, getSelectedTextSmart, getSystemContext$1 as getSystemContext, isAppRunning, isEditable, isOsascriptAvailable, index as powershell, readFileContent, readMultipleFiles, requestKeyboardPermission, setBlockSystemHotkeys, setBlockedShortcuts };
1018
+ export { type IAgentContext$1 as IAgentContext, type IAgentContextOptions$1 as IAgentContextOptions, type IClipboardContent$1 as IClipboardContent, type IDesktopItem$1 as IDesktopItem, type IExecuteOptions$1 as IExecuteOptions, type IExecuteResult$1 as IExecuteResult, type IFileContent$1 as IFileContent, type IFileMetadata$1 as IFileMetadata, type IFinderContext, type IFinderItem, type IFinderSelection, type IFinderWindow, type IFinderWindowInfo, type IFinderWindowItem, type IFrontmostApp$1 as IFrontmostApp, type IFrontmostInfo, type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, type IPageContextInfo, type IPermissionLostListener, type IReadFileOptions$1 as IReadFileOptions, type IRecentFile$1 as IRecentFile, type IRunningApp$1 as IRunningApp, type ISelectedItem$1 as ISelectedItem, type ISystemContext$1 as ISystemContext, checkAutomationPermission, checkKeyboardPermission, createGlobalKeyboardListener, escapeForAppleScript, executeAndParse$1 as executeAndParse, executeAppleScript, executeAppleScriptLines, executeMultilineAndParse$1 as executeMultilineAndParse, getAgentContext$1 as getAgentContext, getClipboardContent$1 as getClipboardContent, getClipboardText$1 as getClipboardText, getDesktopItems, getDesktopPath, getFileMetadata, getFilesMetadata, getFinderContext, getFinderCurrentFolder, getFinderSelection, getFinderWindows, getFocusedValue, getFrontmostApp$1 as getFrontmostApp, getFrontmostFromRunning, getFrontmostInfo, getGlobalKeyboardListener, getPageContext, getRecentDocuments, getRecentFiles, getRunningApps, getSelectedTextSmart, getSystemContext$1 as getSystemContext, isAppRunning, isEditable, isOsascriptAvailable, index as powershell, readFileContent, readMultipleFiles, requestKeyboardPermission, setBlockSystemHotkeys, setBlockedShortcuts };
package/dist/index.d.ts CHANGED
@@ -926,6 +926,15 @@ declare function createGlobalKeyboardListener(): IGlobalKeyboardListener;
926
926
  * Call this before starting the listener to provide better UX when permission is missing.
927
927
  */
928
928
  declare function checkKeyboardPermission(): boolean;
929
+ /**
930
+ * Check if the app has automation permission for System Events on macOS.
931
+ * Uses AEDeterminePermissionToAutomateTarget (Carbon API) to check
932
+ * if the app can send Apple Events to System Events.
933
+ * - On macOS: returns true if automation is permitted
934
+ * - On Windows: always returns true (not applicable)
935
+ * - On other platforms: returns false
936
+ */
937
+ declare function checkAutomationPermission(): boolean;
929
938
  /**
930
939
  * Request Input Monitoring permission on macOS.
931
940
  * Calls CGRequestListenEventAccess which triggers the system permission prompt
@@ -1006,4 +1015,4 @@ declare function setBlockSystemHotkeys(block: boolean): void;
1006
1015
  */
1007
1016
  declare function setBlockedShortcuts(shortcuts: string[]): void;
1008
1017
 
1009
- export { type IAgentContext$1 as IAgentContext, type IAgentContextOptions$1 as IAgentContextOptions, type IClipboardContent$1 as IClipboardContent, type IDesktopItem$1 as IDesktopItem, type IExecuteOptions$1 as IExecuteOptions, type IExecuteResult$1 as IExecuteResult, type IFileContent$1 as IFileContent, type IFileMetadata$1 as IFileMetadata, type IFinderContext, type IFinderItem, type IFinderSelection, type IFinderWindow, type IFinderWindowInfo, type IFinderWindowItem, type IFrontmostApp$1 as IFrontmostApp, type IFrontmostInfo, type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, type IPageContextInfo, type IPermissionLostListener, type IReadFileOptions$1 as IReadFileOptions, type IRecentFile$1 as IRecentFile, type IRunningApp$1 as IRunningApp, type ISelectedItem$1 as ISelectedItem, type ISystemContext$1 as ISystemContext, checkKeyboardPermission, createGlobalKeyboardListener, escapeForAppleScript, executeAndParse$1 as executeAndParse, executeAppleScript, executeAppleScriptLines, executeMultilineAndParse$1 as executeMultilineAndParse, getAgentContext$1 as getAgentContext, getClipboardContent$1 as getClipboardContent, getClipboardText$1 as getClipboardText, getDesktopItems, getDesktopPath, getFileMetadata, getFilesMetadata, getFinderContext, getFinderCurrentFolder, getFinderSelection, getFinderWindows, getFocusedValue, getFrontmostApp$1 as getFrontmostApp, getFrontmostFromRunning, getFrontmostInfo, getGlobalKeyboardListener, getPageContext, getRecentDocuments, getRecentFiles, getRunningApps, getSelectedTextSmart, getSystemContext$1 as getSystemContext, isAppRunning, isEditable, isOsascriptAvailable, index as powershell, readFileContent, readMultipleFiles, requestKeyboardPermission, setBlockSystemHotkeys, setBlockedShortcuts };
1018
+ export { type IAgentContext$1 as IAgentContext, type IAgentContextOptions$1 as IAgentContextOptions, type IClipboardContent$1 as IClipboardContent, type IDesktopItem$1 as IDesktopItem, type IExecuteOptions$1 as IExecuteOptions, type IExecuteResult$1 as IExecuteResult, type IFileContent$1 as IFileContent, type IFileMetadata$1 as IFileMetadata, type IFinderContext, type IFinderItem, type IFinderSelection, type IFinderWindow, type IFinderWindowInfo, type IFinderWindowItem, type IFrontmostApp$1 as IFrontmostApp, type IFrontmostInfo, type IGlobalKeyDownMap, type IGlobalKeyEvent, type IGlobalKeyListener, type IGlobalKeyState, type IGlobalKeyboardListener, type IPageContextInfo, type IPermissionLostListener, type IReadFileOptions$1 as IReadFileOptions, type IRecentFile$1 as IRecentFile, type IRunningApp$1 as IRunningApp, type ISelectedItem$1 as ISelectedItem, type ISystemContext$1 as ISystemContext, checkAutomationPermission, checkKeyboardPermission, createGlobalKeyboardListener, escapeForAppleScript, executeAndParse$1 as executeAndParse, executeAppleScript, executeAppleScriptLines, executeMultilineAndParse$1 as executeMultilineAndParse, getAgentContext$1 as getAgentContext, getClipboardContent$1 as getClipboardContent, getClipboardText$1 as getClipboardText, getDesktopItems, getDesktopPath, getFileMetadata, getFilesMetadata, getFinderContext, getFinderCurrentFolder, getFinderSelection, getFinderWindows, getFocusedValue, getFrontmostApp$1 as getFrontmostApp, getFrontmostFromRunning, getFrontmostInfo, getGlobalKeyboardListener, getPageContext, getRecentDocuments, getRecentFiles, getRunningApps, getSelectedTextSmart, getSystemContext$1 as getSystemContext, isAppRunning, isEditable, isOsascriptAvailable, index as powershell, readFileContent, readMultipleFiles, requestKeyboardPermission, setBlockSystemHotkeys, setBlockedShortcuts };
package/dist/index.js CHANGED
@@ -30,6 +30,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/index.ts
31
31
  var index_exports = {};
32
32
  __export(index_exports, {
33
+ checkAutomationPermission: () => checkAutomationPermission,
33
34
  checkKeyboardPermission: () => checkKeyboardPermission,
34
35
  createGlobalKeyboardListener: () => createGlobalKeyboardListener,
35
36
  escapeForAppleScript: () => escapeForAppleScript,
@@ -2471,6 +2472,17 @@ function checkKeyboardPermission() {
2471
2472
  return false;
2472
2473
  }
2473
2474
  }
2475
+ function checkAutomationPermission() {
2476
+ if (!IS_MACOS2 && !IS_WINDOWS2) {
2477
+ return false;
2478
+ }
2479
+ try {
2480
+ const addon = getNativeAddon();
2481
+ return addon.checkAutomationPermission?.() ?? false;
2482
+ } catch {
2483
+ return false;
2484
+ }
2485
+ }
2474
2486
  function requestKeyboardPermission() {
2475
2487
  if (!IS_MACOS2 && !IS_WINDOWS2) {
2476
2488
  return false;
@@ -2581,6 +2593,7 @@ function setBlockedShortcuts(shortcuts) {
2581
2593
  }
2582
2594
  // Annotate the CommonJS export names for ESM import in node:
2583
2595
  0 && (module.exports = {
2596
+ checkAutomationPermission,
2584
2597
  checkKeyboardPermission,
2585
2598
  createGlobalKeyboardListener,
2586
2599
  escapeForAppleScript,
package/dist/index.mjs CHANGED
@@ -2411,6 +2411,17 @@ function checkKeyboardPermission() {
2411
2411
  return false;
2412
2412
  }
2413
2413
  }
2414
+ function checkAutomationPermission() {
2415
+ if (!IS_MACOS2 && !IS_WINDOWS2) {
2416
+ return false;
2417
+ }
2418
+ try {
2419
+ const addon = getNativeAddon();
2420
+ return addon.checkAutomationPermission?.() ?? false;
2421
+ } catch {
2422
+ return false;
2423
+ }
2424
+ }
2414
2425
  function requestKeyboardPermission() {
2415
2426
  if (!IS_MACOS2 && !IS_WINDOWS2) {
2416
2427
  return false;
@@ -2520,6 +2531,7 @@ function setBlockedShortcuts(shortcuts) {
2520
2531
  }
2521
2532
  }
2522
2533
  export {
2534
+ checkAutomationPermission,
2523
2535
  checkKeyboardPermission,
2524
2536
  createGlobalKeyboardListener,
2525
2537
  escapeForAppleScript,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simen-keyboard-listener",
3
- "version": "1.1.30",
3
+ "version": "1.1.40",
4
4
  "description": "Native global keyboard listener for macOS and Windows",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -50,8 +50,8 @@
50
50
  "node-addon-api": "^8.0.0"
51
51
  },
52
52
  "optionalDependencies": {
53
- "@simen-keyboard-listener/darwin-arm64": "1.1.30",
54
- "@simen-keyboard-listener/win32-x64": "1.1.30"
53
+ "@simen-keyboard-listener/darwin-arm64": "1.1.40",
54
+ "@simen-keyboard-listener/win32-x64": "1.1.40"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@types/node": "^20.0.0",