feat(infra): auto-commit con 12 cambios
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
---
|
||||
name: powertoys_restart
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def powertoys_restart() -> None"
|
||||
description: "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."
|
||||
tags: [powertoys, keyboard, windows, wsl, restart, process, taskkill]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_py_core"
|
||||
imports: [os, subprocess, time]
|
||||
params: []
|
||||
output: "None. Mata PowerToys.exe y PowerToys.KeyboardManagerEngine.exe, espera 1 segundo, y relanza PowerToys.exe de forma desacoplada."
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/infra/powertoys_restart.py"
|
||||
notes: |
|
||||
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
|
||||
|
||||
```python
|
||||
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.
|
||||
Reference in New Issue
Block a user