diff --git a/.nova/Tasks/Vendor install darkdetect.json b/.nova/Tasks/Vendor install darkdetect.json new file mode 100644 index 0000000..2d6a53c --- /dev/null +++ b/.nova/Tasks/Vendor install darkdetect.json @@ -0,0 +1,17 @@ +{ + "actions" : { + "build" : { + "enabled" : true, + "script" : "#!\/bin\/sh\npip install --target=\"$1\/src\/vendor\" darkdetect" + }, + "clean" : { + "enabled" : true, + "script" : "#!\/bin\/sh\nrm -r src\/vendor\/*" + } + }, + "arguments" : [ + "${WorkspaceFolder}" + ], + "identifier" : "E685FD49-B382-4D23-8231-EE993BA7A3AE", + "openLogOnRun" : "start" +} diff --git a/src/__init__.py b/src/__init__.py index f731def..295f998 100644 --- a/src/__init__.py +++ b/src/__init__.py @@ -17,7 +17,7 @@ "name": "Auto Dark Mode", "description": "Automatically follow the system light/dark mode.", "author": "Dale Price", - "version": (1, 0, 2), + "version": (1, 0, 3), "blender": (2, 90, 0), "category": "User Interface", "wiki_url": "https://github.com/daprice/Blender-Auto-Dark-Mode", diff --git a/src/vendor/darkdetect-0.5.0.dist-info/RECORD b/src/vendor/darkdetect-0.5.0.dist-info/RECORD deleted file mode 100644 index 573683f..0000000 --- a/src/vendor/darkdetect-0.5.0.dist-info/RECORD +++ /dev/null @@ -1,18 +0,0 @@ -darkdetect-0.5.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -darkdetect-0.5.0.dist-info/LICENSE,sha256=abuEZk7_kzrdyycchm1nYi2cLFOlvaMbGnUjVpwlCv4,1495 -darkdetect-0.5.0.dist-info/METADATA,sha256=qazcNJXAaHCi6eP1RZ9a1eWMWi0Am8UacOk3zrMLGDE,3083 -darkdetect-0.5.0.dist-info/RECORD,, -darkdetect-0.5.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -darkdetect-0.5.0.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 -darkdetect-0.5.0.dist-info/direct_url.json,sha256=8lMmbkkQw1l4oyMmTMmHEJopOPfhDMKzrRKDEASbtrg,137 -darkdetect-0.5.0.dist-info/top_level.txt,sha256=lIG2Q43uQniIc4b-ukidPntGpjQzuFfQCYrgxeM4RVQ,11 -darkdetect/__init__.py,sha256=mUsm1QSnIefU5DvokBaGm2tS7jZi1mhU9yP7v3lNYNE,1091 -darkdetect/__pycache__/__init__.cpython-39.pyc,, -darkdetect/__pycache__/_dummy.cpython-39.pyc,, -darkdetect/__pycache__/_linux_detect.cpython-39.pyc,, -darkdetect/__pycache__/_mac_detect.cpython-39.pyc,, -darkdetect/__pycache__/_windows_detect.cpython-39.pyc,, -darkdetect/_dummy.py,sha256=pRfhFxFSaiT6DGCyhw1S3K_h45PtXqzzxi6bLGib5CQ,363 -darkdetect/_linux_detect.py,sha256=ImoFtBzpOer0ii22juz-0PVZE9IiHPprOubakxEX6cg,860 -darkdetect/_mac_detect.py,sha256=WFhGYD3mkeQFh-3dwmqWjPKTt8U16uhCv_e-rdxOw2g,2159 -darkdetect/_windows_detect.py,sha256=Z9jelgvn1bLb16hVJ3eNzZSKypi6w3gg_tK3aSF1AnQ,994 diff --git a/src/vendor/darkdetect-0.5.0.dist-info/direct_url.json b/src/vendor/darkdetect-0.5.0.dist-info/direct_url.json deleted file mode 100644 index a648413..0000000 --- a/src/vendor/darkdetect-0.5.0.dist-info/direct_url.json +++ /dev/null @@ -1 +0,0 @@ -{"url": "https://github.com/daprice/darkdetect.git", "vcs_info": {"commit_id": "c10b91ed9ecc37f6f2d300bc57ac64c431ec24f8", "vcs": "git"}} \ No newline at end of file diff --git a/src/vendor/darkdetect-0.5.0.dist-info/INSTALLER b/src/vendor/darkdetect-0.5.1.dist-info/INSTALLER similarity index 100% rename from src/vendor/darkdetect-0.5.0.dist-info/INSTALLER rename to src/vendor/darkdetect-0.5.1.dist-info/INSTALLER diff --git a/src/vendor/darkdetect-0.5.0.dist-info/LICENSE b/src/vendor/darkdetect-0.5.1.dist-info/LICENSE similarity index 100% rename from src/vendor/darkdetect-0.5.0.dist-info/LICENSE rename to src/vendor/darkdetect-0.5.1.dist-info/LICENSE diff --git a/src/vendor/darkdetect-0.5.0.dist-info/METADATA b/src/vendor/darkdetect-0.5.1.dist-info/METADATA similarity index 99% rename from src/vendor/darkdetect-0.5.0.dist-info/METADATA rename to src/vendor/darkdetect-0.5.1.dist-info/METADATA index 58d27f4..fa1407e 100644 --- a/src/vendor/darkdetect-0.5.0.dist-info/METADATA +++ b/src/vendor/darkdetect-0.5.1.dist-info/METADATA @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: darkdetect -Version: 0.5.0 +Version: 0.5.1 Summary: Detect OS Dark Mode from Python Home-page: http://github.com/albertosottile/darkdetect Author: Alberto Sottile diff --git a/src/vendor/darkdetect-0.5.1.dist-info/RECORD b/src/vendor/darkdetect-0.5.1.dist-info/RECORD new file mode 100644 index 0000000..9246770 --- /dev/null +++ b/src/vendor/darkdetect-0.5.1.dist-info/RECORD @@ -0,0 +1,17 @@ +darkdetect-0.5.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +darkdetect-0.5.1.dist-info/LICENSE,sha256=abuEZk7_kzrdyycchm1nYi2cLFOlvaMbGnUjVpwlCv4,1495 +darkdetect-0.5.1.dist-info/METADATA,sha256=QsYzG2GPRtgP9xyOxdu2Ju-MHlCVn6JTNjSqKsgeSkw,3083 +darkdetect-0.5.1.dist-info/RECORD,, +darkdetect-0.5.1.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +darkdetect-0.5.1.dist-info/WHEEL,sha256=ewwEueio1C2XeHTvT17n8dZUJgOvyCWCt0WVNLClP9o,92 +darkdetect-0.5.1.dist-info/top_level.txt,sha256=lIG2Q43uQniIc4b-ukidPntGpjQzuFfQCYrgxeM4RVQ,11 +darkdetect/__init__.py,sha256=V6dgkKpuhoi1ZEvTkBQMzrvkZ3nkWpD6qRj1PZYj530,1094 +darkdetect/__pycache__/__init__.cpython-39.pyc,, +darkdetect/__pycache__/_dummy.cpython-39.pyc,, +darkdetect/__pycache__/_linux_detect.cpython-39.pyc,, +darkdetect/__pycache__/_mac_detect.cpython-39.pyc,, +darkdetect/__pycache__/_windows_detect.cpython-39.pyc,, +darkdetect/_dummy.py,sha256=pRfhFxFSaiT6DGCyhw1S3K_h45PtXqzzxi6bLGib5CQ,363 +darkdetect/_linux_detect.py,sha256=ImoFtBzpOer0ii22juz-0PVZE9IiHPprOubakxEX6cg,860 +darkdetect/_mac_detect.py,sha256=a6DlTzsYFHKJHqVY4VaTU9xXjgxul9Cl1HZkVqCEgzc,2142 +darkdetect/_windows_detect.py,sha256=n54lw17AqNy6Pfk7378FajVbrq6qwHJwx9Ug5tJY1v4,1234 diff --git a/src/vendor/darkdetect-0.5.0.dist-info/REQUESTED b/src/vendor/darkdetect-0.5.1.dist-info/REQUESTED similarity index 100% rename from src/vendor/darkdetect-0.5.0.dist-info/REQUESTED rename to src/vendor/darkdetect-0.5.1.dist-info/REQUESTED diff --git a/src/vendor/darkdetect-0.5.0.dist-info/WHEEL b/src/vendor/darkdetect-0.5.1.dist-info/WHEEL similarity index 100% rename from src/vendor/darkdetect-0.5.0.dist-info/WHEEL rename to src/vendor/darkdetect-0.5.1.dist-info/WHEEL diff --git a/src/vendor/darkdetect-0.5.0.dist-info/top_level.txt b/src/vendor/darkdetect-0.5.1.dist-info/top_level.txt similarity index 100% rename from src/vendor/darkdetect-0.5.0.dist-info/top_level.txt rename to src/vendor/darkdetect-0.5.1.dist-info/top_level.txt diff --git a/src/vendor/darkdetect/__init__.py b/src/vendor/darkdetect/__init__.py index bb1df11..c807d64 100644 --- a/src/vendor/darkdetect/__init__.py +++ b/src/vendor/darkdetect/__init__.py @@ -4,7 +4,7 @@ # Distributed under the terms of the 3-clause BSD License. #----------------------------------------------------------------------------- -__version__ = '0.5.0' +__version__ = '0.5.1' import sys import platform @@ -16,8 +16,8 @@ else: from ._mac_detect import * del V -elif sys.platform == "win32" and platform.release() == "10": - # Checks if running Windows 10 version 10.0.14393 (Anniversary Update) or higher. The getwindowsversion method returns a tuple. +elif sys.platform == "win32" and int(platform.release()) >= 10: + # Checks if running Windows 10 version 10.0.14393 (Anniversary Update) OR HIGHER. The getwindowsversion method returns a tuple. # The third item is the build number that we can use to check if the user has a new enough version of Windows. winver = int(sys.getwindowsversion()[2]) if winver >= 14393: diff --git a/src/vendor/darkdetect/__pycache__/__init__.cpython-39.pyc b/src/vendor/darkdetect/__pycache__/__init__.cpython-39.pyc index b7104d8..42d92cd 100644 Binary files a/src/vendor/darkdetect/__pycache__/__init__.cpython-39.pyc and b/src/vendor/darkdetect/__pycache__/__init__.cpython-39.pyc differ diff --git a/src/vendor/darkdetect/__pycache__/_dummy.cpython-39.pyc b/src/vendor/darkdetect/__pycache__/_dummy.cpython-39.pyc index ae156be..710267f 100644 Binary files a/src/vendor/darkdetect/__pycache__/_dummy.cpython-39.pyc and b/src/vendor/darkdetect/__pycache__/_dummy.cpython-39.pyc differ diff --git a/src/vendor/darkdetect/__pycache__/_linux_detect.cpython-39.pyc b/src/vendor/darkdetect/__pycache__/_linux_detect.cpython-39.pyc index ca2e304..3dcb31e 100644 Binary files a/src/vendor/darkdetect/__pycache__/_linux_detect.cpython-39.pyc and b/src/vendor/darkdetect/__pycache__/_linux_detect.cpython-39.pyc differ diff --git a/src/vendor/darkdetect/__pycache__/_mac_detect.cpython-39.pyc b/src/vendor/darkdetect/__pycache__/_mac_detect.cpython-39.pyc index f0a6807..aa7ac40 100644 Binary files a/src/vendor/darkdetect/__pycache__/_mac_detect.cpython-39.pyc and b/src/vendor/darkdetect/__pycache__/_mac_detect.cpython-39.pyc differ diff --git a/src/vendor/darkdetect/__pycache__/_windows_detect.cpython-39.pyc b/src/vendor/darkdetect/__pycache__/_windows_detect.cpython-39.pyc index e8817ce..38c074f 100644 Binary files a/src/vendor/darkdetect/__pycache__/_windows_detect.cpython-39.pyc and b/src/vendor/darkdetect/__pycache__/_windows_detect.cpython-39.pyc differ diff --git a/src/vendor/darkdetect/_mac_detect.py b/src/vendor/darkdetect/_mac_detect.py index 00657a0..fbe6a35 100644 --- a/src/vendor/darkdetect/_mac_detect.py +++ b/src/vendor/darkdetect/_mac_detect.py @@ -6,17 +6,15 @@ import ctypes import ctypes.util -import platform -from distutils.version import LooseVersion as V - -if V(platform.mac_ver()[0]) < V("10.16") or platform.python_version_tuple()[0] == '2': +try: + # macOS Big Sur+ use "a built-in dynamic linker cache of all system-provided libraries" + appkit = ctypes.cdll.LoadLibrary('AppKit.framework/AppKit') + objc = ctypes.cdll.LoadLibrary('libobjc.dylib') +except OSError: + # revert to full path for older OS versions and hardened programs appkit = ctypes.cdll.LoadLibrary(ctypes.util.find_library('AppKit')) objc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('objc')) -else: - appkit = ctypes.cdll.LoadLibrary('/System/Library/Frameworks/AppKit.framework/AppKit') - objc = ctypes.cdll.LoadLibrary('/usr/lib/libobjc.dylib') -del V void_p = ctypes.c_void_p ull = ctypes.c_uint64 diff --git a/src/vendor/darkdetect/_windows_detect.py b/src/vendor/darkdetect/_windows_detect.py index 61409a7..a976885 100644 --- a/src/vendor/darkdetect/_windows_detect.py +++ b/src/vendor/darkdetect/_windows_detect.py @@ -5,14 +5,20 @@ def theme(): # Registry will return 0 if Windows is in Dark Mode and 1 if Windows is in Light Mode. This dictionary converts that output into the text that the program is expecting. valueMeaning = {0: "Dark", 1: "Light"} # In HKEY_CURRENT_USER, get the Personalisation Key. - key = getKey(hkey, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize") - # In the Personalisation Key, get the AppsUseLightTheme subkey. This returns a tuple. - # The first item in the tuple is the result we want (0 or 1 indicating Dark Mode or Light Mode); the other value is the type of subkey e.g. DWORD, QWORD, String, etc. - subkey = getSubkeyValue(key, "AppsUseLightTheme")[0] + try: + key = getKey(hkey, "Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\Personalize") + # In the Personalisation Key, get the AppsUseLightTheme subkey. This returns a tuple. + # The first item in the tuple is the result we want (0 or 1 indicating Dark Mode or Light Mode); the other value is the type of subkey e.g. DWORD, QWORD, String, etc. + subkey = getSubkeyValue(key, "AppsUseLightTheme")[0] + except FileNotFoundError: + # some headless Windows instances (e.g. GitHub Actions or Docker images) do not have this key + return None return valueMeaning[subkey] def isDark(): - return theme() == 'Dark' + if theme() is not None: + return theme() == 'Dark' def isLight(): - return theme() == 'Light' \ No newline at end of file + if theme() is not None: + return theme() == 'Light' \ No newline at end of file