diff options
| author | Ultrabug <ultrabug@gentoo.org> | 2013-08-29 13:02:59 +0200 |
|---|---|---|
| committer | Ultrabug <ultrabug@gentoo.org> | 2013-08-29 13:02:59 +0200 |
| commit | e8c35a25f04316c622739bf527c4c53059b0e28f (patch) | |
| tree | d3e34f5ef5473fc557047a1a0488a4a9b730bacd /examples | |
| parent | b649e7f94ce0a2bc5ee2ac3f3e75714c970b5ed5 (diff) | |
update the empty_class example to explain on_click and kill usage
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/empty_class.py | 36 |
1 files changed, 30 insertions, 6 deletions
diff --git a/examples/empty_class.py b/examples/empty_class.py index db1f9c1..077269c 100755 --- a/examples/empty_class.py +++ b/examples/empty_class.py @@ -2,16 +2,40 @@ class Py3status: """ Empty and basic py3status class. - NOTE: py3status will NOT execute : + NOTE: py3status will NOT execute: - methods starting with '_' - methods decorated by @property and @staticmethod + + NOTE: reserved method names: + - 'kill' method for py3status exit notification + - 'on_click' method for click events from i3bar """ - def empty(self, json, i3status_config): + def kill(self, i3status_output_json, i3status_config): + """ + This method will be called upon py3status exit. + """ + pass + + def on_click(self, i3status_output_json, i3status_config, event): + """ + This method will be called when a click event occurs on this module's + output on the i3bar. + + Example 'event' json object: + {'y': 13, 'x': 1737, 'button': 1, 'name': 'empty', 'instance': 'first'} + """ + pass + + def empty(self, i3status_output_json, i3status_config): """ - This method will return an empty text message, so it will NOT be displayed. - If you want something displayed you should write something in the 'full_text' key of your response. + This method will return an empty text message + so it will NOT be displayed on your i3bar. + + If you want something displayed you should write something + in the 'full_text' key of your response. + See the i3bar protocol spec for more information: - http://i3wm.org/docs/i3bar-protocol.html + http://i3wm.org/docs/i3bar-protocol.html """ - response = {'full_text' : '', 'name' : 'empty'} + response = {'full_text': '', 'name': 'empty', 'instance': 'first'} return (0, response) |
