winfocus

package
v1.45.13 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2026 License: GPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

ABOUTME: Windows click-to-focus support — encodes the terminal window to raise ABOUTME: into a toast protocol-activation URI, decoded when the notification is clicked.

Index

Constants

View Source
const ProtocolScheme = "claude-notify-focus"

ProtocolScheme is the custom URI scheme registered under HKCU. Clicking a Windows toast with protocol activation relaunches the binary's focus-windows subcommand with a "claude-notify-focus:<payload>" argument.

Variables

This section is empty.

Functions

func EnsureRegistered

func EnsureRegistered() error

EnsureRegistered is a no-op on non-Windows platforms.

func Focus

func Focus(ctx FocusContext) error

Focus is a no-op on non-Windows platforms.

func HideConsole

func HideConsole()

HideConsole is a no-op on non-Windows platforms.

Types

type FocusContext

type FocusContext struct {
	HWND    int64  `json:"h,omitempty"` // top-level window handle captured at notify time
	PID     uint32 `json:"p,omitempty"` // owning process id (validates HWND against handle reuse)
	Title   string `json:"t,omitempty"` // window title at notify time (fallback match)
	Folder  string `json:"f,omitempty"` // project folder name (fallback match)
	WarpURL string `json:"u,omitempty"` // Warp session deep link ($WARP_FOCUS_URL)
}

FocusContext captures everything needed to re-find and raise the terminal window that triggered a notification. It is encoded into the toast's activation argument at notify time and decoded when the user clicks the toast. JSON keys are kept short because the whole struct rides inside a URI.

func CaptureFocusContext

func CaptureFocusContext(cwd string) (FocusContext, bool)

CaptureFocusContext is a no-op on non-Windows platforms.

func DecodeURI

func DecodeURI(uri string) (FocusContext, error)

DecodeURI parses a URI produced by EncodeURI. It tolerates the scheme prefix in any case, an optional "//" authority separator, and trailing slashes or whitespace that the shell may append when launching a protocol handler.

func (FocusContext) EncodeURI

func (c FocusContext) EncodeURI() string

EncodeURI renders the context as "claude-notify-focus:<base64url-json>". RawURLEncoding keeps the payload free of '/', '+' and '=' so it survives both the URI and the registry "%1" command-line substitution unescaped.

func (FocusContext) HasTarget

func (c FocusContext) HasTarget() bool

HasTarget reports whether the context carries any usable focus hint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL