diff --git a/i3pystatus/__main__.py.dist b/i3pystatus/__main__.py.dist index bd27f2b..4236755 100755 --- a/i3pystatus/__main__.py.dist +++ b/i3pystatus/__main__.py.dist @@ -1,8 +1,8 @@ #!/usr/bin/env python # -*- coding: utf-8 -*- -from i3pystatus import ( - I3statusHandler, +from . import ( + Status mailchecker, modsde, notmuchmail, @@ -10,25 +10,32 @@ from i3pystatus import ( regex, ) -status = I3statusHandler() - # If you want to start i3status automatically with i3pystatus, # uncomment the following lines #import subprocess #process = subprocess.Popen(["i3status", "-c", "~/.i3/status"], stdout=subprocess.PIPE, universal_newlines=True) -#status.file = process.stdout +#status = Status(input_stream=process.stdout) + +# If you want to run i3pystatus on it's own, +# uncomment the following line +status = Status(standalone=True) + +# If you want to use i3pystatus to extend i3status' output, use this: +status = Status() # Regular expression file watcher # If you're using a thinkpad, chances are that this displays your fan speed and level -regexsettings = { - "regex": "speed:\s+([0-9]+)\nlevel:\s+([a-zA-Z0-9]+)", - "file": "/proc/acpi/ibm/fan", - "format": "{0} [{1}]", -} -status.register(regex.Regex(regexsettings)) +status.register("regex", + regex="speed:\s+([0-9]+)\nlevel:\s+([a-zA-Z0-9]+)", + file="/proc/acpi/ibm/fan", + format="{0} [{1}]") -# The imap checker module -mailsettings = { +# You can let i3pystatus check for new mail using the mail module +# It can check multiple sources with multiple backends + +# The IMAP backend +from .mail.imap import IMAP +imap_servers = { "color": "#ff0000", "servers": [ { @@ -49,37 +56,36 @@ mailsettings = { } ] } -mailchecker = mailchecker.MailChecker(mailsettings) -status.register(mailchecker) +imap = IMAP(imap_servers) + +# Notmuchmail is also supported +from .mail.notmuchmail import Notmuch +notmuch = Notmuch("~/path/to/your/notmuch/db") + +# With thunderbird-dbus-sender, even Thunderbird can report to i3pystatus +from .mail.thunderbird import Thunderbird +tb = Thunderbird() + +status.register("mail", + backends=[ + imap, + notmuch, + tb + ]) # the mods.de forum new bookmarks module -mdesettings = { - "username": "your_username", - "password": "your_password" -} -mde = modsde.ModsDeChecker(mdesettings) -status.register(mde) - -# the notmuch mail checker module -db_path = "path_to_your_notmuch_database" -nm = notmuchmail.NotmuchMailChecker(db_path) -status.register(nm) - - -# the thunderbird dbus new mail checker module -tb = thunderbirdnewmail.ThunderbirdMailChecker() -status.register(tb) +status.register("modsde", + username="your_username", + password="your_password") # the battery status checker module -battery = batterychecker.BatteryChecker() -status.register(battery) +status.register("battery") +# There's a clock, too +status.register("clock") -# the clock -clock = clock.Clock() -status.register(clock) - +# And some more… take a look at the README for all modules and options. # start the handler status.run()