# -*- coding: utf-8 -*-
"""
A simple "Do Not Disturb" module that can turn on and off all system notifications.

A left mouse click will toggle the state of this module.

Configuration parameters:
    format_off: Display format when the "Do Not Disturb" mode is disabled.
        (default 'OFF')
    format_on: Display format when the "Do Not Disturb" mode is enabled.
        (default 'ON')
    notification_manager: The process name of your notification manager.
        (default 'dunst')
    refresh_interval: Refresh interval to use for killing notification manager process.
        (default 0.25)

Color options:
    color_bad: "Do Not Disturb" mode is enabled.
    color_good: "Do Not Disturb" mode is disabled.
"""

from time import sleep
from os import system
from threading import Thread, Event


class Py3status:
    """
    """

    # available configuration parameters
    format_off = 'OFF'
    format_on = 'ON'
    notification_manager = 'dunst'
    refresh_interval = 0.25

    def __init__(self):
        self.running = Event()
        self.killed = Event()

        class MyThread(Thread):
            def run(this):
                while not self.killed.is_set():
                    if self.running.wait():
                        system("killall '{}'".format(self.notification_manager))
                        sleep(self.refresh_interval)

        MyThread().start()

    def do_not_disturb(self):
        response = {
            'cached_until': self.py3.CACHE_FOREVER,
            'full_text': self.format_on if self.running.is_set() else self.format_off,
            'color': self.py3.COLOR_BAD if self.running.is_set() else self.py3.COLOR_GOOD
        }
        return response

    def on_click(self, event):
        if event['button'] == 1:
            if self.running.is_set():
                self.running.clear()
            else:
                self.running.set()

    def kill(self):
        self.killed.set()
        self.running.set()  # ensure the thread won't hang


if __name__ == "__main__":
    """
    Run module in test mode.
    """
    from py3status.module_test import module_test
    module_test(Py3status)

@@ -200,20 +200,16 @@
   format
-_off
 : Displa
@@ -209,36 +209,35 @@
  Display format 
-when
+for
  the %22Do Not Dis
@@ -245,29 +245,19 @@
 urb%22 mod
-e is disab
+u
 le
-d
 .%0A      
@@ -272,107 +272,15 @@
 lt '
-OFF')%0A    format_on: Display format when the %22Do Not Disturb%22 mode is enabled.%0A        (default 'ON
+%7Bstate%7D
 ')%0A 
@@ -487,16 +487,195 @@
 lt 0.25)
+%0A    state_off: Message when the %22Do Not Disturb%22 mode is disabled.%0A        (default 'OFF')%0A    state_on: Message when the %22Do Not Disturb%22 mode is enabled.%0A        (default 'ON')
 %0A%0AColor 
@@ -960,40 +960,19 @@
 rmat
-_off = 'OFF'%0A    format_on = 'ON
+ = '%7Bstate%7D
 '%0A  
@@ -1031,16 +1031,58 @@
 l = 0.25
+%0A    state_off = 'OFF'%0A    state_on = 'ON'
 %0A%0A    de
@@ -1497,32 +1497,107 @@
 _disturb(self):%0A
+        state = self.state_on if self.running.is_set() else self.state_off%0A
         response
@@ -1687,63 +1687,54 @@
 elf.
-format_on if self.running.is_set() else self.format_off
+py3.safe_format(self.format, %7B'state': state%7D)
 ,%0A  

Use state_* config parameters instead of format_*