Skip to main content
The cx global variable provides read-only access to the current application state.

Structure

Active Tab

cx.active provides information about the currently active tab.

cx.active.current

Current directory view.

Fields

  • cwd (Url) - Current working directory
  • hovered (File|nil) - Currently hovered file
  • files (File[]) - All files in directory
  • window (File[]) - Visible files in current view
  • offset (number) - Scroll offset
  • cursor (number) - Cursor position (0-based)

cx.active.preview

Preview pane state.

Fields

  • skip (number) - Preview scroll position
  • folder (Folder|nil) - Folder preview state (if previewing a folder)

Folder Fields

  • cwd (Url) - Folder URL
  • files (File[]) - Files in folder
  • window (File[]) - Visible files in preview
  • offset (number) - Scroll offset
  • cursor (number) - Cursor position

cx.active.selected

Map of selected files.

cx.active.pref

Tab preferences.

cx.active:history(url)

Get history entry for a URL.
Url
required
Directory URL
Folder|nil
Cached folder state, or nil

Tabs

cx.tabs is a list of all tabs with additional properties.

Tab Fields

Each tab has the same structure as cx.active:
  • current - Current directory view
  • preview - Preview state
  • selected - Selected files
  • pref - Tab preferences
  • name - Tab name (string)

Tasks

cx.tasks provides access to the task manager state.

cx.tasks.summary

Task summary information.

Summary Fields

  • running (number) - Number of running tasks
  • total (number) - Total number of tasks
  • found (number) - Files found
  • processed (number) - Files processed
  • percent (number) - Overall progress (0-100)

cx.tasks.snaps

List of task snapshots.

cx.tasks.cursor

Current task cursor position (0-based).

Yanked Files

cx.yanked contains information about copied/cut files.

Yanked Fields

  • is_cut (bool) - True if cut (move), false if copy
  • [url] - Map of yanked file URLs

Which-Key

cx.which provides state for the which-key component (when active).
See #3617 for details.

Layer

cx.layer indicates the current UI layer.
Possible values:
  • "mgr" - File manager
  • "help" - Help screen
  • "input" - Input prompt
  • "confirm" - Confirmation dialog
  • "which" - Which-key screen
  • "pick" - Picker dialog

Examples

Get Selected Files or Hovered

Check if Preview is a Folder

Access Other Tab’s State