Skip to content

feat: add focus tracking to hide cursor when terminal loses focus - #79

Closed
Schniz wants to merge 3 commits into
anomalyco:devfrom
Schniz:schniz/handle-focus-changes
Closed

feat: add focus tracking to hide cursor when terminal loses focus#79
Schniz wants to merge 3 commits into
anomalyco:devfrom
Schniz:schniz/handle-focus-changes

Conversation

@Schniz

Copy link
Copy Markdown
Contributor

Implement ANSI escape sequence-based focus tracking to reduce visual distraction when switching between terminal windows or panes. The cursor now automatically hides when the OpenCode terminal is not focused and reappears when returning to it.

Key changes:

  • Add focus tracking utilities using ANSI escape sequences (\x1b[?1004h/l)
  • Implement real-time focus monitoring with escape sequence detection
  • Control cursor visibility in textarea component using cursor.CursorHide/CursorBlink modes
  • Add FocusMsg for communicating focus changes between components
  • Set initial cursor state to blinking (default focused state)

The implementation uses standard ANSI escape sequences, making it compatible with most modern terminals and terminal multiplexers like tmux, screen, etc.

🤖 Generated with opencode
Co-Authored-By: opencode noreply@opencode.ai

adamdotdevinand others added 3 commits May 27, 2025 10:33
Implement ANSI escape sequence-based focus tracking to reduce visual distraction when switching between terminal windows or panes. The cursor now automatically hides when the OpenCode terminal is not focused and reappears when returning to it.
Key changes:
- Add focus tracking utilities using ANSI escape sequences (\x1b[?1004h/l)
- Implement real-time focus monitoring with escape sequence detection
- Control cursor visibility in textarea component using cursor.CursorHide/CursorBlink modes
- Add FocusMsg for communicating focus changes between components
- Set initial cursor state to blinking (default focused state)
The implementation uses standard ANSI escape sequences, making it compatible with most modern terminals and terminal multiplexers like tmux, screen, etc.
🤖 Generated with opencode
Co-Authored-By: opencode <noreply@opencode.ai>
Comment threadcmd/root.go
return "", false
}

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry about all of these, opencode and gofmt did that

Comment threadcmd/root.go
ch, cancelSubs := setupSubscriptions(app, ctx)

// Start focus tracking
focusTracker := util.NewFocusTracker(program)

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

considering asking it to avoid calling stuff "util" and just call it "focus" so focus.NewTracker

@thdxr

Copy link
Copy Markdown
Member

closing as we rewrote the codebase - appreciate it though!

@thdxrthdxr closed this Jun 14, 2025
toph420 pushed a commit to toph420/tophcode that referenced this pull request Dec 17, 2025
Co-authored-by: kcrommett <kcrommett@users.noreply.github.com>
toph420 pushed a commit to toph420/tophcode that referenced this pull request Dec 17, 2025
randomm referenced this pull request in randomm/opencode Jan 9, 2026
* fix: eliminate remory syntax confusion and consolidate memory files (#74)
- Consolidated memory-protocol-mandatory.md and remory-cli-reference.md into new memory-and-remory.md
- Fixed contradictions in research-specialist.txt prompt
- Updated configuration files to reference consolidated memory documentation
- Reduces duplication and improves clarity of remory syntax and memory protocols
* fix(#76): enforce git-agent scope boundaries to prevent code fixing
- Add explicit bash command denylist to both config files for critical operations
- Add hard-stop boundaries and VIOLATION DETECTION patterns to git-agent.txt
- Add PRE-ACTION CHECKS validation before every operation
- Enhance linting discovery to READ-ONLY operations only
- Add enhanced CI failure delegation protocol with mandatory specialist routing
These changes prevent git-agent from attempting to fix code issues, ensuring proper
delegation to specialized agents (rust-tdd-architect, python-best-practices, etc.)
* fix(#78): align Rollbar token variable name with system environment
Updated documentation to use ROLLBAR_TOKEN consistently throughout instructions/rollbar-mcp-integration.md,
matching the system environment variable and config files. This ensures clarity for users setting up
Rollbar MCP integration and prevents confusion with deprecated variable naming.
andreipromarketing-dev pushed a commit to andreipromarketing-dev/opencode that referenced this pull request Apr 7, 2026
Adds Shorthand Guide as .md - partially addresses anomalyco#23
bussard76 pushed a commit to bussard76/openwork that referenced this pull request May 12, 2026
mliotta added a commit to mliotta/opencode that referenced this pull request Aug 5, 2026
CAR keeps a single global memory graph: loadMemory merges into it and
persistMemory writes the whole graph to whatever filename it is given
(car-releases#79). Per-project filenames therefore never isolated anything.
They wrote one copy of the same union per project — which is why throwaway test
projects each produced ~1.2MB files holding ~280 facts they never created — and
implied a separation that does not exist.
Use a single opencode.json and say plainly, in both README and CAR.md, that CAR
memory is shared across every project on the machine and that facts learned in
one codebase can surface in another's context. Anyone working across codebases
where that matters should leave CAR disabled until anomalyco#79 gains a namespace.
This is an interim position, not the destination: a memory namespace on the CAR
side supersedes it.
mliotta added a commit to mliotta/opencode that referenced this pull request Aug 6, 2026
CarHost auto-updates via Sparkle and had already moved to 0.46.0, leaving
opencode's pinned 0.44.0 client older than the daemon it talks to — the reverse
of the skew the version rule exists to prevent. car-runtime is now excluded from
bunfig's minimumReleaseAge so the client can track a daemon that updates itself;
the tradeoff is accepted deliberately for this one package, which we publish.
Correlate delegated calls with GenerateRequest.client_ref (car-releases#78). The
UUID was previously smuggled through `prompt`, the only field surviving the
serde round-trip, which held only because delegated models ignore it. `prompt`
is still a required field, so it stays as an empty placeholder — the integration
suite caught that when it was dropped entirely.
Verified against a real 0.46.0 daemon rather than by inspection:
- client_ref is echoed verbatim into inference.runner.invoke, with prompt set to
a throwaway value to prove it is no longer load-bearing (anomalyco#78)
- completing with no preceding event yields exactly one invoke and preserves
RunnerResult.text; previously two invokes and an empty result (anomalyco#76)
- concurrent delegated calls no longer cross-talk (anomalyco#77)
- car-releases#75 is improved but open: 5066/5108/5289ms on 0.44.0 became
1879/4181/4251ms on 0.46.0 — a constant became variable seconds, so CAR stays
off by default
Not adopting per-project memory namespaces yet, despite 0.46.0 adding them.
Namespace memory is never written to disk: it is lost on daemon restart, and
memory.persist silently writes zero records while a namespace is bound
(car-releases#82). Since CarHost restarts on every update, binding one today
would trade the cross-project leakage of anomalyco#79 for silent data loss. Staying on
the shared graph, with the tradeoff documented, until that closes.
CAR integration suite: 11 pass against a live 0.46.0 daemon, and it now runs in
half the wall time. CAR off: 3231 pass, 1 fail — a load flake that passes 21/21
in isolation.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Schniz@thdxr@adamdotdevin@jpoz