add screen recording permission error message (#237)

This commit is contained in:
Felix Kratz 2022-08-21 11:48:04 +02:00
parent 4a06653683
commit 4da74adf6c

View file

@ -2,7 +2,15 @@
void print_all_menu_items(FILE* rsp) {
#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000
if (__builtin_available(macOS 11.0, *)) CGRequestScreenCaptureAccess();
if (__builtin_available(macOS 11.0, *)) {
if (!CGRequestScreenCaptureAccess()) {
respond(rsp, "[!] Query (default_menu_items): Screen Recording "
"Permissions not given. Restart SketchyBar after granting "
"permissions.\n");
return;
}
}
#endif
CFArrayRef window_list = CGWindowListCopyWindowInfo(kCGWindowListOptionAll,
kCGNullWindowID );