We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
do_not_disturb: mako doesn't work anymore (changed commands for dnd)
I use mako as my notification daemon and want to use the do_not_disturb module, which does not work.

py3status calls `makoctl set invisble={}`, however current version of mako uses
`makoctl set-mode do-not-disturb` to set DND mode and
`makoctl set-mode default` to unset DND mode.

**Your py3status version**
py3status version 3.39 (python 3.10.0) on i3 (it's sway, actually.)

**To Reproduce**
1. Add module do_not_disturb
2. Set `server` to `mako`
3. Switch to DND mode
4. Send a notification

**Expected behavior**
Notification shouldn't be shown

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `py3status/modules/do_not_disturb.py`
Content:
```
1 r"""
2 Turn on and off desktop notifications.
3 
4 Configuration parameters:
5     cache_timeout: refresh interval for this module; for xfce4-notifyd
6         (default 30)
7     format: display format for this module
8         (default '{name} [\?color=state&show DND]')
9     pause: specify whether to pause or kill processes; for dunst
10         see `Dunst Miscellaneous` section for more information
11         (default True)
12     server: specify server to use, eg mako, dunst or xfce4-notifyd, otherwise auto
13         (default None)
14     state: specify state to use on startup, otherwise last
15         False: disable Do Not Disturb on startup
16         True: enable Do Not Disturb on startup
17         last: toggle last known state on startup
18         None: query current state from notification manager (doesn't work on dunst<1.5.0)
19         (default 'last')
20     thresholds: specify color thresholds to use
21         (default [(0, 'bad'), (1, 'good')])
22 
23 Format placeholders:
24     {name} name, eg Mako, Dunst, Xfce4-notifyd
25     {state} do not disturb state, eg 0, 1
26 
27 Color thresholds:
28     xxx: print a color based on the value of `xxx` placeholder
29 
30 Dunst Miscellaneous:
31     When paused, dunst will not display any notifications but keep all
32     notifications in a queue. This can for example be wrapped around a screen
33     locker (i3lock, slock) to prevent flickering of notifications through the
34     lock and to read all missed notifications after returning to the computer.
35     This means that by default (pause = False), all notifications sent while
36     DND is active will NOT be queued and displayed when DND is deactivated.
37 
38 
39 Examples:
40 ```
41 # display ON/OFF
42 do_not_disturb {
43     format = '{name} [\?color=state [\?if=state  ON|OFF]]'
44 }
45 
46 # display 1/0
47 do_not_disturb {
48     format = '{name} [\?color=state {state}]'
49 }
50 
51 # display DO NOT DISTURB/DISTURB
52 do_not_disturb {
53     format = '[\?color=state [\?if=state DO NOT DISTURB|DISTURB]]'
54     thresholds = [(0, "darkgray"), (1, "good")]
55 }
56 ```
57 
58 @author Maxim Baz https://github.com/maximbaz (dunst)
59 @author Robert Ricci https://github.com/ricci (xfce4-notifyd)
60 @author Cyrinux https://github.com/cyrinux (mako)
61 @license BSD
62 
63 SAMPLE OUTPUT
64 [{'full_text': 'Dunst '}, {'color': '#00FF00', 'full_text': 'DND'}]
65 
66 off
67 [{'full_text': 'Dunst '}, {'color': '#FF0000', 'full_text': 'DND'}]
68 """
69 
70 STRING_NOT_INSTALLED = "server `{}` not installed"
71 STRING_INVALID_SERVER = "invalid server `{}`"
72 STRING_INVALID_STATE = "invalid state `{}`"
73 
74 
75 class Notification:
76     def __init__(self, parent):
77         self.parent = parent
78         self.setup(parent)
79 
80     def setup(self, parent):
81         pass
82 
83     def get_state(self):
84         return self.parent.state
85 
86 
87 class Dunst(Notification):
88     """
89     Dunst Notification.
90     """
91 
92     def setup(self, parent):
93         self.has_dunstctl = bool(self.parent.py3.check_commands(["dunstctl"]))
94 
95     def get_state(self):
96         if self.has_dunstctl:
97             state = self.parent.py3.command_output("dunstctl is-paused")
98             return state.strip() == "true"
99         else:
100             return self.parent.state
101 
102     def toggle(self, state):
103         if self.has_dunstctl:
104             self.parent.py3.command_run(
105                 "dunstctl set-paused {}".format(str(state).lower())
106             )
107         elif state:
108             # pause
109             self.parent.py3.command_run("pkill -SIGUSR1 dunst")
110         else:
111             if self.parent.pause:
112                 # resume
113                 self.parent.py3.command_run("pkill -SIGUSR2 dunst")
114             else:
115                 # delete all pending notifications and resume
116                 self.parent.py3.command_run("pkill -SIGTERM dunst")
117 
118 
119 class Mako(Notification):
120     """
121     Mako Notification.
122     """
123 
124     def toggle(self, state):
125         self.parent.py3.command_run("makoctl set invisible={}".format(int(state)))
126 
127 
128 class Xfce4_notifyd(Notification):
129     """
130     XFCE4 Notification.
131     """
132 
133     def setup(self, parent):
134         from dbus import Interface, SessionBus
135 
136         self.iface = Interface(
137             SessionBus().get_object("org.xfce.Xfconf", "/org/xfce/Xfconf"),
138             "org.xfce.Xfconf",
139         )
140 
141     def get_state(self):
142         return self.iface.GetProperty("xfce4-notifyd", "/do-not-disturb")
143 
144     def toggle(self, state):
145         self.iface.SetProperty("xfce4-notifyd", "/do-not-disturb", state)
146 
147 
148 class Py3status:
149     """
150     """
151 
152     # available configuration parameters
153     cache_timeout = 30
154     format = r"{name} [\?color=state&show DND]"
155     pause = True
156     server = None
157     state = "last"
158     thresholds = [(0, "bad"), (1, "good")]
159 
160     def post_config_hook(self):
161         servers = ["dunst", "mako", "xfce4-notifyd", None]
162         if not self.server:
163             for server in servers:
164                 if server:
165                     try:
166                         if self.py3.command_output(["pgrep", "-x", server]):
167                             self.server = server
168                             break
169                     except self.py3.CommandError:
170                         pass
171             else:
172                 self.server = self.py3.check_commands(servers[:-1]) or "dunst"
173         elif self.server not in servers:
174             raise Exception(STRING_INVALID_SERVER.format(self.server))
175         else:
176             command = self.server.replace("notifyd", "notifyd-config")
177             if not self.py3.check_commands(command):
178                 raise Exception(STRING_NOT_INSTALLED.format(command))
179 
180         if self.server == "dunst":
181             self.backend = Dunst(self)
182         elif self.server == "mako":
183             self.backend = Mako(self)
184         elif self.server == "xfce4-notifyd":
185             self.backend = Xfce4_notifyd(self)
186 
187         if self.state is not None:
188             if self.state == "last":
189                 self.state = self.py3.storage_get("state") or 0
190             if self.state in [False, True]:
191                 self.backend.toggle(self.state)
192             else:
193                 raise Exception(STRING_INVALID_STATE.format(self.state))
194         elif self.server == "dunst" and not self.backend.has_dunstctl:
195             raise Exception(STRING_INVALID_STATE.format(self.state))
196 
197         self.name = self.server.capitalize()
198         self.thresholds_init = self.py3.get_color_names_list(self.format)
199 
200     def do_not_disturb(self):
201         self.state = self.backend.get_state()
202         dnd_data = {"state": int(self.state), "name": self.name}
203 
204         for x in self.thresholds_init:
205             if x in dnd_data:
206                 self.py3.threshold_get_color(dnd_data[x], x)
207 
208         return {
209             "cached_until": self.py3.time_in(self.cache_timeout),
210             "full_text": self.py3.safe_format(self.format, dnd_data),
211         }
212 
213     def on_click(self, event):
214         self.state = not self.state
215         self.py3.storage_set("state", self.state)
216         self.backend.toggle(self.state)
217 
218 
219 if __name__ == "__main__":
220     """
221     Run module in test mode.
222     """
223     from py3status.module_test import module_test
224 
225     module_test(Py3status)
226
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/py3status/modules/do_not_disturb.py b/py3status/modules/do_not_disturb.py
--- a/py3status/modules/do_not_disturb.py
+++ b/py3status/modules/do_not_disturb.py
@@ -35,6 +35,14 @@
     This means that by default (pause = False), all notifications sent while
     DND is active will NOT be queued and displayed when DND is deactivated.
 
+Mako Miscellaneous:
+    Mako requires that you manually create a 'do-not-disturb' mode as shown
+    in https://man.voidlinux.org/mako.5#MODES.
+    This module expects this mode to be configured by the user as suggested by
+    the mako documentation:
+    [mode=do-not-disturb]
+    invisible=1
+
 
 Examples:
 ```
@@ -121,8 +129,14 @@
     Mako Notification.
     """
 
+    def setup(self, parent):
+        self.toggle(parent.state)
+
     def toggle(self, state):
-        self.parent.py3.command_run("makoctl set invisible={}".format(int(state)))
+        if state is True:
+            self.parent.py3.command_run("makoctl set-mode do-not-disturb")
+        else:
+            self.parent.py3.command_run("makoctl set-mode default")
 
 
 class Xfce4_notifyd(Notification):

{"golden_diff": "diff --git a/py3status/modules/do_not_disturb.py b/py3status/modules/do_not_disturb.py\n--- a/py3status/modules/do_not_disturb.py\n+++ b/py3status/modules/do_not_disturb.py\n@@ -35,6 +35,14 @@\n     This means that by default (pause = False), all notifications sent while\n     DND is active will NOT be queued and displayed when DND is deactivated.\n \n+Mako Miscellaneous:\n+    Mako requires that you manually create a 'do-not-disturb' mode as shown\n+    in https://man.voidlinux.org/mako.5#MODES.\n+    This module expects this mode to be configured by the user as suggested by\n+    the mako documentation:\n+    [mode=do-not-disturb]\n+    invisible=1\n+\n \n Examples:\n ```\n@@ -121,8 +129,14 @@\n     Mako Notification.\n     \"\"\"\n \n+    def setup(self, parent):\n+        self.toggle(parent.state)\n+\n     def toggle(self, state):\n-        self.parent.py3.command_run(\"makoctl set invisible={}\".format(int(state)))\n+        if state is True:\n+            self.parent.py3.command_run(\"makoctl set-mode do-not-disturb\")\n+        else:\n+            self.parent.py3.command_run(\"makoctl set-mode default\")\n \n \n class Xfce4_notifyd(Notification):\n", "issue": "do_not_disturb: mako doesn't work anymore (changed commands for dnd)\nI use mako as my notification daemon and want to use the do_not_disturb module, which does not work.\r\n\r\npy3status calls `makoctl set invisble={}`, however current version of mako uses\r\n`makoctl set-mode do-not-disturb` to set DND mode and\r\n`makoctl set-mode default` to unset DND mode.\r\n\r\n**Your py3status version**\r\npy3status version 3.39 (python 3.10.0) on i3 (it's sway, actually.)\r\n\r\n**To Reproduce**\r\n1. Add module do_not_disturb\r\n2. Set `server` to `mako`\r\n3. Switch to DND mode\r\n4. Send a notification\r\n\r\n**Expected behavior**\r\nNotification shouldn't be shown\n", "before_files": [{"content": "r\"\"\"\nTurn on and off desktop notifications.\n\nConfiguration parameters:\n    cache_timeout: refresh interval for this module; for xfce4-notifyd\n        (default 30)\n    format: display format for this module\n        (default '{name} [\\?color=state&show DND]')\n    pause: specify whether to pause or kill processes; for dunst\n        see `Dunst Miscellaneous` section for more information\n        (default True)\n    server: specify server to use, eg mako, dunst or xfce4-notifyd, otherwise auto\n        (default None)\n    state: specify state to use on startup, otherwise last\n        False: disable Do Not Disturb on startup\n        True: enable Do Not Disturb on startup\n        last: toggle last known state on startup\n        None: query current state from notification manager (doesn't work on dunst<1.5.0)\n        (default 'last')\n    thresholds: specify color thresholds to use\n        (default [(0, 'bad'), (1, 'good')])\n\nFormat placeholders:\n    {name} name, eg Mako, Dunst, Xfce4-notifyd\n    {state} do not disturb state, eg 0, 1\n\nColor thresholds:\n    xxx: print a color based on the value of `xxx` placeholder\n\nDunst Miscellaneous:\n    When paused, dunst will not display any notifications but keep all\n    notifications in a queue. This can for example be wrapped around a screen\n    locker (i3lock, slock) to prevent flickering of notifications through the\n    lock and to read all missed notifications after returning to the computer.\n    This means that by default (pause = False), all notifications sent while\n    DND is active will NOT be queued and displayed when DND is deactivated.\n\n\nExamples:\n```\n# display ON/OFF\ndo_not_disturb {\n    format = '{name} [\\?color=state [\\?if=state  ON|OFF]]'\n}\n\n# display 1/0\ndo_not_disturb {\n    format = '{name} [\\?color=state {state}]'\n}\n\n# display DO NOT DISTURB/DISTURB\ndo_not_disturb {\n    format = '[\\?color=state [\\?if=state DO NOT DISTURB|DISTURB]]'\n    thresholds = [(0, \"darkgray\"), (1, \"good\")]\n}\n```\n\n@author Maxim Baz https://github.com/maximbaz (dunst)\n@author Robert Ricci https://github.com/ricci (xfce4-notifyd)\n@author Cyrinux https://github.com/cyrinux (mako)\n@license BSD\n\nSAMPLE OUTPUT\n[{'full_text': 'Dunst '}, {'color': '#00FF00', 'full_text': 'DND'}]\n\noff\n[{'full_text': 'Dunst '}, {'color': '#FF0000', 'full_text': 'DND'}]\n\"\"\"\n\nSTRING_NOT_INSTALLED = \"server `{}` not installed\"\nSTRING_INVALID_SERVER = \"invalid server `{}`\"\nSTRING_INVALID_STATE = \"invalid state `{}`\"\n\n\nclass Notification:\n    def __init__(self, parent):\n        self.parent = parent\n        self.setup(parent)\n\n    def setup(self, parent):\n        pass\n\n    def get_state(self):\n        return self.parent.state\n\n\nclass Dunst(Notification):\n    \"\"\"\n    Dunst Notification.\n    \"\"\"\n\n    def setup(self, parent):\n        self.has_dunstctl = bool(self.parent.py3.check_commands([\"dunstctl\"]))\n\n    def get_state(self):\n        if self.has_dunstctl:\n            state = self.parent.py3.command_output(\"dunstctl is-paused\")\n            return state.strip() == \"true\"\n        else:\n            return self.parent.state\n\n    def toggle(self, state):\n        if self.has_dunstctl:\n            self.parent.py3.command_run(\n                \"dunstctl set-paused {}\".format(str(state).lower())\n            )\n        elif state:\n            # pause\n            self.parent.py3.command_run(\"pkill -SIGUSR1 dunst\")\n        else:\n            if self.parent.pause:\n                # resume\n                self.parent.py3.command_run(\"pkill -SIGUSR2 dunst\")\n            else:\n                # delete all pending notifications and resume\n                self.parent.py3.command_run(\"pkill -SIGTERM dunst\")\n\n\nclass Mako(Notification):\n    \"\"\"\n    Mako Notification.\n    \"\"\"\n\n    def toggle(self, state):\n        self.parent.py3.command_run(\"makoctl set invisible={}\".format(int(state)))\n\n\nclass Xfce4_notifyd(Notification):\n    \"\"\"\n    XFCE4 Notification.\n    \"\"\"\n\n    def setup(self, parent):\n        from dbus import Interface, SessionBus\n\n        self.iface = Interface(\n            SessionBus().get_object(\"org.xfce.Xfconf\", \"/org/xfce/Xfconf\"),\n            \"org.xfce.Xfconf\",\n        )\n\n    def get_state(self):\n        return self.iface.GetProperty(\"xfce4-notifyd\", \"/do-not-disturb\")\n\n    def toggle(self, state):\n        self.iface.SetProperty(\"xfce4-notifyd\", \"/do-not-disturb\", state)\n\n\nclass Py3status:\n    \"\"\"\n    \"\"\"\n\n    # available configuration parameters\n    cache_timeout = 30\n    format = r\"{name} [\\?color=state&show DND]\"\n    pause = True\n    server = None\n    state = \"last\"\n    thresholds = [(0, \"bad\"), (1, \"good\")]\n\n    def post_config_hook(self):\n        servers = [\"dunst\", \"mako\", \"xfce4-notifyd\", None]\n        if not self.server:\n            for server in servers:\n                if server:\n                    try:\n                        if self.py3.command_output([\"pgrep\", \"-x\", server]):\n                            self.server = server\n                            break\n                    except self.py3.CommandError:\n                        pass\n            else:\n                self.server = self.py3.check_commands(servers[:-1]) or \"dunst\"\n        elif self.server not in servers:\n            raise Exception(STRING_INVALID_SERVER.format(self.server))\n        else:\n            command = self.server.replace(\"notifyd\", \"notifyd-config\")\n            if not self.py3.check_commands(command):\n                raise Exception(STRING_NOT_INSTALLED.format(command))\n\n        if self.server == \"dunst\":\n            self.backend = Dunst(self)\n        elif self.server == \"mako\":\n            self.backend = Mako(self)\n        elif self.server == \"xfce4-notifyd\":\n            self.backend = Xfce4_notifyd(self)\n\n        if self.state is not None:\n            if self.state == \"last\":\n                self.state = self.py3.storage_get(\"state\") or 0\n            if self.state in [False, True]:\n                self.backend.toggle(self.state)\n            else:\n                raise Exception(STRING_INVALID_STATE.format(self.state))\n        elif self.server == \"dunst\" and not self.backend.has_dunstctl:\n            raise Exception(STRING_INVALID_STATE.format(self.state))\n\n        self.name = self.server.capitalize()\n        self.thresholds_init = self.py3.get_color_names_list(self.format)\n\n    def do_not_disturb(self):\n        self.state = self.backend.get_state()\n        dnd_data = {\"state\": int(self.state), \"name\": self.name}\n\n        for x in self.thresholds_init:\n            if x in dnd_data:\n                self.py3.threshold_get_color(dnd_data[x], x)\n\n        return {\n            \"cached_until\": self.py3.time_in(self.cache_timeout),\n            \"full_text\": self.py3.safe_format(self.format, dnd_data),\n        }\n\n    def on_click(self, event):\n        self.state = not self.state\n        self.py3.storage_set(\"state\", self.state)\n        self.backend.toggle(self.state)\n\n\nif __name__ == \"__main__\":\n    \"\"\"\n    Run module in test mode.\n    \"\"\"\n    from py3status.module_test import module_test\n\n    module_test(Py3status)\n", "path": "py3status/modules/do_not_disturb.py"}], "after_files": [{"content": "r\"\"\"\nTurn on and off desktop notifications.\n\nConfiguration parameters:\n    cache_timeout: refresh interval for this module; for xfce4-notifyd\n        (default 30)\n    format: display format for this module\n        (default '{name} [\\?color=state&show DND]')\n    pause: specify whether to pause or kill processes; for dunst\n        see `Dunst Miscellaneous` section for more information\n        (default True)\n    server: specify server to use, eg mako, dunst or xfce4-notifyd, otherwise auto\n        (default None)\n    state: specify state to use on startup, otherwise last\n        False: disable Do Not Disturb on startup\n        True: enable Do Not Disturb on startup\n        last: toggle last known state on startup\n        None: query current state from notification manager (doesn't work on dunst<1.5.0)\n        (default 'last')\n    thresholds: specify color thresholds to use\n        (default [(0, 'bad'), (1, 'good')])\n\nFormat placeholders:\n    {name} name, eg Mako, Dunst, Xfce4-notifyd\n    {state} do not disturb state, eg 0, 1\n\nColor thresholds:\n    xxx: print a color based on the value of `xxx` placeholder\n\nDunst Miscellaneous:\n    When paused, dunst will not display any notifications but keep all\n    notifications in a queue. This can for example be wrapped around a screen\n    locker (i3lock, slock) to prevent flickering of notifications through the\n    lock and to read all missed notifications after returning to the computer.\n    This means that by default (pause = False), all notifications sent while\n    DND is active will NOT be queued and displayed when DND is deactivated.\n\nMako Miscellaneous:\n    Mako requires that you manually create a 'do-not-disturb' mode as shown\n    in https://man.voidlinux.org/mako.5#MODES.\n    This module expects this mode to be configured by the user as suggested by\n    the mako documentation:\n    [mode=do-not-disturb]\n    invisible=1\n\n\nExamples:\n```\n# display ON/OFF\ndo_not_disturb {\n    format = '{name} [\\?color=state [\\?if=state  ON|OFF]]'\n}\n\n# display 1/0\ndo_not_disturb {\n    format = '{name} [\\?color=state {state}]'\n}\n\n# display DO NOT DISTURB/DISTURB\ndo_not_disturb {\n    format = '[\\?color=state [\\?if=state DO NOT DISTURB|DISTURB]]'\n    thresholds = [(0, \"darkgray\"), (1, \"good\")]\n}\n```\n\n@author Maxim Baz https://github.com/maximbaz (dunst)\n@author Robert Ricci https://github.com/ricci (xfce4-notifyd)\n@author Cyrinux https://github.com/cyrinux (mako)\n@license BSD\n\nSAMPLE OUTPUT\n[{'full_text': 'Dunst '}, {'color': '#00FF00', 'full_text': 'DND'}]\n\noff\n[{'full_text': 'Dunst '}, {'color': '#FF0000', 'full_text': 'DND'}]\n\"\"\"\n\nSTRING_NOT_INSTALLED = \"server `{}` not installed\"\nSTRING_INVALID_SERVER = \"invalid server `{}`\"\nSTRING_INVALID_STATE = \"invalid state `{}`\"\n\n\nclass Notification:\n    def __init__(self, parent):\n        self.parent = parent\n        self.setup(parent)\n\n    def setup(self, parent):\n        pass\n\n    def get_state(self):\n        return self.parent.state\n\n\nclass Dunst(Notification):\n    \"\"\"\n    Dunst Notification.\n    \"\"\"\n\n    def setup(self, parent):\n        self.has_dunstctl = bool(self.parent.py3.check_commands([\"dunstctl\"]))\n\n    def get_state(self):\n        if self.has_dunstctl:\n            state = self.parent.py3.command_output(\"dunstctl is-paused\")\n            return state.strip() == \"true\"\n        else:\n            return self.parent.state\n\n    def toggle(self, state):\n        if self.has_dunstctl:\n            self.parent.py3.command_run(\n                \"dunstctl set-paused {}\".format(str(state).lower())\n            )\n        elif state:\n            # pause\n            self.parent.py3.command_run(\"pkill -SIGUSR1 dunst\")\n        else:\n            if self.parent.pause:\n                # resume\n                self.parent.py3.command_run(\"pkill -SIGUSR2 dunst\")\n            else:\n                # delete all pending notifications and resume\n                self.parent.py3.command_run(\"pkill -SIGTERM dunst\")\n\n\nclass Mako(Notification):\n    \"\"\"\n    Mako Notification.\n    \"\"\"\n\n    def setup(self, parent):\n        self.toggle(parent.state)\n\n    def toggle(self, state):\n        if state is True:\n            self.parent.py3.command_run(\"makoctl set-mode do-not-disturb\")\n        else:\n            self.parent.py3.command_run(\"makoctl set-mode default\")\n\n\nclass Xfce4_notifyd(Notification):\n    \"\"\"\n    XFCE4 Notification.\n    \"\"\"\n\n    def setup(self, parent):\n        from dbus import Interface, SessionBus\n\n        self.iface = Interface(\n            SessionBus().get_object(\"org.xfce.Xfconf\", \"/org/xfce/Xfconf\"),\n            \"org.xfce.Xfconf\",\n        )\n\n    def get_state(self):\n        return self.iface.GetProperty(\"xfce4-notifyd\", \"/do-not-disturb\")\n\n    def toggle(self, state):\n        self.iface.SetProperty(\"xfce4-notifyd\", \"/do-not-disturb\", state)\n\n\nclass Py3status:\n    \"\"\"\n    \"\"\"\n\n    # available configuration parameters\n    cache_timeout = 30\n    format = r\"{name} [\\?color=state&show DND]\"\n    pause = True\n    server = None\n    state = \"last\"\n    thresholds = [(0, \"bad\"), (1, \"good\")]\n\n    def post_config_hook(self):\n        servers = [\"dunst\", \"mako\", \"xfce4-notifyd\", None]\n        if not self.server:\n            for server in servers:\n                if server:\n                    try:\n                        if self.py3.command_output([\"pgrep\", \"-x\", server]):\n                            self.server = server\n                            break\n                    except self.py3.CommandError:\n                        pass\n            else:\n                self.server = self.py3.check_commands(servers[:-1]) or \"dunst\"\n        elif self.server not in servers:\n            raise Exception(STRING_INVALID_SERVER.format(self.server))\n        else:\n            command = self.server.replace(\"notifyd\", \"notifyd-config\")\n            if not self.py3.check_commands(command):\n                raise Exception(STRING_NOT_INSTALLED.format(command))\n\n        if self.server == \"dunst\":\n            self.backend = Dunst(self)\n        elif self.server == \"mako\":\n            self.backend = Mako(self)\n        elif self.server == \"xfce4-notifyd\":\n            self.backend = Xfce4_notifyd(self)\n\n        if self.state is not None:\n            if self.state == \"last\":\n                self.state = self.py3.storage_get(\"state\") or 0\n            if self.state in [False, True]:\n                self.backend.toggle(self.state)\n            else:\n                raise Exception(STRING_INVALID_STATE.format(self.state))\n        elif self.server == \"dunst\" and not self.backend.has_dunstctl:\n            raise Exception(STRING_INVALID_STATE.format(self.state))\n\n        self.name = self.server.capitalize()\n        self.thresholds_init = self.py3.get_color_names_list(self.format)\n\n    def do_not_disturb(self):\n        self.state = self.backend.get_state()\n        dnd_data = {\"state\": int(self.state), \"name\": self.name}\n\n        for x in self.thresholds_init:\n            if x in dnd_data:\n                self.py3.threshold_get_color(dnd_data[x], x)\n\n        return {\n            \"cached_until\": self.py3.time_in(self.cache_timeout),\n            \"full_text\": self.py3.safe_format(self.format, dnd_data),\n        }\n\n    def on_click(self, event):\n        self.state = not self.state\n        self.py3.storage_set(\"state\", self.state)\n        self.backend.toggle(self.state)\n\n\nif __name__ == \"__main__\":\n    \"\"\"\n    Run module in test mode.\n    \"\"\"\n    from py3status.module_test import module_test\n\n    module_test(Py3status)\n", "path": "py3status/modules/do_not_disturb.py"}]}