rules: add checks for empty process name and class

This commit is contained in:
Peter F. Patel-Schneider 2021-07-14 17:07:46 -04:00
parent 85a86ec3c5
commit 50392da360
2 changed files with 6 additions and 2 deletions

View File

@ -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

View File

@ -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)}