beetlebug

ztk::recent

Adds a file to the recent documents of the system, or empties the list of the app.

Synopsis

ztk::recent add PATH
ztk::recent clear

Arguments

Name Type Default Meaning
add PATH subcommand Puts the file at PATH in the recent documents of the system and in the jump list of the app. PATH is a path of the host.
clear subcommand Empties the list of recent documents of the app.

The system keeps the list. The command keeps no state.

Return value

An empty string.

Errors

Error When
this platform has no list of recent documents The backend has no list. Test ztk::has recent first.
ztk::recent add needs the file commands with the real paths of the host The file commands are off, or they use the jail of --root.
the system did not add "PATH" to the recent documents The system rejected the path.
wrong # args: should be "ztk::recent add path" add with no path, or more than one.
bad option "X": must be add or clear An unknown subcommand.

Platforms

Platform Works
Windows Yes: the recent documents of the shell and the jump list of the app.
macOS No
Linux, Wayland No
Linux, X11 No
Web No
iOS, Android No
Headless Yes: the backend keeps the paths, with no window of the system.

Example

if {[ztk::has recent]} {
    set f [open notes.txt w]; puts $f hello; close $f
    ztk::recent add [file normalize notes.txt]
    ztk::recent clear
}

See also