[modules/rotation] create a widget per display once on refresh
* This module only updates some information on the screen when a new display is added/removed, hence it makes sense to update it only when the i3-bar is refreshed.
This commit is contained in:
parent
2bf89735fb
commit
a84e568746
1 changed files with 2 additions and 7 deletions
|
@ -21,7 +21,6 @@ class Module(bumblebee.engine.Module):
|
|||
self.update_widgets(widgets)
|
||||
|
||||
def update_widgets(self, widgets):
|
||||
new_widgets = []
|
||||
for line in bumblebee.util.execute("xrandr -q").split("\n"):
|
||||
if not " connected" in line:
|
||||
continue
|
||||
|
@ -37,15 +36,11 @@ class Module(bumblebee.engine.Module):
|
|||
if not widget:
|
||||
widget = bumblebee.output.Widget(full_text=display, name=display)
|
||||
self._engine.input.register_callback(widget, button=bumblebee.input.LEFT_MOUSE, cmd=self._toggle)
|
||||
new_widgets.append(widget)
|
||||
widget.set("orientation", orientation)
|
||||
|
||||
while len(widgets) > 0:
|
||||
del widgets[0]
|
||||
for widget in new_widgets:
|
||||
widgets.append(widget)
|
||||
|
||||
def update(self, widgets):
|
||||
if len(widgets) <= 0:
|
||||
self.update_widgets(widgets)
|
||||
|
||||
def state(self, widget):
|
||||
|
|
Loading…
Reference in a new issue