Files
fn_registry/python/functions/infra/powertoys_restart.md
T
egutierrez 9c661d605a feat(infra): auto-commit con 12 cambios
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-08 01:21:17 +02:00

2.2 KiB

name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path, notes
name kind lang domain version purity signature description tags uses_functions uses_types returns returns_optional error_type imports params output tested tests test_file_path file_path notes
powertoys_restart function py infra 1.0.0 impure def powertoys_restart() -> None Mata los procesos de PowerToys y los relanza para que recargue la configuracion del Keyboard Manager. Compatible con WSL via taskkill.exe y cmd.exe.
powertoys
keyboard
windows
wsl
restart
process
taskkill
false error_py_core
os
subprocess
time
None. Mata PowerToys.exe y PowerToys.KeyboardManagerEngine.exe, espera 1 segundo, y relanza PowerToys.exe de forma desacoplada. false
python/functions/infra/powertoys_restart.py error_py_core no existe en el registry. Esta funcion puede lanzar RuntimeError si taskkill.exe o cmd.exe no estan disponibles en el PATH, o FileNotFoundError si no se puede resolver el path del exe. Mata los procesos con taskkill.exe /F (forzado). Si PowerToys no esta corriendo, taskkill falla silenciosamente (capture_output=True, returncode ignorado). El path del exe se construye como /mnt/c/Users/<USER>/AppData/Local/PowerToys/PowerToys.exe. Se puede sobreescribir con la env var $POWERTOYS_EXE (path WSL o Windows). La conversion de path WSL a Windows: /mnt/c/Users/... -> C:\Users... se hace internamente. El Popen usa cmd.exe /c start "" <exe> para desacoplar el proceso hijo (no bloquea). Tiempo de espera entre kill y launch: 1 segundo (hardcoded). Si PowerToys tarda mas en cerrar, la nueva instancia puede fallar al iniciar — esperar unos segundos extra antes de verificar si esta corriendo.

Ejemplo

from infra.powertoys_shortcut_add import powertoys_shortcut_add
from infra.powertoys_restart import powertoys_restart

# Anadir atajo y recargar PowerToys
powertoys_shortcut_add(
    keys=["lctrl", "lalt", "t"],
    target_path=r"C:\Windows\System32\wt.exe",
)
powertoys_restart()
print("PowerToys reiniciado — el nuevo atajo esta activo")

Notas

Solo funciona en entornos donde taskkill.exe y cmd.exe estan disponibles en el PATH (WSL con integracion Windows habilitada, o Windows nativo). No funciona en Linux puro ni en Mac.