Jump to content

Shellscript `screencapture` command doesn't capture screen, just background


Recommended Posts

I have a workflow:

 

Hotkey Trigger: cmd+shift+1    --->   Run script: /bin/bash

 

The script content is:

 

/usr/sbin/screencapture -i -t jpeg $HOME/.local/tmp/screencapture.out &&\
/usr/bin/osascript -e 'set the clipboard to (read (POSIX file "/Users/johndoe/.local/tmp/screencapture.out") as TIFF picture)'

 

So here's the problem: I trigger the workflow, by pressing `cmd+shift+1`, then I see the `screencapture` thing that allows you to select an area, so then I select my desired area, then a screenshot of that area is taken, then this is what I get:

 

image.thumb.png.6790bf0d6339287b7dfd309c60980bf3.png

 

The desktop background, nothing else. For some reason it doesn't capture the actual top level windows/applications, just the background. Does anyone know why ? and how to fix it ?

 

Many thanks.

Link to comment
Share on other sites

Posted (edited)

Check the granted permissions you gave the Alfred application. You must have the "Screen recording" permission granted for anything related to screen-capturing to work.

 

➤ Preferences

  ➤ Security & Privacy

    ➤ Privacy

      ➤ Screen Recording

 

image.png.85c9e255f51b30c476b30712edaf28bf.png

 

---

*it worked after this*

Edited by akharrou
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...