From 6ce5b940a01b652fe4007e7197fd1704bd708d8a Mon Sep 17 00:00:00 2001 From: Maxim Baz Date: Mon, 20 Aug 2018 14:52:42 +0200 Subject: [PATCH] Allow disabling notification via format_notifications --- py3status/modules/external_script.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/py3status/modules/external_script.py b/py3status/modules/external_script.py index c34b2dccc2..0e91c04a13 100644 --- a/py3status/modules/external_script.py +++ b/py3status/modules/external_script.py @@ -14,6 +14,7 @@ cache_timeout: how often we refresh this module in seconds (default 15) format: see placeholders below (default '{output}') + format_notification: see placeholders below (default '{output}') localize: should script output be localized (if available) (default True) script_path: script you want to show output of (compulsory) @@ -23,7 +24,10 @@ Format placeholders: {line} number of lines in the output - {output} output of script given by "script_path" + {output} first line of the output of script given by "script_path" + +Format notification placeholders: + {output} full output of script given by "script_path" i3status.conf example: @@ -92,7 +96,10 @@ def external_script(self): def on_click(self, event): button = event["button"] if button != self.button_refresh: - self.py3.notify_user(self.output) + if self.format_notification: + self.py3.notify_user(self.py3.safe_format( + self.format_notification, {'output': self.output}) + ) self.py3.prevent_refresh() if __name__ == "__main__":