skhd icon indicating copy to clipboard operation
skhd copied to clipboard

Can't access calendar data using icalbuddy

Open Peeja opened this issue 6 years ago • 5 comments

I'm trying to use icalBuddy to get the current calendar event (icalBuddy eventsNow), but icalBuddy reports:

error: No calendars.

That's not correct, though, and doesn't match what I get running it from iTerm. That's probably because i'm on Mojave, and when I run it from iTerm (the first time), I'm prompted to allow iTerm to access my calendars, which I've allowed. But when I run it from skhd, I never get prompted, and there doesn't appear to be a way to manually add it.

Is there a trick to enabling this permission for skhd, which I think will fix the problem?

Peeja avatar Dec 17 '19 19:12 Peeja

It looks like iTerm had to do some work to support this, and so skhd may need to as well: https://gitlab.com/gnachman/iterm2/issues/6977

Peeja avatar Dec 17 '19 19:12 Peeja

This is a privilege that the icalBuddy binary should have, and not all the applications that act as a launcher of said binary. As far as I can tell, icalBuddy has not been actively maintained in a long time?

asmvik avatar Jan 18 '20 13:01 asmvik

Hmm, that hasn't been my experience with command line apps. Generally, the permissions seem to be based on the "topmost" process. I think the idea is that Apple doesn't want every app that shells out to a tool like icalBuddy to have the same set of permissions, so in this case macOS knows that I'm comfortable using icalBuddy directly, but doesn't want to assume that I'm comfortable with skhd having access to my calendar data.

Notably, running icalBuddy eventsNow from the terminal shows me my events, so icalBuddy itself has the privileges it needs.

Peeja avatar Jan 18 '20 18:01 Peeja

Looks like the developer of iTerm solved the issue by adding a key with the name NSCalendarsUsageDescription to the applications .plist file. I don't know how that would translate for single binary daemon applications.

asmvik avatar Jan 18 '20 18:01 asmvik

Yep, looks like imagesnap has similar problems: https://github.com/rharder/imagesnap/issues/26

There are some…interesting hacks in that thread. Nothing seems terribly nice. I'm resorting to running this particular keybinding from Alfred for now, but if anyone comes up with a way to enable this for skhd, I'd much rather keep it there.

Peeja avatar Jan 19 '20 02:01 Peeja