From caf65170c3cd38c4013b80f012c3cc9838a6e41a Mon Sep 17 00:00:00 2001 From: Gremious Grenald Date: Tue, 27 Jun 2023 21:10:12 +0100 Subject: [PATCH] Use bytestring for wallpaper path on Windows --- pywal/wallpaper.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pywal/wallpaper.py b/pywal/wallpaper.py index 09469f4..16996be 100644 --- a/pywal/wallpaper.py +++ b/pywal/wallpaper.py @@ -175,7 +175,10 @@ def set_win_wallpaper(img): if "x86" in os.environ["PROGRAMFILES"]: ctypes.windll.user32.SystemParametersInfoW(20, 0, img, 3) else: - ctypes.windll.user32.SystemParametersInfoA(20, 0, img, 3) + # 'W' funcitons take uniqcode strings, + # while 'A' functions take UTF-8 bytestrings. + # (Python 3 strings are Unicode by default.) + ctypes.windll.user32.SystemParametersInfoA(20, 0, str.encode(img), 3) def change(img):