Documentation
¶
Overview ¶
Package recentfiles tracks recently used files in the XDG recently-used.xbel format (TOML-free, XML as the spec says), so lys-ui apps share the recents list with the desktop's other citizens. The manager keeps the list bounded, most-recent first, and writes atomically; a missing or corrupt file starts an empty list.
Load, Save, Add and Remove wait on the disk. An application drives a Manager through Post, which runs everything in order off the loop.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNoDataHome = errors.New("recentfiles: neither XDG_DATA_HOME nor HOME is an absolute path")
ErrNoDataHome is an environment that names no user data directory for the list to live in.
Functions ¶
Types ¶
type Entry ¶
Entry is one recently used file: its path (decoded from the file:// URI on disk), the owning application's name, and when it was last used.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager reads and writes one recents list. It is not safe for concurrent use: whoever posts to it touches it only through Post.
func New ¶
New returns the manager for the given xbel path (DefaultPath for the desktop's shared list).
func (*Manager) Add ¶
Add moves paths to the front of the list under app, the last one first, stamps them now, and persists once. Errors persisting are reported once here; a failed write never loses the in-memory list.
func (*Manager) Load ¶
Load reads the xbel file; a missing file is an empty list, a corrupt one is an empty list plus the error (the next Add rewrites it clean). Entries whose URIs are not local file:// paths are skipped.
func (*Manager) Post ¶ added in v0.2.5
Post queues work to run off the caller's goroutine, in order, and reports whether it was taken: a full or stopped queue refuses it.