get_wallpaper error handling

This commit is contained in:
Roland Thomas Jr 2023-09-04 12:48:34 -04:00
parent 57e677e0cf
commit 9145fa183d
Signed by: roland
GPG Key ID: 7C3C2B085A4C2872
1 changed files with 2 additions and 3 deletions

View File

@ -89,9 +89,6 @@ def get_wallpaper(screen_number):
Returns: Returns:
str: The wallpaper path for the specified screen size. str: The wallpaper path for the specified screen size.
Raises:
IndexError: If the specified screen number is out of bounds.
""" """
try: try:
screens_ = run( screens_ = run(
@ -108,6 +105,8 @@ def get_wallpaper(screen_number):
size = screens_.stdout.split()[screen_number] size = screens_.stdout.split()[screen_number]
except IndexError: except IndexError:
size = screens_.stdout.split()[0] size = screens_.stdout.split()[0]
except AttributeError:
size = screens_
match size: match size:
case "3440x1440": case "3440x1440":