This commit is contained in:
enkore 2013-02-11 16:03:52 +01:00
parent 944613de3a
commit a5db47fcf8
4 changed files with 24 additions and 14 deletions

View File

@ -24,7 +24,7 @@ Change your i3wm config to the following:
# i3bar
bar {
status_command i3status | python2 ~/.config/i3status/contrib/wrapper.py
status_command i3status | python ~/.config/i3status/contrib/wrapper.py
position top
workspace_buttons yes
}
@ -32,6 +32,15 @@ Change your i3wm config to the following:
And finally adjust the settings in `~/.config/i3status/contrib/wrapper.py`
as you like.
## Modules
### thunderbirdnewmail
Requires
* python-dbus
* python-gobject2
## Contribute
To contribute a script, make sure it has a function `output()` that outputs
@ -39,4 +48,5 @@ valid json code that can be interpreted by i3status. The protocol is documented
here: [i3status Protocol](http://i3wm.org/docs/i3bar-protocol.html).
Please add an example for how to configure it to `wrapper.py.dist`. It should be
a python class that can be registered with the `I3StatusHandler` class.
a python class that can be registered with the `I3StatusHandler` class.

View File

@ -87,7 +87,7 @@ class MailChecker(object):
try:
self.connection.select()
except Exception,e:
except Exception as e:
self.connection = None
return self.connection

View File

@ -3,9 +3,9 @@
import sys
import json
from datetime import datetime,timedelta
import urllib, urllib2
import urllib.request, urllib.parse, urllib.error, urllib.request, urllib.error, urllib.parse
import re
import cookielib
import http.cookiejar
import xml.etree.ElementTree as ET
class ModsDeChecker:
@ -31,11 +31,11 @@ class ModsDeChecker:
def __init__(self, settings = None):
self.settings.update(settings)
self.cj = cookielib.CookieJar()
self.cj = http.cookiejar.CookieJar()
self.last_checked = \
datetime.now() - timedelta(seconds=self.settings['pause'])
self.opener = urllib2.build_opener(
urllib2.HTTPCookieProcessor(self.cj))
self.opener = urllib.request.build_opener(
urllib.request.HTTPCookieProcessor(self.cj))
def get_unread_count(self):
delta = datetime.now() - self.last_checked
@ -54,8 +54,8 @@ class ModsDeChecker:
self.unread_cache = int(root.attrib['newposts'])
except Exception:
self.cj.clear()
self.opener = urllib2.build_opener(
urllib2.HTTPCookieProcessor(self.cj))
self.opener = urllib.request.build_opener(
urllib.request.HTTPCookieProcessor(self.cj))
self.logged_in = False
return self.unread_cache
@ -63,7 +63,7 @@ class ModsDeChecker:
def login(self):
data = urllib.urlencode({
data = urllib.parse.urlencode({
"login_username": self.settings["username"],
"login_password": self.settings["password"],
"login_lifetime": "31536000"

View File

@ -2,7 +2,7 @@
import sys
import json
import urllib2
import urllib.request, urllib.error, urllib.parse
class I3statusHandler:
modules = []
@ -66,7 +66,7 @@ class I3statusHandler:
def has_internet_connection():
try:
response=urllib2.urlopen('http://74.125.113.99',timeout=1)
response=urllib.request.urlopen('http://74.125.113.99',timeout=1)
return True
except urllib2.URLError as err: pass
except urllib.error.URLError as err: pass
return False