[util/popup] fix endless loop on "close on leave"
When closing a popup window when the mouse leave the area (default behaviour, unfortunately), the main "show()" got stuck in an infinite loop. Fix that by setting running to False when exiting. fixes #844
This commit is contained in:
parent
8bde6378d4
commit
08b5386140
2 changed files with 7 additions and 5 deletions
|
@ -54,7 +54,7 @@ class Module(core.module.Module):
|
||||||
def activate_layout(layout_path):
|
def activate_layout(layout_path):
|
||||||
log.debug("activating layout")
|
log.debug("activating layout")
|
||||||
log.debug(layout_path)
|
log.debug(layout_path)
|
||||||
execute(layout_path)
|
execute(layout_path, ignore_errors=True)
|
||||||
|
|
||||||
def popup(self, widget):
|
def popup(self, widget):
|
||||||
"""Create Popup that allows the user to control their displays in one
|
"""Create Popup that allows the user to control their displays in one
|
||||||
|
@ -64,7 +64,7 @@ class Module(core.module.Module):
|
||||||
menu = popup.menu()
|
menu = popup.menu()
|
||||||
menu.add_menuitem(
|
menu.add_menuitem(
|
||||||
"arandr",
|
"arandr",
|
||||||
callback=partial(execute, self.manager)
|
callback=partial(execute, self.manager, ignore_errors=True)
|
||||||
)
|
)
|
||||||
menu.add_separator()
|
menu.add_separator()
|
||||||
|
|
||||||
|
@ -105,11 +105,12 @@ class Module(core.module.Module):
|
||||||
if count_on == 1:
|
if count_on == 1:
|
||||||
log.info("attempted to turn off last display")
|
log.info("attempted to turn off last display")
|
||||||
return
|
return
|
||||||
execute("{} --output {} --off".format(self.toggle_cmd, display))
|
execute("{} --output {} --off".format(self.toggle_cmd, display), ignore_errors=True)
|
||||||
else:
|
else:
|
||||||
log.debug("toggling on {}".format(display))
|
log.debug("toggling on {}".format(display))
|
||||||
execute(
|
execute(
|
||||||
"{} --output {} --auto".format(self.toggle_cmd, display)
|
"{} --output {} --auto".format(self.toggle_cmd, display),
|
||||||
|
ignore_errors=True
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -120,7 +121,7 @@ class Module(core.module.Module):
|
||||||
connected).
|
connected).
|
||||||
"""
|
"""
|
||||||
displays = {}
|
displays = {}
|
||||||
for line in execute("xrandr -q").split("\n"):
|
for line in execute("xrandr -q", ignore_errors=True).split("\n"):
|
||||||
if "connected" not in line:
|
if "connected" not in line:
|
||||||
continue
|
continue
|
||||||
is_on = bool(re.search(r"\d+x\d+\+(\d+)\+\d+", line))
|
is_on = bool(re.search(r"\d+x\d+\+(\d+)\+\d+", line))
|
||||||
|
|
|
@ -49,6 +49,7 @@ class menu(object):
|
||||||
return self._menu
|
return self._menu
|
||||||
|
|
||||||
def __on_focus_out(self, event=None):
|
def __on_focus_out(self, event=None):
|
||||||
|
self.running = False
|
||||||
self._root.destroy()
|
self._root.destroy()
|
||||||
|
|
||||||
def __on_click(self, callback):
|
def __on_click(self, callback):
|
||||||
|
|
Loading…
Reference in a new issue