histview

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2026 License: GPL-3.0 Imports: 12 Imported by: 0 modules, 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 histview holds what the history window shows, apart from GTK: time labels, search, highlighting, and the i3blocks block's seen list.

Index

Constants

View Source
const Delayed = time.Minute

Delayed is how much later than sent a message must arrive before the window shows both times.

Variables

This section is empty.

Functions

func Body

func Body(e histfile.Entry) string

func Channel

func Channel(e histfile.Entry) string

Channel is e's channel label, or "" for the default channel.

func Channels

func Channels(entries []histfile.Entry) []string

Channels lists the channel labels in entries, sorted, once each.

func Duration

func Duration(d time.Duration) string

Duration renders d coarsely: "2 h 28 min", "3 d 4 h", "45 s".

func Escape

func Escape(s string) string

Escape makes s safe inside Pango markup.

func Highlight

func Highlight(text, query string) string

Highlight returns text as Pango markup with every match of query (ignoring case) emphasised. Everything else is escaped, so the result shows text literally.

func Matches

func Matches(e histfile.Entry, query, channel string) bool

Matches reports whether e is on channel ("" for any) and holds query (ignoring case) in its title, body or channel.

func Preview

func Preview(e histfile.Entry, maxRunes int) string

Preview is the body on one line, cut to about maxRunes.

func ReadSeen

func ReadSeen(path string) (map[string]bool, error)

ReadSeen returns the IDs in the seen file; a missing file holds none.

func SeenPath

func SeenPath() (string, error)

SeenPath is where the i3blocks block reads which messages the window has listed: $SEEN, or bar-seen in $XDG_STATE_HOME/notifier, as the block expects.

func Timing

func Timing(e histfile.Entry) string

Timing describes when e was received, and when it was sent if it arrived noticeably later.

func Title

func Title(e histfile.Entry) string

Title and Body are e's text made safe to show: senders choose it, so control and format characters are replaced.

func When

func When(t, now time.Time) string

When labels a received time for the list: the time today, "Yesterday 15:04", the weekday within a week, else the date.

func WriteSeen

func WriteSeen(path string, seen map[string]bool, entries []histfile.Entry) error

WriteSeen records the seen IDs that are still in entries, one per line, so the file does not outgrow the history.

Types

This section is empty.

Jump to

Keyboard shortcuts

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