diff --git a/scripts/wk/cfg/setup.py b/scripts/wk/cfg/setup.py index 54d5ca8d..86ba87ef 100644 --- a/scripts/wk/cfg/setup.py +++ b/scripts/wk/cfg/setup.py @@ -11,6 +11,11 @@ BROWSER_PATHS = { 'Opera': 'Opera/launcher.exe', } FAB_TIMEFRAME = 14 # If it's been at least this many days don't prompt for an AV scan +DISABLED_ENTRIES_WINDOWS_11 = { + # Group Name: Option Name + 'Install Software': 'Open Shell', + 'Configure System': 'Open Shell', + } LIBREOFFICE_XCU_DATA = ''' Impress MS PowerPoint 2007 XML diff --git a/scripts/wk/os/win.py b/scripts/wk/os/win.py index a7fa6118..16658501 100644 --- a/scripts/wk/os/win.py +++ b/scripts/wk/os/win.py @@ -68,14 +68,24 @@ KNOWN_HIVE_NAMES = { winreg.HKEY_LOCAL_MACHINE: 'HKLM', winreg.HKEY_USERS: 'HKU', } -OS_VERSION = platform.win32_ver()[0] -OS_VERSION = 8.1 if OS_VERSION == '8.1' else int(OS_VERSION) RAM_OK = 5.5 * 1024**3 # ~6 GiB assuming a bit of shared memory RAM_WARNING = 3.5 * 1024**3 # ~4 GiB assuming a bit of shared memory REG_MSISERVER = r'HKLM\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\MSIServer' SLMGR = pathlib.Path(f'{os.environ.get("SYSTEMROOT")}/System32/slmgr.vbs') SYSTEMDRIVE = os.environ.get('SYSTEMDRIVE') +# STATIC OS VARIABLES +WIN32_VER = platform.win32_ver() +OS_BUILD_VERSION_FULL = WIN32_VER[1] +OS_BUILD_VERSION = int(OS_BUILD_VERSION_FULL.split('.')[2]) +PLATFORM_VER = WIN32_VER[0] +if PLATFORM_VER == '8.1': + OS_VERSION = 8.1 +elif OS_BUILD_VERSION >= 22000: + OS_VERSION = 11 +else: + OS_VERSION = int(PLATFORM_VER) + # Activation Functions def activate_with_bios(): @@ -267,21 +277,19 @@ def get_os_name(as_list=False, check=True): outdated or unsupported. """ key = r'SOFTWARE\Microsoft\Windows NT\CurrentVersion' - build_version = int(reg_read_value("HKLM", key, "CurrentBuild")) - build_version_full = platform.win32_ver()[1] - details = WINDOWS_BUILDS.get(build_version_full, f'Build {build_version}') + details = WINDOWS_BUILDS.get(OS_BUILD_VERSION_FULL, f'Build {OS_BUILD_VERSION}') display_name = ( f'{reg_read_value("HKLM", key, "ProductName")} {ARCH}-bit {details}' ) - if build_version >= 22000: + if OS_BUILD_VERSION >= 22000: display_name = display_name.replace('Windows 10', 'Windows 11') # Check for support issues if check: - if build_version in OUTDATED_BUILD_NUMBERS: + if OS_BUILD_VERSION in OUTDATED_BUILD_NUMBERS: raise GenericWarning(f'{display_name} (outdated)') - if build_version < OLDEST_SUPPORTED_BUILD: + if OS_BUILD_VERSION < OLDEST_SUPPORTED_BUILD: raise GenericError(f'{display_name} (unsupported)') # Done diff --git a/scripts/wk/setup/win.py b/scripts/wk/setup/win.py index 02574707..5b89291a 100644 --- a/scripts/wk/setup/win.py +++ b/scripts/wk/setup/win.py @@ -14,13 +14,14 @@ import webbrowser from wk.cfg.main import KIT_NAME_FULL from wk.cfg.setup import ( BROWSER_PATHS, + DISABLED_ENTRIES_WINDOWS_11, FAB_TIMEFRAME, - REG_ESET_NOD32_SETTINGS, LIBREOFFICE_XCU_DATA, REG_CHROME_UBLOCK_ORIGIN, - REG_WINDOWS_EXPLORER, - REG_OPEN_SHELL_SETTINGS, + REG_ESET_NOD32_SETTINGS, REG_OPEN_SHELL_LOW_POWER_IDLE, + REG_OPEN_SHELL_SETTINGS, + REG_WINDOWS_EXPLORER, UBLOCK_ORIGIN_URLS, ) from wk.exe import kill_procs, run_program, popen_program @@ -167,6 +168,11 @@ def build_menus(base_menus, title, presets): MENU_PRESETS.add_action('Quit') MENU_PRESETS.update() + # Disable entries incompatible with Windows 11 + if OS_VERSION == 11: + for group_name, entry_name in DISABLED_ENTRIES_WINDOWS_11.items(): + menus[group_name].options[entry_name]['Disabled'] = True + # Done return menus