lemonbar: update workspaces to newer version of i3ipc.

This commit is contained in:
2019-12-01 10:19:08 +01:00
parent 481b19c5ce
commit 6e86609086
2 changed files with 7 additions and 7 deletions

View File

@@ -270,13 +270,13 @@ class i3Module(LemonModule):
# Find out which output the workspace is on # Find out which output the workspace is on
output = None # TODO actually use this information output = None # TODO actually use this information
for output_ in i3ws.outputs: for output_ in i3ws.outputs:
if output_['name'] == workspace['output']: if output_.name == workspace.output:
output = output_ output = output_
break break
if not output: if not output:
continue continue
status = i3ws.state.get_state(workspace, output) # FOC or INA status = i3ws.state.get_state(workspace, output) # FOC or INA
name = workspace['name'] # e.g. 5 terms name = workspace.name # e.g. 5 terms
current = ''.join([parser.block(click=('i3-msg workspace' + name)) current = ''.join([parser.block(click=('i3-msg workspace' + name))
, name, parser.block(click='')]) , name, parser.block(click='')])
if status == "FOC": if status == "FOC":

View File

@@ -29,12 +29,12 @@ class State(object):
urgent = 'URG' urgent = 'URG'
def get_state(self, workspace, output): def get_state(self, workspace, output):
if workspace['focused']: if workspace.focused:
if output['current_workspace'] == workspace['name']: if output.current_workspace == workspace.name:
return self.focused return self.focused
else: else:
return self.active return self.active
if workspace['urgent']: if workspace.urgent:
return self.urgent return self.urgent
else: else:
return self.inactive return self.inactive
@@ -132,13 +132,13 @@ class i3ws(object):
for workspace in workspaces: for workspace in workspaces:
output = None output = None
for output_ in outputs: for output_ in outputs:
if output_['name'] == workspace['output']: if output_.name == workspace.output:
output = output_ output = output_
break break
if not output: if not output:
continue continue
st = self.state.get_state(workspace, output) st = self.state.get_state(workspace, output)
name = workspace['name'].replace(" ","___") name = workspace.name.replace(" ","___")
item= self.ws_format % (st, name) item= self.ws_format % (st, name)
out += item out += item
return self.end_format % out return self.end_format % out