Documentation
¶
Overview ¶
Package ghostcursor draws a transient overlay cursor for pointer actions. Animated moves follow a deterministic Bezier arc so drags read as motion instead of teleports.
Index ¶
- Variables
- func Configure(cfg Config)
- func DragTo(x, y int)
- func Enabled() bool
- func FlashCaptureRect(rect corefoundation.CGRect)
- func Hide()
- func HoverAt(x, y int)
- func OverlaySharingType() appkit.NSWindowSharingType
- func PressAt(x, y int)
- func ReleaseAt(x, y int)
- func RenderPNG(opts RenderOptions) ([]byte, error)
- type ActivityState
- type Config
- type Controller
- func (c *Controller) Close()
- func (c *Controller) Configure(cfg Config)
- func (c *Controller) Enabled() bool
- func (c *Controller) Hide()
- func (c *Controller) MoveTo(ctx context.Context, pos Position, opts MoveOptions) error
- func (c *Controller) SetActivity(activity ActivityState) error
- func (c *Controller) Show(pos Position, activity ActivityState, hideAfter time.Duration) error
- type CoordinateSpace
- type CurveStyle
- type EyecandyConfig
- type Info
- type MoveOptions
- type NextInteractionTiming
- type Position
- type RenderColor
- type RenderOptions
- type Theme
- type TuningConfig
Constants ¶
This section is empty.
Variables ¶
var ErrMoveAborted = errors.New("ghost cursor move aborted")
Functions ¶
func FlashCaptureRect ¶
func FlashCaptureRect(rect corefoundation.CGRect)
func OverlaySharingType ¶
func OverlaySharingType() appkit.NSWindowSharingType
func RenderPNG ¶
func RenderPNG(opts RenderOptions) ([]byte, error)
RenderPNG rasterizes the current cursor style to a PNG.
Types ¶
type ActivityState ¶
type ActivityState int
ActivityState describes the current visual state of the cursor.
const ( ActivityIdle ActivityState = iota ActivityMoving ActivityPressed ActivityDragging ActivityTyping ActivityThinking ActivityPaused )
type Config ¶
type Config struct {
Enabled bool
Eyecandy EyecandyConfig
Theme Theme
Tuning TuningConfig
}
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
func Default ¶
func Default() *Controller
func New ¶
func New(cfg Config) *Controller
New returns a controller that marshals all AppKit work to the main thread.
func (*Controller) Close ¶
func (c *Controller) Close()
Close releases AppKit and monitoring resources held by the controller.
func (*Controller) Configure ¶
func (c *Controller) Configure(cfg Config)
func (*Controller) Enabled ¶
func (c *Controller) Enabled() bool
func (*Controller) Hide ¶
func (c *Controller) Hide()
func (*Controller) MoveTo ¶
func (c *Controller) MoveTo(ctx context.Context, pos Position, opts MoveOptions) error
MoveTo blocks until the requested motion has completed or the next-interaction gate is satisfied. Callers may invoke it from any goroutine.
func (*Controller) SetActivity ¶
func (c *Controller) SetActivity(activity ActivityState) error
func (*Controller) Show ¶
func (c *Controller) Show(pos Position, activity ActivityState, hideAfter time.Duration) error
type CoordinateSpace ¶
type CoordinateSpace int
CoordinateSpace identifies how a position should be interpreted.
const ( CoordinateSpaceUnknown CoordinateSpace = iota CoordinateSpaceScreen )
type CurveStyle ¶
type CurveStyle int
CurveStyle controls how sampled motion progresses toward a target.
const ( // CurveBezier is the default. Its zero value keeps existing callers on the // curved path without additional configuration. CurveBezier CurveStyle = iota CurveEaseInOut CurveLinear )
type EyecandyConfig ¶
type EyecandyConfig struct {
SharingVisible bool
RippleOnClick bool
CometTrail bool
VelocityTilt bool
HolographicOCR bool
LiquidLens bool
}
func DefaultEyecandyConfig ¶
func DefaultEyecandyConfig() EyecandyConfig
type Info ¶
type Info struct {
Harness string
MatchName string
MatchPID int
PaletteID int
PaletteIndex int
DotColor string
BorderColor string
}
Info describes the detected harness and selected cursor colors.
func DetectInfo ¶
func DetectInfo() Info
DetectInfo reports the detected host harness and selected palette.
type MoveOptions ¶
type MoveOptions struct {
Duration time.Duration
Activity ActivityState
HideAfter time.Duration
CurveStyle CurveStyle
Strength float64
Jitter float64
NextInteraction NextInteractionTiming
}
MoveOptions controls a blocking cursor movement.
type NextInteractionTiming ¶
type NextInteractionTiming struct {
DistancePx float64
Progress float64
IdleVelocityPPS float64
Dwell time.Duration
MaxWait time.Duration
}
NextInteractionTiming controls when MoveTo may return before the animation fully completes so input can be issued once the cursor is close enough.
type Position ¶
type Position struct {
Space CoordinateSpace
DisplayID uint32
X float64
Y float64
}
Position identifies a cursor location in a specific coordinate space.
func SamplePath ¶
func SamplePath(start, end Position, opts MoveOptions) ([]Position, error)
SamplePath returns the screen-space keyframes for moving between start and end using the requested curve. The returned slice always contains the first and last point when the positions differ.
func ScreenPosition ¶
func TypingPositionForFrame ¶
type RenderColor ¶
RenderColor describes an sRGB color for offscreen cursor rendering.
type RenderOptions ¶
type RenderOptions struct {
Size int
Theme Theme
Activity ActivityState
Background RenderColor
DX float64
DY float64
Speed float64
}
RenderOptions controls offscreen cursor rendering.
type TuningConfig ¶
type TuningConfig struct {
Brightness float64
CursorScale float64
BodyOpacity float64
OutlineOpacity float64
GlowOpacity float64
GlowScale float64
IdleFadeDelay time.Duration
IdleFadeTime time.Duration
MoveGlowTime time.Duration
}
func DefaultTuningConfig ¶
func DefaultTuningConfig() TuningConfig