From 4da74adf6c98ca963f6955fbbae5d246b8274c87 Mon Sep 17 00:00:00 2001 From: Felix Kratz Date: Sun, 21 Aug 2022 11:48:04 +0200 Subject: [PATCH] add screen recording permission error message (#237) --- src/alias.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/alias.c b/src/alias.c index 369ffab..6198bdd 100644 --- a/src/alias.c +++ b/src/alias.c @@ -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 );