diff --git a/powerline/bindings/bar/powerline-bar.py b/powerline/bindings/bar/powerline-bar.py index a9b680f3..35496f6f 100755 --- a/powerline/bindings/bar/powerline-bar.py +++ b/powerline/bindings/bar/powerline-bar.py @@ -9,7 +9,6 @@ from threading import Lock, Timer from argparse import ArgumentParser from powerline import Powerline -from powerline.lib.monotonic import monotonic from powerline.lib.encoding import get_unicode_writer @@ -29,12 +28,12 @@ if __name__ == '__main__': args = parser.parse_args() powerline = BarPowerline() lock = Lock() - modes = ["default"] + modes = ['default'] write = get_unicode_writer(encoding='utf-8') def render(reschedule=False): if reschedule: - Timer(0.5, render, kwargs={"reschedule": True}).start() + Timer(0.5, render, kwargs={'reschedule': True}).start() global lock with lock: diff --git a/powerline/segments/i3wm.py b/powerline/segments/i3wm.py index b6c847f9..de601d78 100644 --- a/powerline/segments/i3wm.py +++ b/powerline/segments/i3wm.py @@ -1,10 +1,7 @@ # vim:fileencoding=utf-8:noet from __future__ import (unicode_literals, division, absolute_import, print_function) -from threading import Thread - from powerline.theme import requires_segment_info -from powerline.segments import Segment, with_docstring conn = None @@ -30,27 +27,28 @@ def workspaces(pl, only_show=None, strip=0): '''Return list of used workspaces :param list only_show: - Specifies which workspaces to show. - Valid entries are "visible", "urgent" and "focused". - If omitted or ``null`` all workspaces are shown. + Specifies which workspaces to show. Valid entries are ``"visible"``, + ``"urgent"`` and ``"focused"``. If omitted or ``null`` all workspaces + are shown. :param int strip: - Specifies how many characters from the front of each workspace name should - be stripped (e.g. to remove workspace numbers). Defaults to zero. + Specifies how many characters from the front of each workspace name + should be stripped (e.g. to remove workspace numbers). Defaults to zero. - Highlight groups used: ``workspace``, ``w_visible``, ``w_focused``, ``w_urgent`` + Highlight groups used: ``workspace`` or ``w_visible``, ``workspace`` or ``w_focused``, ``workspace`` or ``w_urgent``. ''' global conn - if not conn: conn = i3ipc.Connection() + if not conn: + conn = i3ipc.Connection() return [{ - 'contents': w['name'][min(len(w['name']),strip):], + 'contents': w['name'][min(len(w['name']), strip):], 'highlight_groups': calcgrp(w) - } for w in conn.get_workspaces() if not only_show or any(w[typ] for typ in only_show)] + } for w in conn.get_workspaces() if not only_show or any((w[typ] for typ in only_show))] @requires_segment_info -def mode(pl, segment_info, names={"default": None}): +def mode(pl, segment_info, names={'default': None}): '''Returns current i3 mode :param dict names: