Post

Replies

Boosts

Views

Activity

Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
Thank you, I've run quick tests re: what happens when callling CGRequestListenEventAccess()On various versions of macOS: Results: 15.8.3 : no alert dialog 26.6.2: "MyApp would like to receive keystrokes from Any Application".When I click to OK it, the System Settings / Privacy & Seucurity / Input Monitoring pane opens up. 27.3b2 : no alert dialog For all 3, the return code of CGRequestListenEventAcces() = false. However, with 26.6.2, if I enable the permission, the OS helpfully offers to quit & restart the app, at which point CGRequestListenEventAccess() = true. So, it does seem like 27.3b2 may be missing a feature that 26 has? Note: I'm testing with an app that is not code-signed, sandboxed, or notarized, and has no entitlements in the plist.
Topic: Privacy & Security SubTopic: General Tags:
4d
Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
Running some tests in 27.3 beta 2 and I'm seeing behavior which I don't understand. I have an app which tries to set up a CGEventTap with various combinations of options Location: always cgSessionEventTap Place: always headInsertEventTap Options: either defaultTap or listenOnly eventsOfInterest: which events are in the mask. InputMonitoring: whether the app has been manually added to System Settings / Privacy & Security / Input Monitoring General Results: Options: defaultTap fails for any combination of events, regardless of InputMonitoring permissions. Keyboard Events: Options: listenOnly returns keyboard FlagsChanged event, regardless of InputMonitoring permissions (but only when the App is frontmost). Options: listenOnly returns keyUp and keyDown events, but only when InputMonitoring permission is enabled, and works when the App is not frontmost. Mouse Events: Options: listenOnly returns mouse events, regardless of InputMonitoring setting (but only when the App is frontmost). Options: listenOnly returns mouse events, but only when InputMonitoring permission is enabled, and works when the App is not frontmost. Notes/Issues/Questions: System Settings / Privacy & Security / Input Monitoring when set for an app, appears to enable the app to set up a CGEventTap in listenOnly mode - so it can get events (either mouse or keyboard), but can't modify these events. I could find no way to enable CGEventTap in default (read and modify mode). Presumably this is gated by the Accessibility permission still? None of my app's attempts to set up CGEventTaps triggered any OS dialogs. I would have expected the OS to put up some sort of "Your app is attempting to listen to Mouse or Keyboard events, Allow?" dialog but I never saw anything. If I'm understanding things, it seems an App's ability to read and modify events with a CGEventTap is not possible in 27.3.
Topic: Privacy & Security SubTopic: General Tags:
1w
Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
In 27.3 beta 2, the UI for Accessibility permission says: "Apps with Accessibility access bypass built-in system protections that keep your data private and secure. They can see everything on your screen, including apps in the background, and control apps as if they were you without asking." That's clearly not the permissions that my app needs - I just want to monitor (and sometimes change) mouse and touchpad events. There's a different Input Monitoring permission which says "Allow the applications below to monitor input from your keyboard even while using other applications". This is closer to what my app wants, but for mouse and touch events, not for keyboard.
Topic: Privacy & Security SubTopic: General Tags:
1w
Reply to Accessing preferences in another app's sandbox - operation denied and NSAppDataUsageDescription never shows
I like your suggestion, but I just tried it and it seems that ~/Library/Application Support/ is re-routed inside the container, e.g. let rawPath = "~/Application Support/com.example/\(self.bundleID).plist" let path = (rawPath as NSString).expandingTildeInPath let url = URL(fileURLWithPath: path) guard let dict = NSDictionary(contentsOf: url) as? [String: Any] else { print("Error: Failed to read or parse plist at: \(path)") When run in context of a .saver running inside LegacyScreenSaver, this happens: Failed to read or parse plist at: /Users/username/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver.x86-64/Data/Application Support/com.example/com.example.foobar.plist I did another test where, instead of using ~/Library/Application Support/ I used /Users/Shared/com.example and that one seemed to work. Using /Users/Shared/ is not very elegant, but seems to be a location of last resort that some other apps use in some cases. Am I missing something? Is there a way from inside a sandbox, to get to the real ~/Library/Application Support/ folder, not the containerized one?
Topic: Privacy & Security SubTopic: General Tags:
Jul ’26
Reply to Accessing preferences in another app's sandbox - operation denied and NSAppDataUsageDescription never shows
Thanks, @DTS Engineer for your (as always) thoughtful comments. I agree that using Appex format would be ideal. I submitted FB24013514 (under macOS / ExtensionKit / Suggestion) which I hope was the right category choice. As for workarounds using legacyScreenSaver, I believe I have found one. While it is true that a .saver running in the legacyScreenSaver sandbox can not read or write data from ~/Library/Preferences/com.foobar.plist ...it appears that it can read data from /Library/Preferences/com.foobar.plist (the shared Preferences location) with this code: let val = CFPreferencesCopyValue(key as CFString, self.bundleID as CFString, kCFPreferencesAnyUser, kCFPreferencesAnyHost) So a possible workaround is for the installer to write data to this location, which the screen saver can then read. I'm not sure if this is a clever and legitimate workaround or a bad idea. It seems unlikely to me that Apple would decide to restrict read-only access to /Library/Preferences in the future, but I don't have a great track record making these sorts of predictions.
Topic: Privacy & Security SubTopic: General Tags:
Jul ’26
Reply to macOS 26 Tahoe Screen Saver issues
I have also submitted a case regarding the regressions in UI/UX for screensavers: Tahoe has redesigned the UI for System Settings to remove the Screen Saver pane altogether. Instead, you access Screen Savers from within the Wallpaper settings. This has the following issues: Confusion - macOS has emphasized the importance of Screen Saves in recent years, and users expect to have a Screen Saver pane Usability - although you can access the Screen Savers settings, it’s now hidden behind a button within the Wallpaper settings, and the resulting window runs as a very small modal non-resizable dialog. Since macOS ships with dozens of screensavers by default, forcing the user to navigate these in a tiny window is just silly. Backwards compatibility is broken. For example, the command open x-apple.systempreferences:com.apple.ScreenSaver-Settings.extension No longer works in Tahoe. FB18698083
Topic: App & System Services SubTopic: General Tags:
Jul ’25
Reply to macOS 26 Tahoe Screen Saver issues
Testing using Beta 3, I've figured out one of the issues: In macOS Tahoe, when you are viewing the Screen Savers dialog (from inside Wallpaper), using legacyScreenSaver, the system is incorrectly launching 2 copies - one at fullscreen on the main screen, and then a second (correct) instance which is in Preview mode. Reported as FB18697726
Topic: App & System Services SubTopic: General Tags:
Jul ’25
Reply to Info.plist key for Accessibility (Events) Description
It's not related to NSAppleEventsUsageDescription - that's for something else. Specifically, I'm trying to set up a CGEventTap with the defaultTap option: https://developer.apple.com/documentation/coregraphics/cgeventtapoptions/defaulttap This triggers the OS dialog that looks like this: My question is: can this dialog be customized in any way?
Topic: Privacy & Security SubTopic: General Tags:
Jun ’24
Reply to Third-party screensavers not quitting on Sonoma - any workarounds?
There are many bugs with third-party screensavers under Sonoma. Here's a long thread that discusses a number of fixes: https://github.com/JohnCoates/Aerial/issues/1305 In particular, if your screensaver detects when it needs to exit, it can call exit(0) which seems to do the trick. Direct link: https://github.com/JohnCoates/Aerial/issues/1305#issuecomment-1680853387
Topic: App & System Services SubTopic: General Tags:
Apr ’24
Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
Thank you, I've run quick tests re: what happens when callling CGRequestListenEventAccess()On various versions of macOS: Results: 15.8.3 : no alert dialog 26.6.2: "MyApp would like to receive keystrokes from Any Application".When I click to OK it, the System Settings / Privacy & Seucurity / Input Monitoring pane opens up. 27.3b2 : no alert dialog For all 3, the return code of CGRequestListenEventAcces() = false. However, with 26.6.2, if I enable the permission, the OS helpfully offers to quit & restart the app, at which point CGRequestListenEventAccess() = true. So, it does seem like 27.3b2 may be missing a feature that 26 has? Note: I'm testing with an app that is not code-signed, sandboxed, or notarized, and has no entitlements in the plist.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
4d
Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
Running some tests in 27.3 beta 2 and I'm seeing behavior which I don't understand. I have an app which tries to set up a CGEventTap with various combinations of options Location: always cgSessionEventTap Place: always headInsertEventTap Options: either defaultTap or listenOnly eventsOfInterest: which events are in the mask. InputMonitoring: whether the app has been manually added to System Settings / Privacy & Security / Input Monitoring General Results: Options: defaultTap fails for any combination of events, regardless of InputMonitoring permissions. Keyboard Events: Options: listenOnly returns keyboard FlagsChanged event, regardless of InputMonitoring permissions (but only when the App is frontmost). Options: listenOnly returns keyUp and keyDown events, but only when InputMonitoring permission is enabled, and works when the App is not frontmost. Mouse Events: Options: listenOnly returns mouse events, regardless of InputMonitoring setting (but only when the App is frontmost). Options: listenOnly returns mouse events, but only when InputMonitoring permission is enabled, and works when the App is not frontmost. Notes/Issues/Questions: System Settings / Privacy & Security / Input Monitoring when set for an app, appears to enable the app to set up a CGEventTap in listenOnly mode - so it can get events (either mouse or keyboard), but can't modify these events. I could find no way to enable CGEventTap in default (read and modify mode). Presumably this is gated by the Accessibility permission still? None of my app's attempts to set up CGEventTaps triggered any OS dialogs. I would have expected the OS to put up some sort of "Your app is attempting to listen to Mouse or Keyboard events, Allow?" dialog but I never saw anything. If I'm understanding things, it seems an App's ability to read and modify events with a CGEventTap is not possible in 27.3.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
1w
Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
Historically, Input Monitor gated access to CGEventTap, but you could also gain access to it via Accessibility. If you only need CGEventTap and don’t need other Accessibility APIs, that’s the direction I’d go. I'll give that a try, and report back here with success or failure, and will definitly file Feedback cases as needed.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
1w
Reply to Reading Mouse Events with CGEvent tap from a background app in macOS 27.3
In 27.3 beta 2, the UI for Accessibility permission says: "Apps with Accessibility access bypass built-in system protections that keep your data private and secure. They can see everything on your screen, including apps in the background, and control apps as if they were you without asking." That's clearly not the permissions that my app needs - I just want to monitor (and sometimes change) mouse and touchpad events. There's a different Input Monitoring permission which says "Allow the applications below to monitor input from your keyboard even while using other applications". This is closer to what my app wants, but for mouse and touch events, not for keyboard.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
1w
Reply to Accessing preferences in another app's sandbox - operation denied and NSAppDataUsageDescription never shows
I like your suggestion, but I just tried it and it seems that ~/Library/Application Support/ is re-routed inside the container, e.g. let rawPath = "~/Application Support/com.example/\(self.bundleID).plist" let path = (rawPath as NSString).expandingTildeInPath let url = URL(fileURLWithPath: path) guard let dict = NSDictionary(contentsOf: url) as? [String: Any] else { print("Error: Failed to read or parse plist at: \(path)") When run in context of a .saver running inside LegacyScreenSaver, this happens: Failed to read or parse plist at: /Users/username/Library/Containers/com.apple.ScreenSaver.Engine.legacyScreenSaver.x86-64/Data/Application Support/com.example/com.example.foobar.plist I did another test where, instead of using ~/Library/Application Support/ I used /Users/Shared/com.example and that one seemed to work. Using /Users/Shared/ is not very elegant, but seems to be a location of last resort that some other apps use in some cases. Am I missing something? Is there a way from inside a sandbox, to get to the real ~/Library/Application Support/ folder, not the containerized one?
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’26
Reply to Accessing preferences in another app's sandbox - operation denied and NSAppDataUsageDescription never shows
Thanks, @DTS Engineer for your (as always) thoughtful comments. I agree that using Appex format would be ideal. I submitted FB24013514 (under macOS / ExtensionKit / Suggestion) which I hope was the right category choice. As for workarounds using legacyScreenSaver, I believe I have found one. While it is true that a .saver running in the legacyScreenSaver sandbox can not read or write data from ~/Library/Preferences/com.foobar.plist ...it appears that it can read data from /Library/Preferences/com.foobar.plist (the shared Preferences location) with this code: let val = CFPreferencesCopyValue(key as CFString, self.bundleID as CFString, kCFPreferencesAnyUser, kCFPreferencesAnyHost) So a possible workaround is for the installer to write data to this location, which the screen saver can then read. I'm not sure if this is a clever and legitimate workaround or a bad idea. It seems unlikely to me that Apple would decide to restrict read-only access to /Library/Preferences in the future, but I don't have a great track record making these sorts of predictions.
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’26
Reply to macOS 26 Tahoe Screen Saver issues
I have also submitted a case regarding the regressions in UI/UX for screensavers: Tahoe has redesigned the UI for System Settings to remove the Screen Saver pane altogether. Instead, you access Screen Savers from within the Wallpaper settings. This has the following issues: Confusion - macOS has emphasized the importance of Screen Saves in recent years, and users expect to have a Screen Saver pane Usability - although you can access the Screen Savers settings, it’s now hidden behind a button within the Wallpaper settings, and the resulting window runs as a very small modal non-resizable dialog. Since macOS ships with dozens of screensavers by default, forcing the user to navigate these in a tiny window is just silly. Backwards compatibility is broken. For example, the command open x-apple.systempreferences:com.apple.ScreenSaver-Settings.extension No longer works in Tahoe. FB18698083
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to macOS 26 Tahoe Screen Saver issues
Testing using Beta 3, I've figured out one of the issues: In macOS Tahoe, when you are viewing the Screen Savers dialog (from inside Wallpaper), using legacyScreenSaver, the system is incorrectly launching 2 copies - one at fullscreen on the main screen, and then a second (correct) instance which is in Preview mode. Reported as FB18697726
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jul ’25
Reply to Info.plist key for Accessibility (Events) Description
It's not related to NSAppleEventsUsageDescription - that's for something else. Specifically, I'm trying to set up a CGEventTap with the defaultTap option: https://developer.apple.com/documentation/coregraphics/cgeventtapoptions/defaulttap This triggers the OS dialog that looks like this: My question is: can this dialog be customized in any way?
Topic: Privacy & Security SubTopic: General Tags:
Replies
Boosts
Views
Activity
Jun ’24
Reply to Third-party screensavers not quitting on Sonoma - any workarounds?
There are many bugs with third-party screensavers under Sonoma. Here's a long thread that discusses a number of fixes: https://github.com/JohnCoates/Aerial/issues/1305 In particular, if your screensaver detects when it needs to exit, it can call exit(0) which seems to do the trick. Direct link: https://github.com/JohnCoates/Aerial/issues/1305#issuecomment-1680853387
Topic: App & System Services SubTopic: General Tags:
Replies
Boosts
Views
Activity
Apr ’24