__main__.py.dist

This commit is contained in:
enkore 2013-02-26 01:38:06 +01:00
parent 9510f0b1c0
commit 2aba299677

View File

@ -1,8 +1,8 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from i3pystatus import ( from . import (
I3statusHandler, Status
mailchecker, mailchecker,
modsde, modsde,
notmuchmail, notmuchmail,
@ -10,25 +10,32 @@ from i3pystatus import (
regex, regex,
) )
status = I3statusHandler()
# If you want to start i3status automatically with i3pystatus, # If you want to start i3status automatically with i3pystatus,
# uncomment the following lines # uncomment the following lines
#import subprocess #import subprocess
#process = subprocess.Popen(["i3status", "-c", "~/.i3/status"], stdout=subprocess.PIPE, universal_newlines=True) #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 # Regular expression file watcher
# If you're using a thinkpad, chances are that this displays your fan speed and level # If you're using a thinkpad, chances are that this displays your fan speed and level
regexsettings = { status.register("regex",
"regex": "speed:\s+([0-9]+)\nlevel:\s+([a-zA-Z0-9]+)", regex="speed:\s+([0-9]+)\nlevel:\s+([a-zA-Z0-9]+)",
"file": "/proc/acpi/ibm/fan", file="/proc/acpi/ibm/fan",
"format": "{0} [{1}]", format="{0} [{1}]")
}
status.register(regex.Regex(regexsettings))
# The imap checker module # You can let i3pystatus check for new mail using the mail module
mailsettings = { # It can check multiple sources with multiple backends
# The IMAP backend
from .mail.imap import IMAP
imap_servers = {
"color": "#ff0000", "color": "#ff0000",
"servers": [ "servers": [
{ {
@ -49,37 +56,36 @@ mailsettings = {
} }
] ]
} }
mailchecker = mailchecker.MailChecker(mailsettings) imap = IMAP(imap_servers)
status.register(mailchecker)
# 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 # the mods.de forum new bookmarks module
mdesettings = { status.register("modsde",
"username": "your_username", username="your_username",
"password": "your_password" 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)
# the battery status checker module # the battery status checker module
battery = batterychecker.BatteryChecker() status.register("battery")
status.register(battery)
# There's a clock, too
status.register("clock")
# the clock # And some more… take a look at the README for all modules and options.
clock = clock.Clock()
status.register(clock)
# start the handler # start the handler
status.run() status.run()