diff --git a/CHANGELOG.md b/CHANGELOG.md
index 55cab34..b62a91b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,6 +10,27 @@ Todas las versiones publicables del plugin. El formato sigue
> `changeNotes` en `build.gradle.kts` —que es lo que sale en la ficha del Marketplace y
> en el diálogo de actualización del IDE— y este fichero.
+## [2.33.0]
+
+### Añadido
+- **Quick Add con un atajo del sistema**, opcional y desactivado por defecto: abre el diálogo
+ existente cuando el IDE está abierto aunque otra aplicación tenga el foco.
+- **Configuración independiente del Keymap** en *Settings → Tools → Tasklane Global Quick Add*:
+ combinación de teclas, último proyecto activo o un proyecto abierto fijo, estado de registro
+ y reintento. Los ajustes son locales a la instalación y no se sincronizan.
+- Integración con los atajos registrados de **Windows y macOS**, las capturas pasivas de **X11**
+ y el portal **Global Shortcuts de Wayland**. Se muestran conflictos, permisos rechazados y
+ falta de soporte; no se captura todo el teclado ni se utiliza XWayland como sustituto.
+
+### Compatibilidad y límites
+- El IDE debe estar abierto y el proyecto de destino disponible; un destino fijo cerrado no
+ redirige la tarea a otro proyecto. Se respeta el repositorio activo y su modo de solo lectura.
+- En Wayland, el escritorio autoriza la combinación efectiva y decide si permite poner la
+ ventana en primer plano. La disponibilidad depende del portal del escritorio.
+- Windows reserva F12. El adaptador de macOS admite F1–F20 y posiciones de teclado latinas;
+ F21–F24 se indican como no disponibles.
+- Se conservan el atajo interno del IDE y el formato de las tareas. No hay migración de datos.
+
## [2.32.0]
Escribir Markdown y leer código, pedida por el usuario a la vista de un `behavior` pegado a su
recuadro y de un bloque de log que no se podía copiar de una vez.
diff --git a/build.gradle.kts b/build.gradle.kts
index ed5a383..ff7f36a 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -131,6 +131,19 @@ intellijPlatform {
// junto con pluginVersion; el historial largo vive en CHANGELOG.md.
changeNotes = provider {
"""
+
2.33.0 — optional system-wide Quick Add
+
+ - Open the existing New Task dialog while another application is focused,
+ with an optional system-wide shortcut. The IDE must be running.
+ - Configure the combination and the last active or a fixed open project in
+ Settings → Tools → Tasklane Global Quick Add. Disabled by default;
+ machine-local settings, visible registration status, conflicts and retry.
+ - Native registered shortcuts on Windows and macOS, passive grabs on X11,
+ and the Global Shortcuts portal on supported Wayland desktops. No whole-keyboard
+ monitoring. Wayland controls consent, the effective binding and foreground focus.
+ - The IDE-local Keymap action and task data format are unchanged.
+ Windows F12 and macOS F21–F24 are unavailable.
+
2.32.0 — lists that continue, and code you can copy
- In the task dialog, Enter continues a list: the next number,
diff --git a/docs/development.md b/docs/development.md
index 83b46a6..28a9b93 100644
--- a/docs/development.md
+++ b/docs/development.md
@@ -43,7 +43,7 @@ Community que descargar—, y ahí sí se detecta cualquier uso accidental de un
```bash
./gradlew test # tests de dominio, búsqueda, almacén y renderer, sin IDE
-./gradlew buildPlugin # -> build/distributions/tasklane-2.32.0.zip
+./gradlew buildPlugin # -> build/distributions/tasklane-2.33.0.zip
./gradlew runIde # lanza un IDE sandbox con el plugin
./gradlew verifyPluginProjectConfiguration # chequea targets y sinceBuild
./gradlew verifyPlugin -PlocalIdePath= # Plugin Verifier (descarga IDEs completos)
@@ -59,6 +59,24 @@ por escenario en los tres sistemas. Los techos son los presupuestos de cada fase
EDT, 50 ms para editar, 150 MB de heap— y no cifras de un portátil, así que un runner más
lento no los rompe sin que algo haya empeorado. Deja las cifras de cada noche en un CSV.
+## Preparar la 2.33.0 para Marketplace
+
+El paquete publicable es `build/distributions/tasklane-2.33.0.zip`. Generarlo con la
+plataforma mínima, no con la ruta de un IDE local, para incluir las opciones de búsqueda:
+
+```bash
+./gradlew test verifyPluginProjectConfiguration buildPlugin verifyPlugin -PlocalIdePath= --no-configuration-cache
+```
+
+Comprobar que el descriptor del ZIP y las notas indican `2.33.0`, que se incluye el índice
+de opciones y que el verificador no informa incompatibilidades con los IDEs seleccionados.
+Las pruebas unitarias no sustituyen la [comprobación real del atajo global](global-quick-add.md#verification-status)
+en Windows, macOS, X11 y Wayland. El informe de esta preparación está en
+[`release-2.33.0.md`](release-2.33.0.md); distingue resultados observados de pendientes.
+
+La firma utiliza la configuración existente, si se proporcionan las credenciales de firma.
+Preparar el ZIP no publica nada: la subida a Marketplace es una acción separada.
+
## Fases y versiones
**Una fase cerrada subía la versión media:** la fase N dejaba el plugin en `0.N.0`, y
diff --git a/docs/global-quick-add-linux.md b/docs/global-quick-add-linux.md
index 8396dc9..3d9b3f1 100644
--- a/docs/global-quick-add-linux.md
+++ b/docs/global-quick-add-linux.md
@@ -2,11 +2,11 @@
Global Quick Add is opt-in and only runs while the IDE is open. The existing IDE-local Quick Add keymap action remains available if global registration fails.
-- **X11:** Tasklane uses libxcb and requests passive grabs for the configured combination. If the X server reports that another client already owns the combination, choose another shortcut. Reapply the setting after changing the X11 keyboard mapping.
+- **X11:** Tasklane uses libxcb and requests passive grabs for the configured combination. It releases the active keyboard grab before opening Quick Add so other keys can continue to reach the focused application. If the X server reports that another client already owns the combination, choose another shortcut. Reapply the setting after changing the X11 keyboard mapping.
- **Wayland:** Tasklane uses the desktop's [Global Shortcuts portal](https://flatpak.github.io/xdg-desktop-portal/docs/doc-org.freedesktop.portal.GlobalShortcuts.html). The desktop may prompt you to approve or change the shortcut. Settings show the effective shortcut reported by the desktop. A missing portal, declined request, or empty grant leaves the shortcut unavailable; Tasklane does not fall back to XWayland or monitor keyboard input.
## Desktop verification
Unit tests cover registration, cleanup, conflict and cancellation handling, activation routing, and D-Bus wire signatures without connecting to a desktop. They do not establish whether an installed IDE will receive an actual key press or whether a compositor will raise its dialog.
-On X11 and on a Wayland desktop that implements the portal, enable Global Quick Add in an installed IDE and switch to a different application. Press the shortcut, confirm that the dialog appears in the intended IDE project, and confirm that holding it does not create duplicate dialogs. Change the shortcut, then disable it, and confirm that old bindings stop responding. On Wayland, also try declining the prompt and confirm the IDE-local action still works. Verify native focus separately: the desktop may restrict foreground activation even when it delivers the shortcut.
+On X11 and on a Wayland desktop that implements the portal, enable Global Quick Add in an installed IDE and switch to a different application. Press the shortcut, confirm that the dialog appears in the intended IDE project, and confirm that holding it does not create duplicate dialogs. On X11, also type an unrelated key while holding the shortcut and confirm it reaches the focused application. Change the shortcut, then disable it, and confirm that old bindings stop responding. On Wayland, also try declining the prompt and confirm the IDE-local action still works. Verify native focus separately: the desktop may restrict foreground activation even when it delivers the shortcut.
diff --git a/docs/manual.md b/docs/manual.md
index 19780ec..7e2d04e 100644
--- a/docs/manual.md
+++ b/docs/manual.md
@@ -67,7 +67,7 @@ O con el zip de una [release de GitHub](https://github.com/palmerovicdev/tasklan
que es lo que produce este repositorio:
```bash
-./gradlew buildPlugin # -> build/distributions/tasklane-2.29.0.zip
+./gradlew buildPlugin # -> build/distributions/tasklane-2.33.0.zip
```
*Settings → Plugins → ⚙ → Install Plugin from Disk…*
@@ -525,6 +525,28 @@ siempre—; si no, espera a la próxima. Con las marcas apagadas no sale.
## Quick Add
+### Atajo del sistema (2.33.0)
+
+Además del atajo interno, *Settings → Tools → Tasklane Global Quick Add* permite activar
+un atajo que funciona con otra aplicación enfocada. El IDE debe seguir abierto.
+Está desactivado por defecto y no modifica el Keymap.
+
+Se pueden elegir los modificadores y la tecla, usar el último proyecto activo o fijar la
+ruta absoluta de un proyecto abierto. La tarea se crea en su repositorio activo; si el destino
+fijo está cerrado o el repositorio es de solo lectura, se avisa en lugar de escribir en otro.
+**Apply** guarda los cambios y registra el atajo; **Retry registration** reintenta la
+configuración guardada. El estado muestra el registro, los conflictos o la falta de soporte.
+
+Windows y macOS usan atajos registrados; X11, capturas pasivas; Wayland, el portal del
+escritorio, que puede pedir permiso, cambiar la combinación o rechazarla. El escritorio
+controla también si permite traer el IDE al frente. No hay captura general del teclado ni
+sustitución por XWayland. Windows reserva F12 y macOS no admite F21–F24 en este adaptador.
+Los ajustes se guardan localmente, sin Settings Sync.
+
+La [guía de Global Quick Add](global-quick-add.md) detalla límites y comprobaciones.
+
+### Atajo dentro del IDE
+
`⌘⌥R` abre **el mismo diálogo** que *New Task*, desde cualquier sitio del IDE y sin
pasar por la Tool Window. Hasta la `0.6.7` abría un popup compacto propio: se escribía
más rápido, pero tenía la mitad de los campos —sin vencimiento, sin etiquetas, sin
diff --git a/docs/release-2.33.0.md b/docs/release-2.33.0.md
new file mode 100644
index 0000000..bd46e2b
--- /dev/null
+++ b/docs/release-2.33.0.md
@@ -0,0 +1,33 @@
+# Preparación de Tasklane 2.33.0
+
+**Estado: validación en curso; aún no publicar.** Esta preparación no ejecuta ninguna subida
+ni modifica credenciales de Marketplace.
+
+## Contenido
+
+- Atajo global opcional y desactivado por defecto; ajustes propios de combinación y proyecto.
+- Integraciones Windows/macOS/X11 y portal Wayland compatible, con estado de disponibilidad.
+- Versión `2.33.0` sincronizada entre Gradle, changelog y notas del descriptor generado.
+- Manual, guía del atajo, descripción de Marketplace y documentación de desarrollo actualizados.
+- Sin migración del formato de tareas. La configuración global es local y no se sincroniza.
+
+## Comprobaciones
+
+- Pruebas previas de la funcionalidad: 34 aprobadas.
+- Suite previa: 1.108 pruebas, 1.087 aprobadas, 21 omitidas, sin fallos ni errores.
+- Build anterior: comprobación local, no sustituye el build de release de esta versión.
+- Build de release, opciones de búsqueda y Plugin Verifier: en curso.
+- Verificación independiente de concurrencia y recursos nativos: en curso.
+- Pruebas reales con el IDE en segundo plano en Windows, macOS, X11 y Wayland: pendientes.
+
+## Artefacto previsto
+
+`build/distributions/tasklane-2.33.0.zip`. Se registrarán aquí el hash y los resultados
+observados cuando terminen las validaciones. No se considera válida una comprobación de
+un ZIP anterior o construido antes de una corrección.
+
+## Límites de publicación
+
+La firma, si se utiliza, requiere las credenciales existentes del autor. No se generan ni
+buscan claves privadas durante esta preparación. La aprobación final de Marketplace y la
+subida del paquete son acciones separadas.
diff --git a/docs/roadmap.md b/docs/roadmap.md
index 193aa3f..28ec64e 100644
--- a/docs/roadmap.md
+++ b/docs/roadmap.md
@@ -16,6 +16,12 @@ Cada iteración elegida sale como **versión media** (ver la regla de versiones
---
+## Preparada para publicación
+
+- **2.33.0 · Atajo global configurable de Quick Add.** Implementado para Windows, macOS,
+ X11 y escritorios Wayland con portal compatible. La publicación y la validación real por
+ escritorio se registran por separado en [el informe de release](release-2.33.0.md).
+
## Hechas
Propuestas de revisiones anteriores que se eligieron:
diff --git a/gradle.properties b/gradle.properties
index e600d85..268c0a0 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -183,7 +183,7 @@ pluginName = Tasklane
# en la tarjeta, aire en el codigo y boton de copiar en los bloques. Sin cambio de formato.
#
# Al subirla hay que tocar tambien changeNotes (build.gradle.kts) y CHANGELOG.md.
-pluginVersion = 2.32.0
+pluginVersion = 2.33.0
# Decision de docs/architecture.html §14, revisada el 2026-09-15: el suelo pasa de
# 252 (2025.2) a la build 261.27258.48, que es IntelliJ IDEA 2026.1.5. Se fija la build
diff --git a/odd/tasks/global-quick-add.md b/odd/tasks/global-quick-add.md
index 8f22c8b..08fa310 100644
--- a/odd/tasks/global-quick-add.md
+++ b/odd/tasks/global-quick-add.md
@@ -8,12 +8,16 @@ Branch: codex/global-quick-add. Delivery: ask-on-risk (no publishing). Runner: .
- S3: "que funcione en todos los sistemas" Target Windows, macOS, Linux X11 and supported Wayland portals. The user accepted the explicit Wayland exception: "si, dale metele" in response to desktop-dependent support and visible unavailable status when support is absent. No keyboard surveillance or permission bypass.
- S4: Verification must distinguish deterministic policy/lifecycle tests from real desktop integration. Real foreground behavior requires installed IDE testing on each target desktop; unsupported desktops remain explicitly unavailable.
+- S5: "papa, sube version y haz todo para poder subir a marketplace" Prepare version 2.33.0, release notes/changelog/docs, full release ZIP and compatibility validation. No publishing authorized.
+
## Tasks
- T1 [S1,S2]: inline — implementation and deterministic tests passed; native UI validation pending; no commit.
- T2 [S3,S4]: delegated — Windows/macOS implementations and 9 mock/ABI tests passed; desktop checks pending; no commit.
- T3 [S3,S4]: delegated — XCB and real D-Bus portal implementations and 15 tests passed; desktop checks pending; no commit.
- T4 [S1–S4]: inline coordination / delegated long checks and independent verification — docs, integration tests, build and review; pending; Risk items 4 (async lifecycle), 5 (native dependencies), 6 (foreground behavior requires real desktops).
+- T5 [S5]: inline metadata/docs; delegated long release checks; pending.
+
## Log
- L1: "hay alguna forma de hacer que desde cualquier lugar no solo dentro del ide e incluso si el ide no esta enfocado que se pueda abrir el dialog de agregar todo?"
- L2: "vamos a revisar a fondo la posiblidad y a hacer esto configurable por completo, pero si, hazlo"
@@ -30,3 +34,6 @@ Branch: codex/global-quick-add. Delivery: ask-on-risk (no publishing). Runner: .
- L12: Controller coalescing RED reproduced 5 dialogs queued instead of 1; generation-tagged pending delivery fixed it. Canonical focused GREEN: 34 tests, zero failures/errors/skips. Full suite XML: 1,108 tests, zero failures/errors, 21 skipped (1,087 passed). Build worker completed but quota interrupted its final report; parent reran exact cached SDK test/buildPlugin command, exit 0, BUILD SUCCESSFUL (up-to-date). Cached SDK 2026.1.5 path override plus --no-configuration-cache avoids initial Gradle stall. Local SDK mode skips searchable-options generation by existing build policy.
- L13: Package build/distributions/tasklane-2.32.0.zip exists (version unchanged from pre-existing edits). New runtime libraries dbus core/native-unixsocket 5.2.0 and slf4j-api2.0.17; JNA not packaged, provided by IDE. Native installed-IDE validation remains pending on macOS/Windows/X11/Wayland; don't claim end-to-end proof.
- L14: Independent verifier still required for Risk 4/5/6. gpt-6.1-sol quota reached in build worker, so request user authorization for gpt-6-astra verifier rather than skip it. Native assess returned high/unassessable because untracked inventory must be declared; no review START or approval. Need isolate our candidate from pre-existing dirty changes and choose chain strategy before commits. No commits/push/PR. Native/Linux standalone scratch directories cleaned; logs /tmp/tasklane-global-final-check.log and /tmp/tasklane-global-baseline.log retained.
+
+- L15: "papa, sube version y haz todo para poder subir a marketplace". Found clean worktree at externally created commit 7bdf516 (message feat: version 2.33.0, actual pluginVersion still2.32.0). Preserve that commit; prepare metadata2.33.0 on top. All earlier dirty work is now part of HEAD. No history rewriting.
+- L16: Independent verification found two release blockers: controller generation check/CAS race dropping the first new activation (JDI reproduced), and X11 active-grab diversion of unrelated keys while trigger held (source/protocol). One correction batch added synchronized claimDelivery and XCB synchronous keyboard grab with immediate checked active ungrab and configured-key repeat sampling. Linux fake regression observed RED→GREEN,15 tests pass. Independent targeted recheck cleared both at their original evidence levels; native desktop proof remains pending. Release2.33.0 full build/Verifier running; no publication.
diff --git a/src/main/kotlin/com/tasklane/globalquickadd/GlobalQuickAddController.kt b/src/main/kotlin/com/tasklane/globalquickadd/GlobalQuickAddController.kt
index 5cdc728..e512165 100644
--- a/src/main/kotlin/com/tasklane/globalquickadd/GlobalQuickAddController.kt
+++ b/src/main/kotlin/com/tasklane/globalquickadd/GlobalQuickAddController.kt
@@ -30,7 +30,7 @@ internal class GlobalQuickAddController(
if (shortcut == null || disposed) return@execute
shortcut.validate()
val handle = backend().register(shortcut) { token ->
- if (!disposed && version == generation.get() && pendingDelivery.compareAndSet(0, version)) {
+ if (claimDelivery(version)) {
delivery.execute {
try {
if (!disposed && version == generation.get()) activated(token)
@@ -53,6 +53,11 @@ internal class GlobalQuickAddController(
}
}
+ // Configuration and acquisition share the same monitor. A stale callback must not
+ // claim the newly reset pending slot between its generation check and its CAS.
+ @Synchronized private fun claimDelivery(version: Long): Boolean =
+ !disposed && version == generation.get() && pendingDelivery.compareAndSet(0, version)
+
@Synchronized override fun close() {
if (disposed) return
disposed = true
diff --git a/src/main/kotlin/com/tasklane/globalquickadd/X11HotkeyBackend.kt b/src/main/kotlin/com/tasklane/globalquickadd/X11HotkeyBackend.kt
index aefb548..fb75d67 100644
--- a/src/main/kotlin/com/tasklane/globalquickadd/X11HotkeyBackend.kt
+++ b/src/main/kotlin/com/tasklane/globalquickadd/X11HotkeyBackend.kt
@@ -96,7 +96,7 @@ private object NativeX11DriverFactory : X11DriverFactory {
}
}
-private interface Xcb : Library {
+internal interface Xcb : Library {
fun xcb_connect(display: String, screen: Pointer?): Pointer
fun xcb_disconnect(connection: Pointer)
fun xcb_connection_has_error(connection: Pointer): Int
@@ -108,6 +108,9 @@ private interface Xcb : Library {
fun xcb_get_modifier_mapping(connection: Pointer): XcbCookie
fun xcb_get_modifier_mapping_reply(connection: Pointer, cookie: XcbCookie, error: Pointer?): Pointer?
fun xcb_grab_key_checked(connection: Pointer, ownerEvents: Byte, window: Int, modifiers: Short, key: Byte, pointerMode: Byte, keyboardMode: Byte): XcbCookie
+ fun xcb_ungrab_keyboard_checked(connection: Pointer, time: Int): XcbCookie
+ fun xcb_query_keymap(connection: Pointer): XcbCookie
+ fun xcb_query_keymap_reply(connection: Pointer, cookie: XcbCookie, error: Pointer?): Pointer?
fun xcb_request_check(connection: Pointer, cookie: XcbCookie): Pointer?
fun xcb_poll_for_event(connection: Pointer): Pointer?
}
@@ -126,8 +129,8 @@ internal open class XcbScreenIterator : Structure() {
class ByValue : XcbScreenIterator(), Structure.ByValue
}
-private class NativeX11Driver(private val xcb: Xcb, private val connection: Pointer) : X11Driver {
- private val presses = X11KeyPressFilter()
+internal class NativeX11Driver(private val xcb: Xcb, private val connection: Pointer) : X11Driver {
+ private var held = false
private var keycode = 0
override fun grab(shortcut: GlobalShortcut) {
@@ -167,7 +170,11 @@ private class NativeX11Driver(private val xcb: Xcb, private val connection: Poin
while (roots.remaining > 0) {
val root = checkNotNull(roots.data).getInt(0)
for (mask in masks) {
- val cookie = xcb.xcb_grab_key_checked(connection, 0, root, mask.toShort(), keycode.toByte(), 1, 1)
+ // SYNC queues subsequent keys on the server until we release the active grab.
+ val cookie = xcb.xcb_grab_key_checked(
+ connection, 0, root, mask.toShort(), keycode.toByte(),
+ GRAB_MODE_ASYNC, GRAB_MODE_SYNC,
+ )
val error = xcb.xcb_request_check(connection, cookie).owned { it.getByte(1).unsigned() }
when (error) {
null -> Unit
@@ -183,23 +190,49 @@ private class NativeX11Driver(private val xcb: Xcb, private val connection: Poin
override fun pollActivation(): Boolean? {
checkConnection()
- return xcb.xcb_poll_for_event(connection).owned { event ->
+ val event = xcb.xcb_poll_for_event(connection)
+ if (event == null) {
+ if (held) held = isShortcutKeyDown()
+ return null
+ }
+ return event.owned {
// Ignore synthetic events and never process any key other than the configured one.
val type = event.getByte(0).unsigned()
// MappingNotify contains the request kind after response_type, pad and sequence.
if (type == 34 && event.getByte(4).unsigned() < 2) {
throw GlobalHotkeyUnavailable("The X11 keyboard mapping changed. Reapply the global shortcut.")
}
- if ((type != 2 && type != 3) || event.getByte(1).unsigned() != keycode) return@owned false
- presses.accept(pressed = type == 2, time = event.getInt(4))
+ if (type != 2 || event.getByte(1).unsigned() != keycode) return@owned false
+
+ // This releases only the active keyboard grab, not the configured passive grabs.
+ // Ungrab before any callback (even on repeat) so unrelated keys go to the focused app.
+ val ungrab = xcb.xcb_ungrab_keyboard_checked(connection, event.getInt(4))
+ val error = xcb.xcb_request_check(connection, ungrab).owned { it.getByte(1).unsigned() }
+ if (error != null) throw GlobalHotkeyUnavailable("The X11 server could not release the active shortcut grab.")
+ checkConnection()
+ val activated = !held
+ held = true
+ activated
}
}
+ private fun isShortcutKeyDown(): Boolean =
+ xcb.xcb_query_keymap_reply(connection, xcb.xcb_query_keymap(connection), null).owned { reply ->
+ // QueryKeymap returns 32 bytes from offset 8. Inspect only the configured key's bit.
+ val slot = reply.getByte(8L + keycode / 8).unsigned()
+ slot and (1 shl (keycode % 8)) != 0
+ } ?: throw GlobalHotkeyUnavailable("Could not read the X11 shortcut key state.")
+
private fun checkConnection() {
if (xcb.xcb_connection_has_error(connection) != 0) throw IllegalStateException("X11 connection lost")
}
- override fun close() = xcb.xcb_disconnect(connection) // Also releases every successful partial grab.
+ override fun close() = xcb.xcb_disconnect(connection) // Releases active and passive grabs, including partial setup.
+
+ private companion object {
+ const val GRAB_MODE_SYNC: Byte = 0
+ const val GRAB_MODE_ASYNC: Byte = 1
+ }
}
private fun Byte.unsigned() = toInt() and 0xff
@@ -235,21 +268,3 @@ internal fun x11GrabMasks(shortcut: GlobalShortcut, modifiers: List>):
} else masks
}
}
-
-/** Core X11 auto-repeat is reported as a same-timestamp release/press pair. */
-internal class X11KeyPressFilter {
- private var down = false
- private var releasedAt: Int? = null
-
- fun accept(pressed: Boolean, time: Int): Boolean {
- if (!pressed) {
- releasedAt = time
- down = false
- return false
- }
- val newPress = !down && releasedAt != time
- releasedAt = null
- down = true
- return newPress
- }
-}
diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml
index 4001663..07d8193 100644
--- a/src/main/resources/META-INF/plugin.xml
+++ b/src/main/resources/META-INF/plugin.xml
@@ -444,6 +444,16 @@
configuring every project, and a direct link to the Keymap.
+ Optional system-wide Quick Add
+ With the IDE running, a configurable system shortcut opens the same task dialog
+ while another application is focused. Enable it in Settings → Tools →
+ Tasklane Global Quick Add, choose the key combination and the last active or a
+ fixed open project. Settings are local to this installation; the IDE Keymap is unchanged.
+ Windows, macOS and X11 use registered shortcuts or passive grabs. Wayland requires
+ a supported Global Shortcuts portal; the desktop controls consent, the effective
+ binding and foreground focus. Conflicts and unavailable support are reported explicitly.
+ Disabled by default; no whole-keyboard monitoring.
+
From anywhere in the IDE
- Quick Add with
⌘⌥R / Ctrl+Alt+R opens
diff --git a/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddControllerTest.kt b/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddControllerTest.kt
index d6c60aa..45b3f15 100644
--- a/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddControllerTest.kt
+++ b/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddControllerTest.kt
@@ -87,4 +87,15 @@ class GlobalQuickAddControllerTest {
backend.callback!!(null); ui.drain()
assertEquals(2, calls)
}
+ @Test fun `stale callback cannot occupy the new generation delivery slot`() {
+ val worker = Queue(); val ui = Queue(); val backend = Backend(); val calls = mutableListOf()
+ val controller = GlobalQuickAddController(worker, { backend }, { calls += it }, ui)
+ controller.configure(shortcut); worker.drain()
+ val stale = backend.callback!!
+ controller.configure(shortcut.copy(key = "T")); worker.drain()
+ stale("old")
+ backend.callback!!("current")
+ ui.drain()
+ assertEquals(listOf("current"), calls)
+ }
}
diff --git a/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddLinuxTest.kt b/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddLinuxTest.kt
index 65549e3..b171ab4 100644
--- a/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddLinuxTest.kt
+++ b/src/test/kotlin/com/tasklane/globalquickadd/GlobalQuickAddLinuxTest.kt
@@ -1,5 +1,8 @@
package com.tasklane.globalquickadd
+import com.sun.jna.Memory
+import com.sun.jna.Native
+import com.sun.jna.Pointer
import org.freedesktop.dbus.DBusPath
import org.freedesktop.dbus.Marshalling
import org.freedesktop.dbus.types.UInt32
@@ -11,6 +14,7 @@ import org.junit.Assert.assertNull
import org.junit.Assert.assertThrows
import org.junit.Assert.assertTrue
import org.junit.Test
+import java.lang.reflect.Proxy
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
@@ -100,14 +104,32 @@ class GlobalQuickAddLinuxTest {
assertEquals(setOf(12, 14, 28, 30), x11GrabMasks(shortcut, symbols))
}
- @Test fun `X11 ignores key repeats but accepts the next physical press`() {
- val presses = X11KeyPressFilter()
- assertTrue(presses.accept(true, 1))
- assertFalse(presses.accept(true, 2))
- assertFalse(presses.accept(false, 3))
- assertFalse(presses.accept(true, 3))
- assertFalse(presses.accept(false, 4))
- assertTrue(presses.accept(true, 5))
+ @Test fun `X11 releases each active grab without taking other keys from the focused app`() {
+ FakeXcb().use { server ->
+ NativeX11Driver(server.api, Pointer(1)).use { driver ->
+ driver.grab(shortcut)
+ server.pressShortcut(100)
+ server.typeUnrelatedKey()
+ assertEquals(true, driver.pollActivation())
+ assertEquals(listOf(100), server.releasedAt)
+ assertEquals(1, server.foregroundKeyPresses)
+ assertNull(driver.pollActivation())
+
+ server.pressShortcut(200) // An auto-repeat can activate another passive grab.
+ assertEquals(false, driver.pollActivation())
+ assertEquals(listOf(100, 200), server.releasedAt)
+
+ server.releaseShortcut()
+ assertNull(driver.pollActivation())
+ assertNull(driver.pollActivation())
+ assertEquals(2, server.keymapReads) // No keyboard polling while the shortcut is idle.
+
+ server.pressShortcut(300)
+ assertEquals(true, driver.pollActivation())
+ assertEquals(listOf(100, 200, 300), server.releasedAt)
+ }
+ assertEquals(1, server.disconnects)
+ }
}
@Test fun `portal wire types match the published D-Bus interface`() {
@@ -182,6 +204,92 @@ class GlobalQuickAddLinuxTest {
private fun waylandOver(bus: PortalBus) =
WaylandHotkeyBackend("wayland-0", GlobalShortcutsPortalFactory { DbusGlobalShortcutsPortal(bus, timeoutMillis = 10) })
+ /** Models X11's sync freeze and the active grab's routing, without a real server. */
+ private class FakeXcb : AutoCloseable {
+ private val setup = Memory(40).apply { setByte(34, 20); setByte(35, 22) }
+ private val root = Memory(4).apply { setInt(0, 42) }
+ private val events = ArrayDeque>()
+ private var keyboardMode: Byte? = null
+ private var active = false
+ private var held = false
+ private var queued = 0
+ val releasedAt = mutableListOf()
+ var foregroundKeyPresses = 0
+ var keymapReads = 0
+ var disconnects = 0
+
+ val api = Proxy.newProxyInstance(Xcb::class.java.classLoader, arrayOf(Xcb::class.java)) { _, method, args ->
+ when (method.name) {
+ "xcb_get_setup" -> setup
+ "xcb_get_keyboard_mapping", "xcb_get_modifier_mapping" -> XcbCookie()
+ "xcb_get_keyboard_mapping_reply" -> reply(44) {
+ setByte(1, 1)
+ setInt(32, 'k'.code)
+ setInt(36, 0xffe3)
+ setInt(40, 0xffe9)
+ }
+ "xcb_get_modifier_mapping_reply" -> reply(40) {
+ setByte(1, 1)
+ setByte(34, 21)
+ setByte(35, 22)
+ }
+ "xcb_setup_roots_iterator" -> XcbScreenIterator.ByValue().apply {
+ data = root
+ remaining = 1
+ write()
+ }
+ "xcb_screen_next" -> { (args[0] as Pointer).setInt(Native.POINTER_SIZE.toLong(), 0); null }
+ "xcb_grab_key_checked" -> {
+ assertEquals(1.toByte(), args[5]) // Pointer stays asynchronous.
+ keyboardMode = args[6] as Byte
+ XcbCookie()
+ }
+ "xcb_request_check" -> null
+ "xcb_connection_has_error" -> 0
+ "xcb_poll_for_event" -> events.removeFirstOrNull()?.let { (key, time) ->
+ reply(32) { setByte(0, 2); setByte(1, key.toByte()); setInt(4, time) }
+ }
+ "xcb_ungrab_keyboard_checked" -> {
+ assertTrue(active)
+ active = false
+ releasedAt += args[1] as Int
+ foregroundKeyPresses += queued
+ queued = 0
+ XcbCookie()
+ }
+ "xcb_query_keymap" -> { keymapReads++; XcbCookie() }
+ "xcb_query_keymap_reply" -> reply(40) {
+ setByte(10, if (held) 0b00010000 else 0) // keycode 20 is bit 4 of keys[2].
+ }
+ "xcb_disconnect" -> { disconnects++; null }
+ else -> error("Unexpected XCB call: ${method.name}")
+ }
+ } as Xcb
+
+ fun pressShortcut(time: Int) {
+ assertFalse(active)
+ assertEquals(0.toByte(), keyboardMode)
+ active = true
+ held = true
+ events += 20 to time
+ }
+
+ fun typeUnrelatedKey() {
+ when {
+ !active -> foregroundKeyPresses++
+ keyboardMode == 0.toByte() -> queued++
+ else -> events += 30 to 150
+ }
+ }
+
+ fun releaseShortcut() { held = false }
+
+ private fun reply(size: Long, fill: Pointer.() -> Unit) =
+ Pointer(Native.malloc(size)).apply { clear(size); fill() }
+
+ override fun close() { setup.close(); root.close() }
+ }
+
private class FakeX11Driver(private val failGrab: Boolean = false) : X11Driver {
var closed = 0
var pollThread: Thread? = null