From 90fbc249af5e897821af68fd0f5b915defec57f2 Mon Sep 17 00:00:00 2001 From: Zero Rust Date: Sat, 23 May 2020 07:28:00 -0400 Subject: [PATCH] cleaner way to activate a layout --- bumblebee_status/modules/contrib/arandr.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/bumblebee_status/modules/contrib/arandr.py b/bumblebee_status/modules/contrib/arandr.py index a31ce29..883859e 100644 --- a/bumblebee_status/modules/contrib/arandr.py +++ b/bumblebee_status/modules/contrib/arandr.py @@ -40,6 +40,11 @@ class Module(core.module.Module): core.input.register(self, button=core.input.RIGHT_MOUSE, cmd=self.popup) + def activate_layout(self, layout_path): + log.debug("activating layout") + log.debug(layout_path) + execute(layout_path) + def popup(self, widget): """Create Popup that allows the user to control their displays in one of three ways: launch arandr, select a pre-set screenlayout, toggle a @@ -61,10 +66,8 @@ class Module(core.module.Module): for layout in available_layouts: sh = os.path.join(__screenlayout_dir__, layout) sh_name = os.path.splitext(layout)[0] - cmd = self.parameter(sh_name, sh) menu.add_menuitem(sh_name, - callback=partial(util.cli.execute, sh) - ) + callback=partial(self.activate_layout, sh)) menu.show(widget, 0, 0)