Skip to content

Commit

Permalink
fix #3
Browse files Browse the repository at this point in the history
  • Loading branch information
PH111P committed Mar 31, 2018
1 parent b5eedf3 commit 5473a8d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
16 changes: 13 additions & 3 deletions powerline/segments/i3wm.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def get_next_ws(ws, outputs):
return []

@requires_segment_info
def workspaces(pl, segment_info, only_show=None, output=None, strip=0, separator=" ", icons=WS_ICONS, show_icons=True, show_multiple_icons=True, show_dummy_workspace=False, show_output=False):
def workspaces(pl, segment_info, only_show=None, output=None, strip=0, separator=" ",
icons=WS_ICONS, show_icons=True, show_multiple_icons=True, show_dummy_workspace=False,
show_output=False, priority_workspaces=[]):
'''Return list of used workspaces
:param list only_show:
Expand Down Expand Up @@ -125,7 +127,11 @@ def workspaces(pl, segment_info, only_show=None, output=None, strip=0, separator
workspace. This workspace will be handled as if it was a non-urgent and non-focused
regular workspace, i.e., click events will work as with normal workspaces.
:param boolean show_output:
Show the name of the output if more than one output is connected and output is not set to ``__all__``.
Show the name of the output if more than one output is connected and output is not
set to ``__all__``.
:param string list priority_workspaces:
A list of workspace names to be sorted before any other workspaces in the given
order.
Highlight groups used: ``workspace`` or ``workspace:visible``, ``workspace`` or ``workspace:focused``, ``workspace`` or ``workspace:urgent`` or ``output``.
Expand All @@ -150,7 +156,11 @@ def sort_ws(ws):
def natural_key(ws):
str = ws['name']
return [int(s) if s.isdigit() else s for s in re.split(r'(\d+)', str)]
return sorted(ws, key=natural_key) + (get_next_ws(ws, output) if show_dummy_workspace else [])
ws = sorted(ws, key=natural_key) + (get_next_ws(ws, output) if show_dummy_workspace else [])
result = []
for n in priority_workspaces:
result += [w for w in ws if w['name'] == n]
return result + [w for w in ws if not w['name'] in priority_workspaces]

if len(output) <= 1:
res = []
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def compile_client():

setup(
name='powerline-status-i3',
version='1.7.1',
version='1.7.2',
description='The ultimate statusline/prompt utility. A fork containing more features for the i3 window manager.',
long_description=README,
classifiers=[
Expand Down

0 comments on commit 5473a8d

Please sign in to comment.