From 8dcbcfc6cb60819904c7c5111c23068aa0938577 Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sun, 21 Apr 2024 19:11:37 -0700 Subject: [PATCH] Update config_explorer() This should hopefully prevent new explorer windows from being opened and instead just reload the shell --- scripts/wk/setup/win.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/wk/setup/win.py b/scripts/wk/setup/win.py index d3c050d0..75bee042 100644 --- a/scripts/wk/setup/win.py +++ b/scripts/wk/setup/win.py @@ -25,7 +25,7 @@ from wk.cfg.setup import ( REG_WINDOWS_EXPLORER, UBLOCK_ORIGIN_URLS, ) -from wk.exe import kill_procs, run_program, popen_program +from wk.exe import get_procs, kill_procs, run_program, popen_program from wk.io import case_insensitive_path, get_path_obj from wk.kit.tools import ( ARCH, @@ -688,7 +688,12 @@ def config_explorer() -> None: """Configure Windows Explorer and restart the process.""" reg_write_settings(REG_WINDOWS_EXPLORER) kill_procs('explorer.exe', force=True) - popen_program(['explorer.exe']) + popen_program([fr'{SYSTEMDRIVE}\Windows\explorer.exe']) + sleep(3) + for _ in range(30): + if get_procs('explorer.exe'): + break + sleep(1) def config_open_shell() -> None: