Skip to content

Conversation

@oluijks
Copy link

@oluijks oluijks commented Nov 18, 2025

This is a follow-up to #2818, implementing the unfocused cursor style
configuration in the way suggested in the review there.

Behaviour

  • Adds a new config key: cursor-style-unfocused
  • Type: terminal.CursorStyle
  • Default: block_hollow, which preserves the current behaviour for
    unfocused windows
  • When the window is not focused, the cursor is always visible and uses
    the configured cursor-style-unfocused.
  • When the window is focused, behaviour is unchanged: the cursor style
    still follows cursor-style, DECSCUSR, shell integration, etc.

This aims to be the simplest possible version of the feature: no extra
runtime controls, and no optional/unset semantics yet (as discussed in
the review of #2818).

Implementation

This follows the previous review feedback from #2818:

  • Adds cursor-style-unfocused to Config.zig with default
    block_hollow.
  • Extends renderer.Renderer.DerivedConfig with
    cursor_style_unfocused: terminal.CursorStyle and initializes it from
    config.@"cursor-style-unfocused".
  • Updates renderer.cursorStyle / cursor.style to take the unfocused
    style as a parameter instead of reading from terminal state, and uses
    it when focused == false.

The unfocused cursor style is treated purely as a renderer
configuration detail, as requested in the earlier review.

Tests

  • Manual testing: verified the cursor uses cursor-style-unfocused when
    the window is unfocused.
  • No automated test added; I didn't see an obvious existing test to
    extend for this specific renderer behaviour, but I can add one if
    desired.

References: #2818

AI Assistance Disclosure: Used ChatGPT to navigate the codebase and better understand where I could find what I wanted to change and or add. I also used ChatGPT to write the description of this PR. I wrote the code myself. I also build it locally to test if my changes produced what expected. I added this disclaimer later because of course I didn't read the contributing guide.

Expose a new terminal config option `cursor-style-unfocused` to control
the cursor style when the window is not focused.

- Add `cursor-style-unfocused` to Config with default `block_hollow`,
  preserving the existing behaviour for unfocused windows.
- Extend renderer.Renderer.DerivedConfig with `cursor_style_unfocused`
  and initialize it from the config.
- Update renderer cursor.style() to take the unfocused style as a
  parameter and use it instead of the hard-coded block_hollow.
@oluijks oluijks requested a review from a team as a code owner November 18, 2025 12:30
@mitchellh
Copy link
Contributor

Is this undisclosed AI usage?

@oluijks
Copy link
Author

oluijks commented Nov 18, 2025

Is this undisclosed AI usage?

You are right I should have disclosed this.

I did use ChatGPT as an assistant for this mainly to help me write the pr description because I wanted it to be the best English.

I did wrote the Zig changes myself because the 'weird' looking cursor when out of focus was the first thing I noticed when I installed ghostty and I found issue 2818.

I added an "AI Assistance Disclosure" section to the PR description and I will make sure to include this up front on any future contributions.

Sign up for free to 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.

2 participants