Skip to content

custom shader: add cursor shape uniform #9416

@mitchellh

Description

@mitchellh

Expose Ghostty's cursor shape enum to shaders:

pub const Style = enum {
// Typical cursor input styles
block,
block_hollow,
bar,
underline,
// Special cursor styles
lock,

// Macros for a more semantic usage. Though this could just be differed to the documentation too.
#define CURSORSTYLE_BLOCK 0
#define CURSORSTYLE_BLOCK_HOLLOW 1
#define CURSORSTYLE_BAR 2
#define CURSORSTYLE_UNDERLINE 3

uniform int iCursorStyle;

Use case: Shaders can render contextually appropriate effects—for example, a full-cell glow for block cursors vs. a vertical beam glow for bar cursors, or a subtle underline ripple for underline cursors. I found that when I was making my shader, I just wanted to know what type of cursor I had so I could easily change the shape of it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyA well-scoped, approachable issue for someone looking to contribute.renderer

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions