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 # i3bar
bar { bar {
status_command i3status | python2 ~/.config/i3status/contrib/wrapper.py status_command i3status | python ~/.config/i3status/contrib/wrapper.py
position top position top
workspace_buttons yes 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` And finally adjust the settings in `~/.config/i3status/contrib/wrapper.py`
as you like. as you like.
## Modules
### thunderbirdnewmail
Requires
* python-dbus
* python-gobject2
## Contribute ## Contribute
To contribute a script, make sure it has a function `output()` that outputs To contribute a script, make sure it has a function `output()` that outputs
@ -40,3 +49,4 @@ 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 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: try:
self.connection.select() self.connection.select()
except Exception,e: except Exception as e:
self.connection = None self.connection = None
return self.connection return self.connection

View File

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

View File

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