Documentation
¶
Index ¶
- Constants
- func FindFocusHelper(_ ...string) (string, error)
- func FocusActivationArguments(pid int, protocols ...string) string
- func ParseFocusActivation(uri string) (pid int, hwnd uintptr, logPath string, err error)
- func PrepareFocusActivationVerbose(pid int, _ string, _ ...string) (FocusActivation, FocusDiag, error)
- func Push(message string, opts ...NotificationOption) error
- func RegisterFocusProtocol(_ string, _ ...string) error
- func SelectHostWindow(chain []AncestorWindows) (hwnd uintptr, pid uint32, reason string)
- type Action
- type AncestorWindows
- type Audio
- type FocusActivation
- type FocusDiag
- type NotificationOption
- type WindowInfo
Constants ¶
const (
// DefaultFocusProtocol is the protocol used by the bundled focus helper.
DefaultFocusProtocol = "anfocus"
)
Variables ¶
This section is empty.
Functions ¶
func FindFocusHelper ¶
FindFocusHelper is only supported on Windows.
func FocusActivationArguments ¶
FocusActivationArguments formats the URI passed to WithActivationArguments.
func ParseFocusActivation ¶ added in v0.4.0
ParseFocusActivation 解析 helper 收到的激活 URI。 未识别的 hwnd/base64 一律降级为零值/空串,绝不报错阻断聚焦。
func PrepareFocusActivationVerbose ¶ added in v0.4.0
func PrepareFocusActivationVerbose(pid int, _ string, _ ...string) (FocusActivation, FocusDiag, error)
PrepareFocusActivationVerbose is only supported on Windows.
func Push ¶
func Push(message string, opts ...NotificationOption) error
func RegisterFocusProtocol ¶
RegisterFocusProtocol is only supported on Windows.
func SelectHostWindow ¶ added in v0.4.0
func SelectHostWindow(chain []AncestorWindows) (hwnd uintptr, pid uint32, reason string)
SelectHostWindow 从祖先链中挑选宿主终端窗口。 P0 语义(行为保持):按 chain 顺序取第一个"可见 + 无 owner + 有标题"的窗口。 返回选中的 HWND(无则 0)、其所属 PID、以及人类可读的原因。
Types ¶
type Action ¶ added in v0.4.0
Action defines an actionable button on a notification.
Only protocol-type action buttons are useful, as there's no way to receive feedback from the user's choice. Example:
Action{"protocol", "Open Maps", "bingmaps:?q=sushi"}
type AncestorWindows ¶ added in v0.4.0
type AncestorWindows struct {
PID uint32
PPID uint32
Exe string
Windows []WindowInfo
}
AncestorWindows 归组一个祖先进程及其拥有的顶层窗口。
type FocusActivation ¶
FocusActivation describes the protocol activation data used to focus the source window when a Windows toast is clicked.
func FocusActivationForWindow ¶ added in v0.5.0
FocusActivationForWindow is only supported on Windows.
func PrepareFocusActivation ¶
func PrepareFocusActivation(_ int, _ ...string) (FocusActivation, error)
PrepareFocusActivation is only supported on Windows.
type FocusDiag ¶ added in v0.4.0
type FocusDiag struct {
StartPID uint32
Chain []AncestorWindows
SelectedHWND uintptr
SelectedPID uint32
Reason string
}
FocusDiag 记录一次 send(或 click 重走)的完整解析,用于可观测。
type NotificationOption ¶
type NotificationOption func(*notification)
func WithAudio ¶
func WithAudio(audio Audio) NotificationOption
WithAudio
The audio to play when displaying the notification
func WithMessage ¶
func WithMessage(msg string) NotificationOption
WithMessage
The single/multi line message to display for the notification.
func WithTitle ¶
func WithTitle(title string) NotificationOption
WithTitle
The main title/heading for the notification.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
assets
|
|
|
_generate
command
Command generate renders the default "terminal" logo used as the Windows toast appLogoOverride image when a caller does not supply WithIcon.
|
Command generate renders the default "terminal" logo used as the Windows toast appLogoOverride image when a caller does not supply WithIcon. |
|
cmd
|
|
|
toast-focus
command
toast-focus sends a Windows toast notification whose click action focuses the terminal window that launched this process.
|
toast-focus sends a Windows toast notification whose click action focuses the terminal window that launched this process. |
|
toast-focus-helper
command
toast-focus-helper is launched by the anfocus: protocol.
|
toast-focus-helper is launched by the anfocus: protocol. |