notifyui

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: MIT Imports: 15 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const ActionsPerRow = 3

ActionsPerRow is how many action buttons share a row (MAX_PER_ROW).

View Source
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

AppKey groups notifications by the name they show under.

func AppLabel added in v0.3.3

func AppLabel(appName string) string

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

func BodyMarkup(body string) string

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

func IsFileIcon(icon Icon) bool

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

func NewIcon(icon Icon, size int, tint render.Color) *widget.Icon

NewIcon builds the widget for a resolved icon at size pixels: a file image, or a theme icon tinted when its name is symbolic.

func TimeLabel

func TimeLabel(age Age, domain string) string

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

type Age struct {
	Minutes int64 // set below an hour
	Hours   int64 // set from an hour
}

Age is RelativeTime: under a minute is just now, under an hour is whole minutes, else whole hours.

func RelativeTime

func RelativeTime(now, ts time.Time) Age

RelativeTime is relative_time from ts to now.

func (Age) JustNow

func (a Age) JustNow() bool

JustNow reports the under-a-minute case.

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

type Icon struct {
	Name string
	File string
}

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

type TokenMinter interface {
	RequestActivationToken(done func(token string, err error))
}

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.

Jump to

Keyboard shortcuts

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