Documentation
¶
Index ¶
- Constants
- func FindFocusHelper(_ ...string) (string, error)
- func FocusActivationArguments(pid int, protocols ...string) string
- func Push(message string, opts ...NotificationOption) error
- func RegisterFocusProtocol(_ string, _ ...string) error
- type Audio
- type FocusActivation
- type NotificationOption
- func WithAudio(audio Audio) NotificationOption
- func WithIcon(urlIcon string) NotificationOption
- func WithImage(urlImage string) NotificationOption
- func WithLang(lang string) NotificationOption
- func WithMessage(msg string) NotificationOption
- func WithNotificationID(tag string) NotificationOption
- func WithOnClick(fn func(event interface{})) NotificationOption
- func WithOnClose(fn func()) NotificationOption
- func WithOnError(fn func()) NotificationOption
- func WithOnShow(fn func()) NotificationOption
- func WithRenotify(b bool) NotificationOption
- func WithRequireInteraction(b bool) NotificationOption
- func WithSilent(b bool) NotificationOption
- func WithTextDirection(dir TextDirection) NotificationOption
- func WithTimestamp(t time.Time) NotificationOption
- func WithTitle(title string) NotificationOption
- func WithVibrate(v []int) NotificationOption
- type TextDirection
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 Push ¶
func Push(message string, opts ...NotificationOption) error
func RegisterFocusProtocol ¶
RegisterFocusProtocol is only supported on Windows.
Types ¶
type FocusActivation ¶
FocusActivation describes the protocol activation data used to focus the source window when a Windows toast is clicked.
func PrepareFocusActivation ¶
func PrepareFocusActivation(_ int, _ ...string) (FocusActivation, error)
PrepareFocusActivation is only supported on Windows.
type NotificationOption ¶
type NotificationOption func(*notification)
func WithAudio ¶
func WithAudio(audio Audio) NotificationOption
WithAudio
The audio to play when displaying the notification
func WithIcon ¶
func WithIcon(urlIcon string) NotificationOption
WithIcon
The URL of the image used as an icon of the notification
func WithImage ¶
func WithImage(urlImage string) NotificationOption
WithImage
The URL of an image to be displayed as part of the notification
func WithLang ¶
func WithLang(lang string) NotificationOption
WithLang
The language code of the notification
func WithMessage ¶
func WithMessage(msg string) NotificationOption
WithMessage
The single/multi line message to display for the notification.
func WithNotificationID ¶
func WithNotificationID(tag string) NotificationOption
WithNotificationID
The ID of the notification (if any)
func WithOnClick ¶
func WithOnClick(fn func(event interface{})) NotificationOption
WithOnClick
A handler for the click event. It is triggered each time the user clicks on the notification.
func WithOnClose ¶
func WithOnClose(fn func()) NotificationOption
WithOnClose
A handler for the close event. It is triggered when the user closes the notification.
func WithOnError ¶
func WithOnError(fn func()) NotificationOption
WithOnError
A handler for the error event. It is triggered each time the notification encounters an error.
func WithOnShow ¶
func WithOnShow(fn func()) NotificationOption
WithOnShow
A handler for the show event. It is triggered when the notification is displayed.
func WithRenotify ¶
func WithRenotify(b bool) NotificationOption
WithRenotify
Specifies whether the user should be notified after a new notification replaces an old one
func WithRequireInteraction ¶
func WithRequireInteraction(b bool) NotificationOption
WithRequireInteraction
indicating that a notification should remain active until the user clicks or dismisses it, rather than closing automatically.
func WithSilent ¶
func WithSilent(b bool) NotificationOption
WithSilent
Specifies whether the notification should be silent — i.e., no sounds or vibrations should be issued, regardless of the device settings.
func WithTextDirection ¶
func WithTextDirection(dir TextDirection) NotificationOption
WithTextDirection
The text direction of the notification
func WithTimestamp ¶
func WithTimestamp(t time.Time) NotificationOption
WithTimestamp
Specifies the time at which a notification is created or applicable (past, present, or future).
func WithTitle ¶
func WithTitle(title string) NotificationOption
WithTitle
The main title/heading for the notification.
func WithVibrate ¶
func WithVibrate(v []int) NotificationOption
WithVibrate
Specifies a vibration pattern for devices with vibration hardware to emit.
type TextDirection ¶
type TextDirection string
const ( // Auto adopts the browser's language setting behavior (the default.) Auto TextDirection = "auto" // LTR left to right LTR TextDirection = "ltr" // RTL right to left RTL TextDirection = "rtl" )
Directories
¶
| Path | Synopsis |
|---|---|
|
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. |