recent

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 9 Imported by: ? 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 recent keeps the app's list of recently opened documents.

The list lives in recent.json in the app's config directory (service/paths: Config(app ID)), newest first, at most Max entries. On macOS each Add is also reported to NSDocumentController, so the Dock menu's recent items follow it (macOS lists only document types the app declares in its Info.plist).

Pair it with App.OnOpenFiles to record what the OS asks the app to open:

app.OnOpenFiles(func(paths []string) {
	for _, p := range paths {
		open(p)
		recent.Add(app, p)
	}
})

Index

Constants

View Source
const Max = 10

Max is how many entries the list keeps.

Variables

This section is empty.

Functions

func Add

func Add(a *tango.App, path string) error

Add puts path at the top of the list (made absolute; a repeat moves up). Safe from any goroutine.

func Clear

func Clear(a *tango.App) error

Clear empties the list, and the system's on macOS.

func List

func List(a *tango.App) ([]string, error)

List returns the list, newest first, leaving out files that no longer exist.

func Remove

func Remove(a *tango.App, path string) error

Remove drops path from the list. The macOS list is not changed: AppKit has no call to remove one entry.

Types

This section is empty.

Jump to

Keyboard shortcuts

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