diff --git a/py3status/modules/external_script.py b/py3status/modules/external_script.py index 1f8a3dcf32..b7f2349e8e 100644 --- a/py3status/modules/external_script.py +++ b/py3status/modules/external_script.py @@ -5,6 +5,8 @@ two lines of output will be used. The first line is used as the displayed text. If the output has two or more lines, the second line is set as the text color (and should hence be a valid hex color code such as #FF0000 for red). +If the second line is `urgent`, or has `!` prefixing the hex color, then the +"urgent" flag will be set. The script should not have any parameters, but it could work. Configuration parameters: @@ -76,8 +78,14 @@ def external_script(self): output_lines = self.output.splitlines() if len(output_lines) > 1: output_color = output_lines[1] - if re.search(r"^#[0-9a-fA-F]{6}$", output_color): - response["color"] = output_color + if output_color == "urgent": + response["urgent"] = True + elif re.search(r"^!?#[0-9a-fA-F]{6}$", output_color): + if output_color[0] == "!": + response["urgent"] = True + response["color"] = output_color[1:] + else: + response["color"] = output_color except self.py3.CommandError as e: # something went wrong show error to user output = e.output or e.error