Skip to main content

Module entry

Module entry 

Source
Expand description

Process entry point, shared by the ts and tree-space binaries.

Usage: ts — start the panel, or toggle it if a panel is already running ts –side left|right — dock to that screen edge (default: the configured side) ts /path/a [/path/b …] — open each directory as a pane ts –side right /path — open a pane in the right dock ts /path/to/file — reveal a file: open its folder and select it ts –select /path/to/anything — reveal an explicit file or folder ts –hidden — launch (or keep) the panel hidden ts –width 420 — set the panel width (absolute px) ts –width +40 — widen the panel by 40px (-40 narrows)

Directories may also be passed via the TREE_SPACE_DIRS environment variable as a colon-separated list: TREE_SPACE_DIRS=/a:/b ts

Single instance ─────────────── Only one panel runs at a time. When an instance is already alive, a new invocation forwards its intent over the instance socket (see ipc.rs) and exits without starting a second panel:

  • no path, no side → toggle every dock together
  • --side X → toggle just that side (create and show it if absent)
  • --side X -H → hide just that side
  • with path(s) → add a pane for each directory (never a duplicate of an already-open root), then show the panel
  • --select P → open a pane for P’s folder and select P
  • --hidden → hide every dock; never shows

Launch arguments are consumed here (via Command) and the process argv handed to GApplication is reduced to the bare program name, so neither the --side flag nor directory paths reach GLib’s option parser.

Desktop / XDG activation ──────────────────────── The GApplication is created with HANDLES_OPEN and an open handler, so a .desktop entry using Exec=tree-space %u (or xdg-open, or a portal request) forwards the file/folder to the running panel instead of being discarded. The handler funnels every opened file back through the same instance socket, so it behaves exactly like ts --select <path>.

Functions§

run
Run the application: parse arguments, hand off to a running instance or start the panel. Shared by the ts and tree-space binaries.