From 75c988d0ce81823f16cb50a264fa9ca132849a6b Mon Sep 17 00:00:00 2001 From: Yuri Victorovich Date: Tue, 7 May 2024 23:18:57 -0700 Subject: [PATCH] FreeBSD compatibility patch --- normcap/screengrab/permissions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/normcap/screengrab/permissions.py b/normcap/screengrab/permissions.py index 1ce326e2..8e86e84a 100644 --- a/normcap/screengrab/permissions.py +++ b/normcap/screengrab/permissions.py @@ -222,9 +222,9 @@ def has_screenshot_permission() -> bool: logger.debug("Checking screenshot permission") if sys.platform == "darwin": return _macos_has_screenshot_permission() - if sys.platform == "linux" and not system_info.has_wayland_display_manager(): + if (sys.platform == "linux" or sys.platform.startswith("freebsd")) and not system_info.has_wayland_display_manager(): return True - if sys.platform == "linux" and system_info.has_wayland_display_manager(): + if (sys.platform == "linux" or sys.platform.startswith("freebsd")) and system_info.has_wayland_display_manager(): return _dbus_portal_has_screenshot_permission() if sys.platform == "win32": return True @@ -242,14 +242,14 @@ def request_screenshot_permission( ) return - if sys.platform == "linux" and not system_info.has_wayland_display_manager(): + if (sys.platform == "linux" or sys.platform.startswith("freebsd")) and not system_info.has_wayland_display_manager(): logger.debug( "Not necessary to request screenshot permission on Linux, if the " "display manager is not Wayland. Skipping." ) return - if sys.platform == "linux" and system_info.has_wayland_display_manager(): + if (sys.platform == "linux" or sys.platform.startswith("freebsd")) and system_info.has_wayland_display_manager(): logger.debug("Show request permission dialog.") dbus_portal_show_request_permission_dialog( title=dialog_title, text=linux_dialog_text