Documentation
¶
Overview ¶
Package notifyui is what the notification popups and the bar's notification dropdown share (wayle-shell-core notification_icons.rs): icon resolution, urgency classes, relative times, and body text.
Index ¶
- Constants
- func AppKey(n *notifications.Notification) string
- func AppLabel(appName string) string
- func BodyMarkup(body string) string
- func IsFileIcon(icon Icon) bool
- func NewIcon(icon Icon, size int, tint render.Color, post func(func()), ready func()) *widget.Icon
- func TimeLabel(age Age, domain string) string
- func UrgencyBarVisible(u notifications.Urgency, threshold config.UrgencyBarThreshold) bool
- func UrgencyClass(u notifications.Urgency) string
- func VisibleActions(n *notifications.Notification) []notifications.Action
- func WithActivationToken(m TokenMinter, then func(token string))
- type Age
- type Group
- type Icon
- type TokenMinter
Constants ¶
const ActionsPerRow = 3
ActionsPerRow is how many action buttons share a row (MAX_PER_ROW).
const FallbackIcon = "ld-bell-symbolic"
FallbackIcon is the bell every unresolved notification shows.
Variables ¶
This section is empty.
Functions ¶
func AppKey ¶ added in v0.2.0
func AppKey(n *notifications.Notification) string
AppKey groups notifications by the name they show under.
func AppLabel ¶ added in v0.3.3
AppLabel is the name a notification goes by on screen. notify-send and the shell's own name say who delivered it, not what it is about, so those show as the system. Everything else is the app's own name.
func BodyMarkup ¶
BodyMarkup is the sanitized body (the Rust sanitize_markup): markup lys-ui's parser accepts passes through with its tags intact, anything else escapes to the literal characters.
func IsFileIcon ¶
IsFileIcon reports whether an icon draws as a picture rather than a recolored glyph (an image, or a theme name that is not -symbolic): the card's icon box takes the file-icon class for it.
func NewIcon ¶
NewIcon builds the widget for a resolved icon at size pixels: a file image, decoded off the loop with the generic glyph until post delivers it, or a theme icon tinted when its name is symbolic. ready runs once a file shows.
func TimeLabel ¶
TimeLabel is time_to_string / format_time_label in a surface's own strings: domain is "notification-popup" or "notification-dropdown", whose -time-just-now, -time-minutes-ago and -time-hours-ago messages it reads.
func UrgencyBarVisible ¶
func UrgencyBarVisible(u notifications.Urgency, threshold config.UrgencyBarThreshold) bool
UrgencyBarVisible is urgency_bar_visible.
func UrgencyClass ¶
func UrgencyClass(u notifications.Urgency) string
UrgencyClass is urgency_css_class.
func VisibleActions ¶
func VisibleActions(n *notifications.Notification) []notifications.Action
VisibleActions are the actions a card draws as buttons: all but the default one, which the card itself invokes on a click.
func WithActivationToken ¶
func WithActivationToken(m TokenMinter, then func(token string))
WithActivationToken mints a token for an action press and hands it to then, so the app the action reaches can raise its window: call it from the press's handler, whose input the token vouches for. then gets "" without a minter or xdg-activation on the compositor, and after a failed request, which logs.
Types ¶
type Age ¶
Age is RelativeTime: under a minute is just now, under an hour is whole minutes, else whole hours.
func RelativeTime ¶
RelativeTime is relative_time from ts to now.
type Group ¶ added in v0.2.0
type Group struct {
Key string
Notifs []*notifications.Notification
}
Group is notifications sharing a key, newest first.
func GroupBy ¶ added in v0.2.0
func GroupBy(notifs []*notifications.Notification, key func(*notifications.Notification) string) []Group
GroupBy is group_by_app over any key: one group per key, each newest first, the groups ordered by their newest notification; ties keep the order of notifs.
type Icon ¶
Icon is a resolved notification icon: a theme name or an image file (ResolvedIcon). Exactly one is set.
func ResolveIcon ¶
func ResolveIcon(source config.IconSource, n *notifications.Notification) Icon
ResolveIcon is resolve_icon: Mapped is the curated icon for the app name; Automatic prefers the image; Application prefers the image, then the app icon, then the desktop entry; each falls back to Mapped, and Mapped to the bell.
type TokenMinter ¶
TokenMinter mints xdg-activation tokens from the latest input: *app.Application.
func Minter ¶
func Minter(a *app.Application) TokenMinter
Minter is the application as a TokenMinter; nil (no minting) for a nil application.