From 74656e9da4008f75f3b1d136dbaf1172bf6c232f Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Sat, 10 Aug 2024 12:55:58 -0700 Subject: [PATCH] refactor: prefer flat conditionals in monitor_baselayer --- umu/umu_run.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/umu/umu_run.py b/umu/umu_run.py index 3410567d5..960eb838a 100755 --- a/umu/umu_run.py +++ b/umu/umu_run.py @@ -588,19 +588,18 @@ def monitor_baselayer( while True: event: Event = d_primary.next_event() + prop: GetProperty | None = None - # Check if the layer sequence has changed to the broken one if event.type == X.PropertyNotify and event.atom == atom: - prop: GetProperty | None = root_primary.get_full_property( - atom, Xatom.CARDINAL - ) + prop = root_primary.get_full_property(atom, Xatom.CARDINAL) - if prop and prop.value == gamescope_baselayer_sequence: - log.debug("Broken base layer sequence detected") - log.debug("Property value for atom '%s': %s", atom, prop.value) - rearranged, _ = rearrange_gamescope_baselayer_order(prop.value) - set_gamescope_baselayer_order(d_primary, rearranged) - continue + # Check if the layer sequence has changed to the broken one + if prop and prop.value == gamescope_baselayer_sequence: + log.debug("Broken base layer sequence detected") + log.debug("Property value for atom '%s': %s", atom, prop.value) + rearranged, _ = rearrange_gamescope_baselayer_order(prop.value) + set_gamescope_baselayer_order(d_primary, rearranged) + continue time.sleep(0.1)