diff --git a/README.md b/README.md index 3716b37..e6c2032 100644 --- a/README.md +++ b/README.md @@ -77,6 +77,20 @@ changes the running reader, and saved choices survive restart and can be set per application. Older capitalization styles are imported into the corresponding beep or “cap” checkbox. +## Read the current window title + +Press **Cthulhu+Numpad Enter** in the desktop keyboard layout, or +**Cthulhu+Slash** in the laptop layout, to read the current window title. +In a browser this normally includes the active page title. The command also +flashes the title on Braille when flash messages are enabled. It works with +automatic title announcements disabled and can repeat the same title without +moving focus or the browser reading position. + +These bindings match Orca's title command. Plain **Numpad Enter** on desktop +and **Cthulhu+Enter** on laptop retain their Where Am I behavior. Repeated title +commands read the title again; a double press does not read the status bar. +See [window title checks](tests/window_titles.md) for verification. + ## Browser button updates Web buttons announce their current label when focused. Automatic label changes diff --git a/internal/app/event_loop.go b/internal/app/event_loop.go index 8616b3b..339dc7b 100644 --- a/internal/app/event_loop.go +++ b/internal/app/event_loop.go @@ -322,6 +322,9 @@ func processEventsWithAttributes( speak(event) case command := <-reviewRequests: switch command { + case input.PresentWindowTitle: + syncForeground() + titles.present() case input.PresentCellFormula: reviewHandler.presentCellFormula() case input.SetColumnHeadersRow, input.ClearColumnHeadersRow, input.SetRowHeadersColumn, input.ClearRowHeadersColumn: diff --git a/internal/app/learn_mode.go b/internal/app/learn_mode.go index 83e0b8e..891eca9 100644 --- a/internal/app/learn_mode.go +++ b/internal/app/learn_mode.go @@ -174,6 +174,8 @@ func learnCommandDescription(command input.Command) string { return "Choose an application and open its preferences." case input.WhereAmI: return "Speak details of the current item." + case input.PresentWindowTitle: + return "Read the current window title." case input.PresentCellFormula: return "Present the formula for the current cell." case input.PresentCharacterAttributes: diff --git a/internal/app/runtime_commands.go b/internal/app/runtime_commands.go index fa71e82..4d94025 100644 --- a/internal/app/runtime_commands.go +++ b/internal/app/runtime_commands.go @@ -229,9 +229,11 @@ func (worker commandRuntime) run(ctx context.Context) error { if onNotificationList != nil { onNotificationList() } - case input.WhereAmI, input.PresentCellFormula, input.SetColumnHeadersRow, input.ClearColumnHeadersRow, input.SetRowHeadersColumn, input.ClearRowHeadersColumn: + case input.WhereAmI, input.PresentWindowTitle, input.PresentCellFormula, input.SetColumnHeadersRow, input.ClearColumnHeadersRow, input.SetRowHeadersColumn, input.ClearRowHeadersColumn: if command == input.WhereAmI { logger.Info("where am I command received") + } else if command == input.PresentWindowTitle { + logger.Info("window title command received") } else if command == input.PresentCellFormula { logger.Info("cell formula command received") } else { diff --git a/internal/app/runtime_commands_test.go b/internal/app/runtime_commands_test.go index 8e6e41a..f542c46 100644 --- a/internal/app/runtime_commands_test.go +++ b/internal/app/runtime_commands_test.go @@ -47,7 +47,7 @@ func TestCommandRuntimeRoutesFocusPresentationRequests(t *testing.T) { t.Error("command worker did not stop") } }() - for _, command := range []input.Command{input.WhereAmI, input.PresentCellFormula, input.SetColumnHeadersRow, input.ClearColumnHeadersRow, input.SetRowHeadersColumn, input.ClearRowHeadersColumn} { + for _, command := range []input.Command{input.WhereAmI, input.PresentWindowTitle, input.PresentCellFormula, input.SetColumnHeadersRow, input.ClearColumnHeadersRow, input.SetRowHeadersColumn, input.ClearRowHeadersColumn} { commands.commands <- input.CommandEvent{Command: command} select { case got := <-requests: diff --git a/internal/app/window_title_command_test.go b/internal/app/window_title_command_test.go new file mode 100644 index 0000000..48bbfbf --- /dev/null +++ b/internal/app/window_title_command_test.go @@ -0,0 +1,164 @@ +// Copyright (c) 2026 Storm Dragon +// SPDX-License-Identifier: GPL-3.0-or-later + +package app + +import ( + "context" + "log/slog" + "testing" + "time" + + "git.stormux.org/storm/cthulhu/internal/atspi" + "git.stormux.org/storm/cthulhu/internal/config" + "git.stormux.org/storm/cthulhu/internal/input" + "git.stormux.org/storm/cthulhu/internal/platform/xorg" +) + +func TestPresentWindowTitleRepeatsDespiteAutomaticPolicy(t *testing.T) { + titles, queue, changed := titleControllerFixture(t) + settings := titles.live.Load() + settings.Reading.AutomaticallyReadTitleChanges = false + titles.live.Store(settings) + changed.Source.Name = "Current page - Browser" + titles.accessible(changed) + titles.lastTitle = changed.Source.Name + for range 2 { + titles.present() + } + if len(queue.requests) != 2 || queue.interruptions != 2 || titles.pending != nil { + t.Fatalf("explicit titles = %+v; interruptions %d; pending %+v", queue.requests, queue.interruptions, titles.pending) + } + for _, request := range queue.requests { + if request.Text != changed.Source.Name || request.Cause != "present-window-title" || request.Role != "system" || + request.Append || request.BypassFocusGate || request.Window != titles.state.owner.window { + t.Fatalf("explicit request = %+v", request) + } + } + titles.flush() + if len(queue.requests) != 2 { + t.Fatal("a pending automatic title repeated the explicit request") + } +} + +func TestPresentWindowTitleForegroundSources(t *testing.T) { + for _, name := range []string{"native", "wine-child", "accessible", "stale-epoch", "wrong-window", "missing"} { + t.Run(name, func(t *testing.T) { + titles, queue, _ := titleControllerFixture(t) + titles.state.owner.title = "Accessible title" + titles.state.foregroundState = atspi.ForegroundState{Epoch: 2, Client: xorg.Foreground{Known: true, Window: 10}} + source := &titleProbeSource{title: atspi.ForegroundTitle{Epoch: 2, Title: xorg.WindowTitle{Window: 10, TitleWindow: 10, Title: "Native title"}}} + titles.source = source + want := "Native title" + switch name { + case "wine-child": + source.title.Title.TitleWindow = 11 + titles.state.owner.clear() + case "accessible": + titles.source = nil + want = "Accessible title" + case "stale-epoch": + source.title.Epoch-- + titles.state.owner.clear() + want = "Could not find current window title." + case "wrong-window": + source.title.Title.Window = 20 + titles.state.owner.clear() + want = "Could not find current window title." + case "missing": + source.title.Title.Title = " " + titles.state.owner.clear() + want = "Could not find current window title." + } + titles.present() + if len(queue.requests) != 1 || queue.requests[0].Text != want { + t.Fatalf("title = %+v, want %q", queue.requests, want) + } + }) + } +} + +func TestPresentWindowTitleFlashesOnBraille(t *testing.T) { + titles, speech, _ := titleControllerFixture(t) + display := &flashRecorder{} + titles.speech = outputQueue{speech: speech, braille: display, live: titles.live} + titles.present() + if len(display.messages) != 1 || display.messages[0] != "Original" { + t.Fatalf("title Braille = %v", display.messages) + } +} + +func TestPresentWindowTitleRespectsLockHandoffAndForegroundChange(t *testing.T) { + for _, name := range []string{"locked", "suspended", "foreground-changed"} { + t.Run(name, func(t *testing.T) { + titles, queue, _ := titleControllerFixture(t) + titles.gate = &focusGate{} + switch name { + case "locked": + titles.gate.secure.Store(true) + case "suspended": + titles.gate.suspended.Store(true) + case "foreground-changed": + titles.foreground = &titleProbeSource{title: atspi.ForegroundTitle{Epoch: 1}} + } + titles.present() + if len(queue.requests) != 0 || queue.interruptions != 0 { + t.Fatalf("unexpected title during %s: %+v", name, queue.requests) + } + }) + } +} + +func TestProcessEventsPresentWindowTitlePreservesFocus(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + speech := &fakeSpeechQueue{spoken: make(chan string, 8)} + adapter := &fakeAdapter{events: make(chan atspi.Event)} + requests := make(chan input.Command) + live := &liveSettings{} + settings := config.DefaultSettings() + settings.Reading.AutomaticallyReadTitleChanges = false + live.Store(settings) + done := make(chan error, 1) + go func() { + done <- processEventsWithSettings(ctx, slog.New(slog.DiscardHandler), speech, adapter, requests, nil, 0, live) + }() + t.Cleanup(func() { + cancel() + select { + case err := <-done: + if err != nil { + t.Error(err) + } + case <-time.After(time.Second): + t.Error("event loop did not stop") + } + }) + wait := func(want string) { + t.Helper() + select { + case got := <-speech.spoken: + if got != want { + t.Fatalf("speech = %q, want %q", got, want) + } + case <-time.After(time.Second): + t.Fatalf("missing speech %q", want) + } + } + activation := ownerEvent(atspi.WindowActivatedEvent, ":1.50", "/window", "/window") + activation.Source.Name, activation.Source.Role = "Page title", "frame" + adapter.events <- activation + wait("Page title, frame") + focus := ownerEvent(atspi.FocusEvent, ":1.50", "/window", "/button") + focus.Source.Name, focus.Source.Role, focus.Source.Focused = "Next post", "button", true + adapter.events <- focus + wait("Next post, button") + changed := activation + changed.Type, changed.Source.Name = atspi.AccessibleNameEvent, "Updated page title" + adapter.events <- changed + for range 2 { + requests <- input.PresentWindowTitle + wait("Updated page title") + } + requests <- input.WhereAmI + wait("Next post, button") +} diff --git a/internal/app/window_titles.go b/internal/app/window_titles.go index 528c396..72f86dc 100644 --- a/internal/app/window_titles.go +++ b/internal/app/window_titles.go @@ -214,6 +214,39 @@ func (titles *windowTitleController) enabled() bool { return titles.live == nil || titles.live.Load().Reading.AutomaticallyReadTitleChanges } +// Explicit requests bypass automatic-title preferences and duplicate suppression. +// Read copied foreground metadata only; never block the event loop on native I/O +// or move either the browser cursor or object focus. +func (titles *windowTitleController) present() { + if titles.gate.Locked() || titles.gate.Suspended() { + return + } + foreground := titles.state.foregroundState + if titles.foreground != nil && titles.foreground.Foreground().Epoch != foreground.Epoch { + return + } + titles.clearPending() + window := titles.state.owner.window + text := "" + if titles.source != nil { + latest := titles.source.ForegroundTitle() + if latest.Epoch == foreground.Epoch && latest.Title.Window != 0 && latest.Title.Window == foreground.Client.Window { + text = strings.TrimSpace(latest.Title.Title) + } + } + if text == "" && window.Valid() { + text = strings.TrimSpace(titles.state.owner.title) + } + if text == "" { + text = "Could not find current window title." + } else { + titles.lastTitle = text + } + titles.speech.Interrupt() + titles.speech.Enqueue(speechRequest{Text: text, Role: "system", Cause: "present-window-title", + Window: window, ExcludeFromHistory: titles.state.historyWindow.Valid() && window == titles.state.historyWindow}) +} + // repeats_focused_edit recognizes titles whose only changed portion mirrors // the owned entry. Use copied focus and input evidence, never application names // or field labels. Window introductions and unrelated status changes still speak. diff --git a/internal/app/window_titles_native_test.go b/internal/app/window_titles_native_test.go index ada31bc..027a683 100644 --- a/internal/app/window_titles_native_test.go +++ b/internal/app/window_titles_native_test.go @@ -15,6 +15,7 @@ import ( "time" "git.stormux.org/storm/cthulhu/internal/atspi" + "git.stormux.org/storm/cthulhu/internal/config" "git.stormux.org/storm/cthulhu/internal/input" "git.stormux.org/storm/cthulhu/internal/platform/xorg" ) @@ -54,6 +55,9 @@ func TestNativeAutomaticTitleDispatchLatency(t *testing.T) { } defer listener.Stop(context.Background()) queue := &fakeSpeechQueue{spoken: make(chan string, 8)} + live := &liveSettings{} + live.Store(config.DefaultSettings()) + requests := make(chan input.Command, 1) inputDone := make(chan struct{}) go func() { defer close(inputDone) @@ -62,7 +66,7 @@ func TestNativeAutomaticTitleDispatchLatency(t *testing.T) { defer func() { cancel(); <-inputDone }() completed := make(chan error, 1) go func() { - completed <- processEventsWithInput(ctx, slog.New(slog.DiscardHandler), queue, adapter, nil, nil, 0, nil, listener, nil, nil) + completed <- processEventsWithInput(ctx, slog.New(slog.DiscardHandler), queue, adapter, requests, nil, 0, live, listener, nil, nil) }() defer func() { cancel() @@ -122,4 +126,32 @@ func TestNativeAutomaticTitleDispatchLatency(t *testing.T) { t.Fatalf("duplicate window title: %q", got) case <-time.After(2 * windowTitleIntroductionDelay): } + + // Exercise the actual desktop chord through command dispatch and the event + // loop, with automatic title changes disabled and no new focus event. + settings := live.Load() + settings.Reading.AutomaticallyReadTitleChanges = false + live.Store(settings) + commands := xorg.NewCommands([]string{"Insert"}, input.DesktopKeyboardLayout) + if err = commands.Start(ctx); err != nil { + t.Fatal(err) + } + defer commands.Stop(context.Background()) + commandDone := make(chan error, 1) + go func() { + commandDone <- (commandRuntime{logger: slog.New(slog.DiscardHandler), commands: commands, + reviewRequests: requests, stopRun: cancel}).run(ctx) + }() + defer func() { + cancel() + if err := <-commandDone; err != nil { + t.Error(err) + } + }() + for range 2 { + if out, err := exec.CommandContext(ctx, "xdotool", "key", "--clearmodifiers", "Insert+KP_Enter").CombinedOutput(); err != nil { + t.Fatalf("title keys: %v %s", err, out) + } + wait("Status three", time.After(time.Second)) + } } diff --git a/internal/input/bindings.go b/internal/input/bindings.go index e3133ec..073e2f8 100644 --- a/internal/input/bindings.go +++ b/internal/input/bindings.go @@ -56,6 +56,8 @@ func CommandLabel(command Command) string { return "List " + strings.ToLower(binding.Title) } switch command { + case PresentWindowTitle: + return "Read the current window title" case PresentCellFormula: return "Present the formula for the current cell" case SetColumnHeadersRow: diff --git a/internal/input/commands.go b/internal/input/commands.go index 7700268..3a0bcb6 100644 --- a/internal/input/commands.go +++ b/internal/input/commands.go @@ -113,6 +113,7 @@ const ( SetRowHeadersColumn Command = "set-row-headers-column" ClearRowHeadersColumn Command = "clear-row-headers-column" WhereAmI Command = "where-am-i" + PresentWindowTitle Command = "present-window-title" PresentCharacterAttributes Command = "present-character-attributes" PresentLastNotification Command = "present-last-notification" PresentPreviousNotification Command = "present-previous-notification" @@ -233,6 +234,7 @@ func DefaultCommandBindings(layout KeyboardLayout) CommandBindings { bindings[CommandChord{Symbol: 'o', CthulhuModifier: true}] = OCRWindow bindings[CommandChord{Symbol: 0xffab}] = ReadAll // KP_Add bindings[CommandChord{Symbol: keypadEnterKeySymbol}] = WhereAmI + bindings[CommandChord{Symbol: keypadEnterKeySymbol, CthulhuModifier: true}] = PresentWindowTitle bindings[CommandChord{Symbol: '=', CthulhuModifier: true}] = PresentCellFormula bindings[CommandChord{Symbol: 0xff95, CthulhuModifier: true}] = ReviewWindowStart bindings[CommandChord{Symbol: 0xff9a, CthulhuModifier: true}] = ReviewWindowEnd @@ -244,6 +246,7 @@ func DefaultCommandBindings(layout KeyboardLayout) CommandBindings { bindings[CommandChord{Symbol: 'u', Modifiers: 1, CthulhuModifier: true}] = CycleProgressBarOutput bindings[CommandChord{Symbol: ';', CthulhuModifier: true}] = ReadAll bindings[CommandChord{Symbol: returnKeySymbol, CthulhuModifier: true}] = WhereAmI + bindings[CommandChord{Symbol: '/', CthulhuModifier: true}] = PresentWindowTitle bindings[CommandChord{Symbol: 'u', Modifiers: controlModifier, CthulhuModifier: true}] = ReviewWindowStart bindings[CommandChord{Symbol: 'o', Modifiers: controlModifier, CthulhuModifier: true}] = ReviewWindowEnd bindings[CommandChord{Symbol: 'j', Modifiers: controlModifier, CthulhuModifier: true}] = ReviewWordAbove diff --git a/internal/input/window_title_test.go b/internal/input/window_title_test.go new file mode 100644 index 0000000..22d24a6 --- /dev/null +++ b/internal/input/window_title_test.go @@ -0,0 +1,42 @@ +package input + +import "testing" + +func TestWindowTitleBindings(t *testing.T) { + for _, layout := range []KeyboardLayout{DesktopKeyboardLayout, LaptopKeyboardLayout} { + for _, modifierFirst := range []bool{false, true} { + symbol, code := keypadEnterKeySymbol, uint16(104) + if layout == LaptopKeyboardLayout { + symbol, code = '/', 61 + } + bindings, err := ResolveCommandBindings(layout, true, nil) + if err != nil { + t.Fatal(err) + } + router := NewCommandRouter([]uint32{0xff63}, bindings) + router.Handle(0xff63, 118, 0, true) + if consumed, command := router.Handle(symbol, code, 0, true); !consumed || command != PresentWindowTitle { + t.Fatalf("layout %v title press = %v %q", layout, consumed, command) + } + if consumed, command := router.Handle(symbol, code, 0, true); !consumed || command != "" { + t.Fatalf("title repeat = %v %q", consumed, command) + } + keys := []struct { + symbol uint32 + code uint16 + }{{symbol, code}, {0xff63, 118}} + if modifierFirst { + keys[0], keys[1] = keys[1], keys[0] + } + for _, key := range keys { + if consumed, command := router.Handle(key.symbol, key.code, 0, false); !consumed || command != "" { + t.Fatalf("title release = %v %q", consumed, command) + } + } + // The command remains available through the preferences binding editor. + if err := ValidateBindingOverrides([]BindingOverride{{Layout: layout, Scope: "global", Command: PresentWindowTitle, Keys: []string{"Cthulhu+Ctrl+t"}}}); err != nil { + t.Fatal(err) + } + } + } +} diff --git a/internal/platform/xorg/listener_native_test.go b/internal/platform/xorg/listener_native_test.go index f468c3b..f951ce5 100644 --- a/internal/platform/xorg/listener_native_test.go +++ b/internal/platform/xorg/listener_native_test.go @@ -713,6 +713,7 @@ func TestNativeDispatchBeforeRelease(t *testing.T) { if layout == input.DesktopKeyboardLayout { cases = append(cases, bindingCase{[]string{"KP_Add"}, input.ReadAll}, bindingCase{[]string{"Insert", "equal"}, input.PresentCellFormula}) cases = append(cases, bindingCase{[]string{"KP_Enter"}, input.WhereAmI}, bindingCase{[]string{"KP_Up"}, input.ReviewCurrentLine}) + cases = append(cases, bindingCase{[]string{"Insert", "KP_Enter"}, input.PresentWindowTitle}) cases = append(cases, bindingCase{[]string{"KP_Down"}, input.ReviewCurrentCharacter}, bindingCase{[]string{"KP_Down"}, input.ReviewPhoneticCharacter}, @@ -722,6 +723,7 @@ func TestNativeDispatchBeforeRelease(t *testing.T) { } else { cases = append(cases, bindingCase{[]string{"Insert", "semicolon"}, input.ReadAll}) cases = append(cases, bindingCase{[]string{"Insert", "Return"}, input.WhereAmI}, bindingCase{[]string{"Insert", "i"}, input.ReviewCurrentLine}) + cases = append(cases, bindingCase{[]string{"Insert", "slash"}, input.PresentWindowTitle}) cases = append(cases, bindingCase{[]string{"Insert", "comma"}, input.ReviewCurrentCharacter}, bindingCase{[]string{"Insert", "comma"}, input.ReviewPhoneticCharacter}, diff --git a/internal/version/version.go b/internal/version/version.go index 7f19832..82bdd76 100644 --- a/internal/version/version.go +++ b/internal/version/version.go @@ -21,7 +21,7 @@ import "strings" const Name = "Cthulhu" -const Version = "2026.10.16" +const Version = "2026.10.17" const Channel = "master" var Build = Version diff --git a/testdata/parity-ledger.csv b/testdata/parity-ledger.csv index 4388808..0ef0cb6 100644 --- a/testdata/parity-ledger.csv +++ b/testdata/parity-ledger.csv @@ -62,3 +62,4 @@ web-structural-lists,Orca src/orca/structural_navigator.py; src/orca/structural_ mozilla-leaf-text-reading,Orca src/orca/scripts/web/script_utilities.py,web,Read native heading and link text leaves in Firefox and Thunderbird,,internal/atspi tests/native_mozilla.py,in-progress,python3 tests/native_firefox.py; CTHULHU_BINARY=/tmp/cthulhu-mozilla-review /usr/bin/python3 tests/native_mozilla.py; go test -race ./internal/atspi ./internal/review ./internal/presentation ./internal/app -count=1 -timeout=120s,Private Firefox 158.0 and Thunderbird 158.0 sessions each cover 17 navigation commands and Read All with zero native caret synchronization errors.,,Recorded SSIP includes both headings and the link in forward/reverse reading and Read All; audible listening pending.,Shared Chromium selection and routing checks passed; physical Mozilla Braille acceptance pending.,Shared document text metrics now include heading and link roles. Native Firefox metadata assertion failed before the fix. See docs/testing/mozilla-reading.md. Thunderbird folders message lists and composition remain outside this reading baseline. thunderbird-local-mail-composition,Orca src/orca/scripts/apps/Thunderbird/script.py;src/orca/script_utilities.py,application,Navigate local folders and message tabs; select messages; compose replies and forwards; save and add attachments,,internal/atspi internal/app tests/native_thunderbird.py,in-progress,go test -race ./internal/atspi ./internal/app ./internal/review ./internal/presentation -count=1 -timeout=120s; CTHULHU_BINARY=/tmp/cthulhu-mozilla-review /usr/bin/python3 tests/native_thunderbird.py,Private Thunderbird 158.0 HTML and plain-text local mailbox checks cover message-tab return; Subject and body editing; reply and reply-all recipients with Cc; inline forwarding; exact selected rows after Shift and Ctrl navigation; received attachment saving with content verification; and adding a local file to an unsent draft.,,SSIP verifies focus handoff and row roles; selection toggling; Subject and body echo; reply and forward editing; attachment menus and picker return; audible acceptance pending.,Event-loop regression checks paragraph cursor and routing metadata; physical display acceptance pending.,Foreground replacement requires a registered application and fresh complete window membership. Editable paragraph events belong only to their focused editable document. Title echoes require owned editable focus and recent editing plus unchanged title prefix/suffix; unrelated status titles still announce. See docs/testing/thunderbird-workflows.md; no sending remote mailbox or page-load-option acceptance claimed. flatpak-foreground-identity,src/cthulhu/script_utilities.py:canBeActiveWindow,focus,Correlate Flatpak accessibility providers with the X11 foreground across PID namespaces and D-Bus proxies,,internal/platform/xorg internal/atspi,in-progress,go test -race ./internal/platform/xorg ./internal/atspi ./internal/app -count=1; CTHULHU_FOREGROUND_PID=1 python3 tests/native_atspi.py,Private XRes lookup and fallback; real proxy with matching and different synthetic instance metadata; GTK Qt and Brave ownership checks,,Actual Flatpak Steam speech pending,Physical Braille pending; original report also has helper geometry errors,docs/testing/flatpak-foreground.md; preserves active state geometry and sibling ownership checks; no application name exception +present-window-title,Orca src/orca/where_am_i_presenter.py;src/orca/where_am_i_presenter_command_definitions.py,command,Read the foreground window title with Cthulhu+Numpad Enter on desktop or Cthulhu+Slash on laptop,,internal/input internal/app internal/platform/xorg,in-progress,go test ./internal/input ./internal/app ./internal/platform/xorg -count=1; focused title command race checks; python3 tests/check_speech.py,Private Xvfb command dispatch verifies both layout bindings and both release orders. Private X11 and AT-SPI event loop repeats the current title with automatic changes disabled.,,Speech queue assertions passed; physical keyboard and audible acceptance pending.,Braille flash queue assertion passed; physical display acceptance pending.,Reuses copied foreground title metadata and the owned accessible title. Explicit requests bypass automatic-title policy and duplicate suppression without moving focus. Stale native epochs and unrelated native windows cannot supply a title. Lock and terminal handoff remain enforced. Double-press status-bar reading is outside this change. See tests/window_titles.md. diff --git a/tests/window_titles.md b/tests/window_titles.md index 2a38ab7..426d1d1 100644 --- a/tests/window_titles.md +++ b/tests/window_titles.md @@ -27,6 +27,28 @@ keeps the pending title and that later review revisions do not repeat it. Unit tests cover both arrival orders, Wine desktop children, returning to the same window, native application preferences, and XTerm handoff. +## Read the title on demand + +The desktop command is **Cthulhu+Numpad Enter**; the laptop command is +**Cthulhu+Slash**. Both use the existing copied foreground title metadata, +with the owned accessible window title available when native title metadata +is unavailable. The command reports when no title is available, respects +screen locking and terminal handoff, and does not move focus or the browse +cursor. Automatic title preferences and duplicate suppression do not prevent +an explicit request. Repeated presses repeat the title; status-bar reading +is not implemented. + +```sh +go test ./internal/input ./internal/app -run 'WindowTitle|WhereAmI|CommandRuntimeRoutesFocusPresentationRequests' -count=1 +xvfb-run -a env CTHULHU_NATIVE_X11=1 go test ./internal/platform/xorg -run '^TestNativeDispatchBeforeRelease$' -count=1 -v +``` + +The native automatic-title fixture above also checks the desktop title chord +through actual X11 command dispatch and the event loop with automatic changes +disabled. The native command test checks desktop and laptop bindings on press +with both release orders. Event-loop tests check changed titles and preserved +Where Am I focus; a queue test checks Braille flash delivery. + For live acceptance, use a rebuilt reader after arranging any active reader replacement with its user. Review and listening are required before submission. @@ -49,6 +71,16 @@ replacement with its user. Review and listening are required before submission. speaks once. The editing fixture's F8 key changes its title to "Cthulhu Browser Probe updated". Check address suggestions, deletion, and native caret movement still announce their usual output. +8. Use Cthulhu+Numpad Enter on desktop or Cthulhu+Slash on laptop in a native + application, a browser page and a Wine application. Confirm the foreground + title is spoken, including an active dialog. Repeat after switching tabs + and windows and after disabling automatic title changes. Repeating the + command should repeat the title. Check the Braille flash if enabled. +9. Navigate to a browser heading, read the title, then continue heading and + arrow navigation in both directions. The reading position must remain + intact. Plain Numpad Enter on desktop or Cthulhu+Enter on laptop should + still describe the focused item. Check learn mode describes the title + command, and confirm its binding can be changed in Preferences. Automated queue assertions do not establish physical Alt+Tab, audible speech, installed-binary behavior, or physical Braille acceptance.