sindresorhus/KeyboardShortcuts

KeyboardShortcuts doesn't work when appsandbox is removed

pradeepb28 opened this issue · 5 comments

Hello, I've tested your library on Xcode that works perfectly when App sandbox is enabled under Signing & Capabilities tab, but as soon as I removed App sandbox, keyboard shortcuts doesn't work(I don't see any errors in the library though).

My question, is App sandbox necessary to make it work?

More information,

  • I've registered keys using Recorder method
  • My app's use-case requires me to remove sandbox(so I've no choice here to enable it)

Any help is highly appreciated 🙏

I tried removing sandboxing from the example app and it still works fine.

@sindresorhus here is a quick video - the video demonstrate before and after sandbox is removed.

Additional tests:(not recorded in the video)

  • After sandbox is removed, each time when I run the app - it doesn't show keyboard shortcut at all even after setting it

lmk if you need any additional information

macOS uses different UserDefaults storage for sandboxed and non-sandboxed apps. So it's expected that the keyboard shortcuts are not preserved when turning on/off sandboxing.

@sindresorhus got it any workaround here so that keyboard shortcuts are preserved no matter what the state of sandbox is so that shortcuts works all the time? Any help is appreciated

If you go from sandboxed to non-sandboxed, you could read it from the sandboxed location, but that is not easily done the other way around. You would have to prompt the user to give access to the location.

This discussion is no longer related to this package, so I'm going to close. I would recommend asking future questions on Stack Overflow.