i3bar has some issues with locale-handling I guess.
It reliably crashes i3pystatus, but only if started by i3bar. Meh. I can't tell if this locale issue is local (ha-ha) or everyone is affected.
This commit is contained in:
parent
ebe3d718e3
commit
dd7b5ef346
@ -109,6 +109,10 @@ class Module(SettingsBase):
|
|||||||
def registered(self, status_handler):
|
def registered(self, status_handler):
|
||||||
"""Called when this module is registered with a status handler"""
|
"""Called when this module is registered with a status handler"""
|
||||||
|
|
||||||
|
def inject(self, json):
|
||||||
|
if self.output:
|
||||||
|
json.insert(self.position, self.output)
|
||||||
|
|
||||||
class AsyncModule(Module):
|
class AsyncModule(Module):
|
||||||
def registered(self, status_handler):
|
def registered(self, status_handler):
|
||||||
self.thread = Thread(target=self.mainloop)
|
self.thread = Thread(target=self.mainloop)
|
||||||
@ -205,7 +209,7 @@ class StandaloneIO(IOHandler):
|
|||||||
|
|
||||||
n = -1
|
n = -1
|
||||||
proto = (
|
proto = (
|
||||||
'{"version": 1}',
|
'{"version":1}',
|
||||||
"[",
|
"[",
|
||||||
"[]",
|
"[]",
|
||||||
",[]",
|
",[]",
|
||||||
@ -298,5 +302,5 @@ class i3pystatus:
|
|||||||
def run(self):
|
def run(self):
|
||||||
for j in JSONIO(self.io).read():
|
for j in JSONIO(self.io).read():
|
||||||
for module in self.modules:
|
for module in self.modules:
|
||||||
j.insert(module.position, module.output)
|
module.inject(j)
|
||||||
I3statusHandler = i3pystatus
|
I3statusHandler = i3pystatus
|
||||||
|
@ -14,10 +14,21 @@ class Clock(IntervalModule):
|
|||||||
format = None
|
format = None
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
lang = os.environ.get('LANG', None)
|
|
||||||
if lang:
|
|
||||||
locale.setlocale(locale.LC_ALL, lang)
|
|
||||||
if self.format is None:
|
if self.format is None:
|
||||||
|
#
|
||||||
|
# WARNING
|
||||||
|
# i3bar does something with the locale, wich probably
|
||||||
|
# crashes i3pystatus when the code block below is run.
|
||||||
|
# I don't know how to debug i3bar (I doubt it has any
|
||||||
|
# debugging facilities).
|
||||||
|
#
|
||||||
|
# If your i3bar stays blank after enabling clock, well,
|
||||||
|
# just set the format string and it should work :-)
|
||||||
|
#
|
||||||
|
|
||||||
|
lang = os.environ.get('LANG', None)
|
||||||
|
if lang:
|
||||||
|
locale.setlocale(locale.LC_ALL, lang)
|
||||||
lang = locale.getlocale()[0]
|
lang = locale.getlocale()[0]
|
||||||
if lang == 'en_US':
|
if lang == 'en_US':
|
||||||
# MDY format - United States of America
|
# MDY format - United States of America
|
||||||
|
Loading…
Reference in New Issue
Block a user