Documentation ¶
Overview ¶
launch_helper wraps lomiri_app_launch to enable using application helpers. The useful part is HelperRunner
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrCantFindHelper = errors.New("can't find helper") ErrCantFindLauncher = errors.New("can't find launcher for helper") )
var GetTempDir func(pkgName string) (string, error) = _getTempDir
override GetTempDir for testing without writing to ~/.cache/<pkgName>
var InputBufferSize = 10
Functions ¶
func DefaultLaunchers ¶
func DefaultLaunchers(log logger.Logger) map[string]HelperLauncher
DefaultLaunchers produces the default map for kind -> HelperLauncher
Types ¶
type Card ¶
type Card struct { Summary string `json:"summary"` // required for the card to be presented Body string `json:"body"` // defaults to empty Actions []string `json:"actions"` // if empty (default), bubble is non-clickable. More entries change it to be clickable and (for bubbles) snap-decisions. Icon string `json:"icon"` // an icon relating to the event being notified. Defaults to empty (no icon); a secondary icon relating to the application will be shown as well, irrespectively. RawTimestamp int `json:"timestamp"` // seconds since epoch, only used for persist (for now). Timestamp() returns this if non-zero, current timestamp otherwise. Persist bool `json:"persist"` // whether to show in notification centre; defaults to false Popup bool `json:"popup"` // whether to show in a bubble. Users can disable this, and can easily miss them, so don't rely on it exclusively. Defaults to false. }
a Card is the usual “visual” presentation of a notification, used for bubbles and the notification centre (neé messaging menu)
type EmblemCounter ¶
type EmblemCounter struct { Count int32 `json:"count"` // the number to show on the emblem counter Visible bool `json:"visible"` // whether to show the emblem counter }
an EmblemCounter puts a number on an emblem on an app's icon in the launcher
type HelperArgs ¶
type HelperInput ¶
type HelperInput struct { App *click.AppId NotificationId string Payload json.RawMessage // contains filtered or unexported fields }
HelperInput is what's passed in to a helper for it to work
type HelperLauncher ¶
type HelperOutput ¶
type HelperOutput struct { Message json.RawMessage `json:"message,omitempty"` // what to put in the post office's queue Notification *Notification `json:"notification,omitempty"` // what to present to the user }
HelperOutput is the expected output of a helper
type HelperPool ¶
type HelperPool interface { Run(kind string, input *HelperInput) Start() chan *HelperResult Stop() }
func NewHelperPool ¶
func NewHelperPool(launchers map[string]HelperLauncher, log logger.Logger) HelperPool
a HelperPool that delegates to different per kind HelperLaunchers
func NewTrivialHelperPool ¶
func NewTrivialHelperPool(log logger.Logger) HelperPool
a trivial HelperPool that doesn't launch anything at all
type HelperResult ¶
type HelperResult struct { HelperOutput Input *HelperInput }
HelperResult is the result of a helper run for a particular app id
type Notification ¶
type Notification struct { Card *Card `json:"card"` // defaults to nil (no card) RawSound json.RawMessage `json:"sound"` // a boolean, or the relative path to a sound file. Users can disable this, so don't rely on it exclusively. Defaults to empty (no sound). RawVibration json.RawMessage `json:"vibrate"` // users can disable this, blah blah. Can be Vibration, or boolean. Defaults to null (no vibration) EmblemCounter *EmblemCounter `json:"emblem-counter"` // puts a counter on an emblem in the launcher. Defaults to nil (no change to emblem counter). Tag string `json:"tag,omitempty"` // tag used for Clear/ListPersistent. }
a Notification can be any of the above
func (*Notification) Sound ¶
func (notification *Notification) Sound(fallback string) string
func (*Notification) Vibration ¶
func (notification *Notification) Vibration(fallback *Vibration) *Vibration
Directories ¶
Path | Synopsis |
---|---|
package legacy implements a HelperLauncher for “legacy” applications.
|
package legacy implements a HelperLauncher for “legacy” applications. |