Skip to content

Permission issues #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
glpayson opened this issue Nov 16, 2024 · 4 comments
Closed

Permission issues #9

glpayson opened this issue Nov 16, 2024 · 4 comments
Labels
good first issue Good for newcomers

Comments

@glpayson
Copy link

glpayson commented Nov 16, 2024

Hello, I was trying to install and try out your workflow but I'm running into permission problems.

I downloaded Calendar++ v2.1.1 on Sonoma 14.2.1. I'm using Alfred 5.5.1. I normally run Fish shell but I changed with chsh -s /bin/zsh before installing.

I imported the workflow, clicked install, typed 'cc ' and got a permission popup.

Clicking "Grant Permission" plays a warning noise and causes the pop up to appear again. Clicking "Grant Permission" a second time causes the popup to disappear and nothing else to happen. When I type 'cc ' again I see:

ScreenFlow

Here is the debugger output:

[00:29:22.192] Calendar++[Script Filter] Queuing argument '(null)'
[00:29:22.359] Calendar++[External] Processing complete
[00:29:22.361] Calendar++[External] Passing output '' to Dialog Conditional
[00:29:28.450] Calendar++[Dialog Conditional] Processing complete
[00:29:28.460] Calendar++[Dialog Conditional] Passing output '' to Junction
[00:29:28.461] Calendar++[Junction] Processing complete
[00:29:28.461] Calendar++[Junction] Passing output '' to Run Script
[00:29:28.462] Calendar++[Junction] Passing output '' to Play Sound
[00:29:29.315] Calendar++[Play Sound] Processing complete
[00:29:29.323] Calendar++[Play Sound] Passing output '' to Delay
[00:29:29.829] Calendar++[Delay] Processing complete
[00:29:29.835] Calendar++[Delay] Passing output '' to Call External Trigger
[00:29:29.837] Calendar++[External] Processing complete
[00:29:29.839] Calendar++[External] Passing output '' to Script Filter
[00:29:29.859] Calendar++[Script Filter] Queuing argument '(null)'
[00:29:30.221] Calendar++[Script Filter] Script with argv '(null)' finished
[00:29:30.229] ERROR: Calendar++[Script Filter] Code 1: 2024-11-16 00:29:30.072 calpp[55564:18554478] The file “November16.png” doesn’t exist. - Calendarpp/IconRenderer.swift:77
[00:29:30.231] Calendar++[Script Filter] {
  "items" : [
    {
      "subtitle" : "Failed to request full access",
      "arg" : "Access to Calendar events has not been granted",
      "text" : {
        "largetype" : "Access to Calendar events has not been granted. Failed to request full access",
        "copy" : "Access to Calendar events has not been granted. Failed to request full access"
      },
      "icon" : {
        "path" : "images\/icons\/failure.png"
      },
      "valid" : true,
      "title" : "Access to Calendar events has not been granted"
    }
  ]
}

If I navigate to the folder, I can see that it seems like "allowed" is set to 1 in info.plist (see screenshot).

Running xattr -d com.apple.quarantine ./src/calpp manually gives me: No such xattr: com.apple.quarantine

I'm able to manually run the calendar .scpt's. Doing so prompts me to give Calendar permission to iTerm. I never got any similar request for permission to Calendar for Alfred.

CleanShot 2024-11-16 at 00 08 41@2x

If I look at System Settings > Privacy & Security, Alfred has permission on Contacts, Automation, Files and Folders, Full DIsk Access, and Accessibility but not Calendars. I don't see any option to manually add Alfred to the Calendar permissions and there doesn't seem to be a way to do it from the command line afaict.

Any idea what I'm missing?

@glpayson
Copy link
Author

Found your answer to what seems to be the same problem in a closed issue here. IIUC, you are saying to open a finder window, open the calendar permissions in system settings and manually drag and drop src/calpp into it. I tried doing that but it doesn't do anything.

ScreenFlow

@zeitlings
Copy link
Owner

Hey @glpayson

Thank you for the detailed report. I'm unsure what changed in macOS 14 regarding the process of manually granting full calendar access to an app. However, it's clear that the process has become much stricter. Perplexity suggests that any app that has requested access at least once should appear in the list. Alas, I don't see either Alfred or Calendarpp in your list, despite Alfred's response indicating calpp attempted to request access and failed.

I don't believe Alfred explicitly requests calendar access upfront. Perhaps it's best to ensure you have granted all requested permissions out of the box anyway (Alfred Preferences > General > Request Permissions...).

Nvm, it seems to you've already checked that.

If I look at System Settings > Privacy & Security, Alfred has permission on Contacts, Automation, Files and Folders, Full DIsk Access, and Accessibility but not Calendars. I don't see any option to manually add Alfred to the Calendar permissions and there doesn't seem to be a way to do it from the command line afaict.

Since running the AppleScript via iTerm caused it to appear in your list of apps that are eligible to request access, you could try a hacky approach. Create a Run Script object (triggered with a temporary keyword input). Then, paste the terminal command you already used into the script. This way, macOS should recognize Alfred as the application requesting permissions instead of iTerm. Or just connect a temporary keyword input to the existing Run Script object that has the note "Open Calendar at Date".

image

Another idea: Perhaps trying to open the calpp executable directly from the finder will make it show up?

Running xattr -d com.apple.quarantine ./src/calpp manually gives me: No such xattr: com.apple.quarantine

This just means that the quarantine has already been removed, so that's expected.

[00:29:30.229] ERROR: Calendar++[Script Filter] Code 1: 2024-11-16 00:29:30.072 calpp[55564:18554478] The file “November16.png” doesn’t exist. - Calendarpp/IconRenderer.swift:77

I'm also just noticing this error, but I think this is because calpp never got around to creating the image before bailing. You can keep an eye on the cache btw. via cc ? cache (which might be accessible before checking for permissions).

Also new is the warning visible in your GIF that the workflow has been edited since showing the Dialog. I suspect this being due to Alfred 5.5.1 fixing a long standing bug that required refreshing the workflow manually after modifying an environment variable.

Fix issue to refresh a workflow's compound variable cache after updating environment variables via AppleScript

Probably also unrelated, but another thing to keep an eye out for if the problem persists.

@glpayson
Copy link
Author

glpayson commented Nov 16, 2024

Hi @zeitlings, thanks so much for your quick and detailed response. Your 'hacky approach' worked, with an extra step. Let me write out the steps I took so other people that run into this issue can follow along:

  1. Add a keyword trigger and connect it to either of the Run Script actions that are connected to the 'cc' keyword trigger.

CleanShot 2024-11-16 at 12 47 26@2x

  1. Change the script in the Run script action to be hardcoded osascript src/open_calendar.scpt "2023 11 15". Save the original command -- you'll need to revert this later.

CleanShot 2024-11-16 at 12 53 39@2x

  1. Launch Alfred and type the keyword trigger from (1). This launches the calendar app and prompts me to give Alfred permission on Calendar.
  2. Open System Settings > Privacy & Security > Calendars and select 'Options...' for Alfred 5. Change from 'Add Only Access' to 'Full Calendar access'. This is the extra step. It still didn't work until I did this.

CleanShot 2024-11-16 at 12 50 58@2x

  1. Launch Alfred and type 'cc' and it works now!
  2. Go back and clean up (1) and revert (2).

Thanks again for your prompt help with this. I'm looking forward to using the workflow.

@zeitlings zeitlings added the good first issue Good for newcomers label Nov 16, 2024
@zeitlings
Copy link
Owner

Thanks for elaborating on your solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants