Created
September 1, 2026 05:13
-
-
Save jeferandom/5dbc99cf3bae11689b7ee58b2c1c182a to your computer and use it in GitHub Desktop.
Mantiene Alt pulsado (miniaturas de ventanas visibles) hasta que ocurra CUALQUIER clic del mouse, que confirma la selección.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Mantiene Alt pulsado (miniaturas de ventanas visibles) hasta que | |
| # ocurra CUALQUIER clic del mouse, que confirma la selección. | |
| echo "script iniciado $(date)" >> /tmp/alt-tab.log | |
| PIDFILE="/tmp/xbindkeys-alt-tab.pid" | |
| # Matar instancia anterior colgada (si existe) | |
| if [ -f "$PIDFILE" ]; then | |
| oldpid=$(cat "$PIDFILE") | |
| if [ -n "$oldpid" ] && kill -0 "$oldpid" 2>/dev/null; then | |
| kill -9 "$oldpid" 2>/dev/null | |
| # Liberar Alt que pudiera quedar pulsado en la instancia anterior | |
| xdotool keyup alt 2>/dev/null | |
| fi | |
| fi | |
| echo $$ > "$PIDFILE" | |
| # Pulsar Alt y Tab para mostrar las miniaturas, y soltar Tab | |
| # de inmediato (evita que las ventanas hagan loop de selección). | |
| # Alt permanece pulsado manteniendo las miniaturas visibles. | |
| # Pequeñas pausas para que el WM registre correctamente las teclas. | |
| xdotool keydown alt | |
| sleep 0.15 | |
| xdotool keydown Tab | |
| sleep 0.05 | |
| xdotool keyup Tab | |
| # Esperar cualquier clic de botón de cualquier ratón | |
| xinput test-xi2 --root 2 | grep -m1 "RawButtonPress" | |
| # Soltar Alt para confirmar | |
| xdotool keyup alt | |
| rm -f "$PIDFILE" | |
| exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment