Skip to main content

Module file_picker

Module file_picker 

Expand description

File-picker dialog widget: the system file chooser, which the shell shows for the FileChooser portal and for an app’s path request, and any “open / save file from app menu” flow. It draws and hit-tests itself; the host positions it as a modal sheet and drains FilePicker::take_outcome.

Choosing a file gives the asking app that file, so the sheet says who is asking: the app’s icon and name with what it wants (“TOTP wants to open a file”) or the app’s own purpose (“Choose a QR code image”) (FilePicker::with_requester). The primary button stays the outcome (Open, Save, Choose folder).

Top to bottom: who is asking; a toolbar with Up, the location and the search field; the places sidebar beside the file list; a filename field in Save mode, the type filter (only when the app named more than one type) and Cancel and the primary button.

  • The location is a path bar: the shared Breadcrumb trail from the place it is in (“Home › Projects”), each ancestor a click away. A click on the trail’s empty space, or Ctrl+L, turns it into a field to type a path into; Enter goes there, Escape puts the trail back.
  • The sidebar leads with Recent (what was chosen here before, when the host says what that is) and then Home, the usual folders under it and every other place the person can reach.
  • The file list is the desktop’s one list of files (crate::widget::file_table::FileTable), the same one the file manager shows. Directory click navigates in file modes and selects in directory mode; double-click navigates or chooses; Ctrl/Shift multi-select when enabled.
  • Typing searches. The shared SearchField narrows the folder in view as the person types (“3 of 40”); Enter searches every place the person can reach through the system search the host hands in (FilePicker::with_search). Typing while the list has the keyboard types into the search field. The same search is the picker’s search operation (semantic::PickerOperation::Search), for the keyboard and for agents.

Keyboard: Tab moves between the controls, Up/Down move the selection, Enter opens/enters, Backspace goes to the parent, Escape cancels (or clears the search first).

Constructed with “accessible roots” — the paths the caller may be given. FilePicker::can_navigate_to gates every path mutation against them so the person can’t .. out of them, and every chosen path is checked against their real paths again before it is answered.

Modules§

semantic
Typed operations on the same scoped picker used by pointer and AT input.

Structs§

FileFilter
A named file-type filter. An empty extensions list matches every file (the conventional “All files” entry).
FilePicker
FilePickerEntry
Requester
The app that asked for the chooser, as the sheet names it: choosing a file gives it to this app.

Enums§

FilePickerMode
Open picks existing files; Save adds a filename field whose contents resolve to current_dir/<name>; Directory picks existing folders.
FilePickerOutcome
Drained by the host via FilePicker::take_outcome once per frame; None means “user hasn’t decided yet”. The terminal variants resolve the host’s oneshot::Sender<Option<Vec<PathBuf>>>.

Constants§

SEARCH_LIMIT
Most rows a search across places shows.

Type Aliases§

PickerSearch
The system search the host hands the picker: the paths matching a query among the places the person can reach. The picker calls it on a worker thread, never on the UI thread, shows only what its roots allow, and checks a chosen one again before answering.