From 50392da36045204013dde4d95eab8b0169a088f7 Mon Sep 17 00:00:00 2001 From: "Peter F. Patel-Schneider" Date: Wed, 14 Jul 2021 17:07:46 -0400 Subject: [PATCH] rules: add checks for empty process name and class --- docs/rules.md | 5 ++++- lib/logitech_receiver/diversion.py | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/rules.md b/docs/rules.md index ba8228a3..e3149bc6 100644 --- a/docs/rules.md +++ b/docs/rules.md @@ -5,7 +5,10 @@ layout: page Rule processing is an experimental feature. Significant changes might be made in response to problems. -Note that rule processing is only available when running under X11. +Note that rule processing only fully works under X11. +When running under Wayland with X11 libraries loaded most features will not be available and errors may result. +Features known not to work under Wayland include process conditions and +anything to do with simulating keyboard or mouse input. Logitech devices that use HID++ version 2.0 or greater produce feature-based notifications that Solaar can process using a simple rule language. For diff --git a/lib/logitech_receiver/diversion.py b/lib/logitech_receiver/diversion.py index 5097abb7..44992339 100644 --- a/lib/logitech_receiver/diversion.py +++ b/lib/logitech_receiver/diversion.py @@ -340,7 +340,8 @@ class Process(Condition): def evaluate(self, feature, notification, device, status, last_result): if not isinstance(self.process, str): return False - return active_process_name.startswith(self.process) or active_wm_class_name.startswith(self.process) + return bool(active_process_name and active_process_name.startswith(self.process)) or \ + bool(active_wm_class_name and active_wm_class_name.startswith(self.process)) def data(self): return {'Process': str(self.process)}