rules: add checks for empty process name and class
This commit is contained in:
parent
85a86ec3c5
commit
50392da360
|
@ -5,7 +5,10 @@ layout: page
|
||||||
|
|
||||||
Rule processing is an experimental feature. Significant changes might be made in response to problems.
|
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
|
Logitech devices that use HID++ version 2.0 or greater produce feature-based
|
||||||
notifications that Solaar can process using a simple rule language. For
|
notifications that Solaar can process using a simple rule language. For
|
||||||
|
|
|
@ -340,7 +340,8 @@ class Process(Condition):
|
||||||
def evaluate(self, feature, notification, device, status, last_result):
|
def evaluate(self, feature, notification, device, status, last_result):
|
||||||
if not isinstance(self.process, str):
|
if not isinstance(self.process, str):
|
||||||
return False
|
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):
|
def data(self):
|
||||||
return {'Process': str(self.process)}
|
return {'Process': str(self.process)}
|
||||||
|
|
Loading…
Reference in New Issue