Skip to content

Commit 1c6f00c

Browse files
jholveckCopilot
andauthored
Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent e1af248 commit 1c6f00c

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

src/mss/linux/base.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,16 @@ def _randr_output_ids(
271271
edid_params["mfr_date"] = f"{edid_data['manufacture_year']:04d}"
272272
if "model_year" in edid_data:
273273
edid_params["model_year"] = f"{edid_data['model_year']:04d}"
274-
rv["unique_id"] = urlencode(edid_params)
274+
if edid_params:
275+
rv["unique_id"] = urlencode(edid_params)
275276

276277
return rv
277278

278279
@staticmethod
279280
def _choose_randr_output(outputs: Array[xcb.RandrOutput], primary_output: xcb.RandrOutput, /) -> xcb.RandrOutput:
281+
if len(outputs) == 0:
282+
msg = "No RandR outputs available"
283+
raise ScreenShotError(msg)
280284
if any(o == primary_output for o in outputs):
281285
return primary_output
282286
return outputs[0]

src/mss/tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
_EDID_DESCR_TAG_LOC = 3 # Location of display descriptor tag
2424
_EDID_DESCR_TAG_SN = 0xFF # Descriptor is a string serial number
2525
_EDID_DESCR_TAG_NAME = 0xFC # Descriptor is a string model name
26-
_EDID_DESCR_STR_LOC = slice(5, 19) # Location of string in a display descriptor
26+
_EDID_DESCR_STR_LOC = slice(5, 18) # Location of string in a display descriptor
2727

2828

2929
def parse_edid(edid_data: bytes) -> dict:

0 commit comments

Comments
 (0)