Skip to content

Commit

Permalink
refactor: remove assignment of u32 array conversion
Browse files Browse the repository at this point in the history
- The python-xlib doesn't provide a typeshed, and the type returned from Window.get_full_property has already been observed. The assignment was just to workaround mypy's strictness
  • Loading branch information
R1kaB3rN committed Jan 7, 2025
1 parent 71cfa80 commit 9348d87
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions umu/umu_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,17 +408,15 @@ def get_gamescope_baselayer_appid(
) -> list[int] | None:
"""Get the GAMESCOPECTRL_BASELAYER_APPID value on the primary root window."""
try:
baselayer_appid: list[int]
root_primary: Window = d.screen().root
# Intern the atom for GAMESCOPECTRL_BASELAYER_APPID
atom = d.get_atom(GamescopeAtom.BaselayerAppId.value)
# Get the property value
prop: GetProperty | None = root_primary.get_full_property(atom, Xatom.CARDINAL)
# For GAMESCOPECTRL_BASELAYER_APPID, the value is a u32 array
if prop and prop.value and isinstance(prop.value, array):
# Convert data to a Python list for safety
baselayer_appid = prop.value.tolist()
return baselayer_appid
# Ignore. Converting a u32 array to a list creates a list[int]
return prop.value.tolist() # type: ignore
log.debug("%s property not found", GamescopeAtom.BaselayerAppId.value)
except Exception as e:
log.error("Error getting %s property", GamescopeAtom.BaselayerAppId.value)
Expand Down

0 comments on commit 9348d87

Please sign in to comment.