lemonbar: Trigger formatting on mode cycle and i3ws events

This commit is contained in:
2020-02-02 21:06:05 +01:00
parent b21211fc2b
commit e6dc178e4d
3 changed files with 20 additions and 3 deletions

View File

@@ -368,7 +368,6 @@ ${exec ~/.i3/lemonbar/get_vol.sh}"""
class i3Module(LemonModule):
# Handles outputs (displays), workspaces and active window
# TODO trigger formatting
def __init__(self, lemonbar_wrapper):
super().__init__(lemonbar_wrapper)
@@ -398,6 +397,9 @@ class i3Module(LemonModule):
self.i3_ws_obj.change_callbacks.append(self.parse_workspaces)
self.i3_ws_obj.focus_callbacks.append(self.parse_title)
# Callback after all other actions should flush the bar
self.i3_ws_obj.final_callback = self.update_bar
# Add callbacks for special actions
self.i3_ws_obj.change_callbacks.append(self.set_bg)
self.i3_ws_obj.focus_callbacks.append(self.set_keymap)
@@ -478,6 +480,11 @@ class i3Module(LemonModule):
, parser.block(fg=config.color_sec_b2, bg='-')
, i3ws.focused_window.name])
def update_bar(self, i3ws):
parsed = parser.format_line() # Construct entire line
self.lemonbar_wrapper.buffer_in.put(parsed)
def format_displays(self):
return self.displays
@@ -536,7 +543,7 @@ class i3Module(LemonModule):
else:
new_km = self.def_keymap
common.logger.debug('Setting default keymap {} for {}'.format(new_km, wclass))
subprocess.call(['/home/kuba/.i3/scripts/lang.sh', 'qset', new_km]) # TODO it is this script that writes to fifo, triggering the formatting
subprocess.call(['/home/kuba/.i3/scripts/lang.sh', 'qset', new_km]) # TODO rework lang script (after fifo for executing commands)
def i3msg_comm(self, *cmd):
self.i3_ws_obj.command(' '.join(cmd))
@@ -550,6 +557,9 @@ class i3Module(LemonModule):
common.mode = m
break
parsed = parser.format_line()
self.lemonbar_wrapper.buffer_in.put(parsed)
class ScreenModule(LemonModule):
"""
@ignore host kubaArch-Desktop