darshan दर्शन
document viewer

darshan

दर्शन · “seeing, a view”

PDFs, images and Markdown in your terminal: vim keys, a search across the whole system with a live preview, zen mode, and a line to the AI agent that opened the file.

न तु मां शक्यसे द्रष्टुमनेनैव स्वचक्षुषा ।
दिव्यं ददामि ते चक्षुः पश्य मे योगमैश्वरम् ॥

You cannot see me with these eyes alone; I give you an eye that can. Look. Bhagavad Gītā 11.8
v0.2.0 latest2 releases0 decisions recordedMIT license

Searching for a file: the results on the left, a live preview of the PDF on the right

A page in dark mode, the colours inverted for reading at night Zen mode: nothing but the page, at full screen

Darshan (दर्शन) is Sanskrit for "seeing": a view of something, taken in properly.

darshan opens in a tmux popup, inside your work. Close it and your file stays open, on the same page, until you say otherwise. Press one key and it fills the screen with nothing but the page. Ask an agent to show you a document and you can question it from right there: your question reaches the agent with the page you're on, and its answer shows beside the page.

#Features

#Install

curl -fsSL https://raw.githubusercontent.com/Theyashsawarkar/darshan/main/install.sh | bash

Or make install, or with TPM: set -g @plugin 'Theyashsawarkar/darshan', which binds prefix v. It needs poppler (pdftoppm, pdfinfo, pdftotext) for PDFs and fd for the search; darshan doctor checks. tmux needs set -g allow-passthrough on only for other tools: darshan writes straight to the client's terminal.

To make it the desktop's viewer, install packaging/darshan.desktop and xdg-mime default darshan.desktop application/pdf image/png image/jpeg. darshan open FILE shows a file in the running screen, a tmux popup, or from the desktop a kitty window of its own.

CommandDoes
darshan [FILE] [-p N]The screen, on FILE or what you left open
darshan open FILE [-p N]Show FILE from anywhere
darshan popupOpen the tmux popup, or close it when it's open
darshan search WORDS [--kind pdf]Find files by name: one path a line
darshan statusWhat's open
darshan closeClose the open file
darshan mcpThe MCP server
darshan doctorCheck what it needs

#Keys

darshan uses the vim grammar every Vayu tool shares (vyakarana): on the page you are in NORMAL (keys are commands; a number repeats a motion: 5j, 12G), the finder, the / search and the talk are typing. Space is the leader: press it and a box lists what can follow (Space u toggles the view, Space b the file, Space o opens it elsewhere, Space k asks the agent). Space Space searches every action, ? shows every key. Inside the tmux popup its own key (@darshan-key, v by default) closes it, like pressing it again outside.

Space no longer pages down: Ctrl+f does. Keys that moved say where they went for one release: a → Space k, i → Space u i, w → Space u w, x → Space b d.

**Everywhere**
KeysWhat it does
j or DownMove down (the next page once the page is all shown; 5j repeats)
k or UpMove up (the previous page once the page is all shown)
h or LeftMove left when zoomed (else the previous page)
l or RightMove right when zoomed (else the next page)
J or PgDnMove to the next page
K or PgUpMove to the previous page
Ctrl+dScroll half a screen down
Ctrl+uScroll half a screen up
Ctrl+fScroll a screen down (Space did this before it became the leader)
Ctrl+bScroll a screen up
g g or HomeJump to the first page (5gg: page 5)
G or EndJump to the last page (5G: page 5)
: or Space g pJump to a page (or line) by number: :12 (also :q, :bd, :e FILE)
/Search the document's text
nJump to the next match
NJump to the previous match
+Grow the zoom
-Shrink the zoom
=Reset to fit the whole page
[ or Space b pSwitch to the previous file in the folder
] or Space b nSwitch to the next file in the folder
f or o or Ctrl+p or Space f fSearch for a file on the whole system (with a preview)
z or Space u zToggle zen mode: the full screen, nothing but the page
r or Space rReload the file (it also reloads by itself when it changes)
y or Space y pCopy the file's path
? or Space ?Show every key
q or Space qClose the popup; the file stays open for next time (the popup's own key too)
Space SpaceSearch every action and run one (the palette)
Space bFile…
Space b dClose the file (the popup then finds another)
Space kOpen the talk with the agent that opened this file, to ask it something
Space oOpen…
Space o bOpen the file in the desktop's own viewer (xdg-open)
Space o eOpen the file in $EDITOR (Markdown)
Space uToggles…
Space u iInvert the colours of pages and pictures (dark mode)
Space u wToggle fitting the page's width
While typing
EnterRun the search or the : command
EscCancel the search or the : command

The file finder

KeysWhat it does
EnterOpen the picked file
Tab or Shift+TabSwitch between all files, PDFs, images and Markdown
While typing
Ctrl+j or Down or Ctrl+nMove to the next result while typing
Ctrl+k or Up or Ctrl+pMove to the previous result while typing
EscLeave typing (NORMAL: j, k, g g, G, Ctrl+d / Ctrl+u move; i, a or / type again; Esc or q closes)

The talk with the agent

KeysWhat it does
While typing
EnterSend your question, with what's on screen, to the agent
EscClose the talk

#AI agents

Add it once and every agent can use it:

claude mcp add darshan -- darshan mcp
ToolDoes
view_openShow the user a file (path, page, why)
view_searchFind files anywhere on the system by name
view_statusWhat's open, the page, the text on their screen
view_next_questionWait for the user's next question
view_replyShow an answer beside the page
view_closeClose the file

Asking. When an agent opened the file, Space k opens the talk beside the page. Your question goes with the file, the page and the text on your screen: to the agent if it's waiting in view_next_question, else typed straight into its tmux pane, so it arrives like a message from you. If that pane has dropped to a shell darshan won't type there; the question waits until the agent next asks for it. The document's text is marked as data, so words inside a PDF can't pose as your instructions. If the agent regenerates the file, it reloads where you were.

#Options

~/.config/darshan/config.toml:

roots   = ["~/more-books"]   # folders to search, beside home, other disks and system docs
exclude = ["archive"]        # folder names to skip, beside node_modules, .git, .cache and the like

tmux options, before TPM's run line:

OptionDefault
@darshan-keyvThe popup key after the prefix (none binds nothing)
@darshan-width90%Popup width
@darshan-height88%Popup height
@darshan-title darshan Popup title
@darshan-launcherYour own popup command, given display-popup's arguments

Colours follow varna when it's there.

#How it draws

PDF pages become PNGs through poppler's pdftoppm (cached in ~/.cache/darshan). They reach the terminal by kitty's graphics protocol, written to the tmux client's own terminal, and show through Unicode placeholders, which any text layout carries: that's why they work in popups, where viewers that draw directly (tdf, for one) show nothing.

Not yet: highlighting a match on a PDF page (/ jumps to the page), animated GIFs (the first frame shows), pictures inside Markdown.