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.

v0.1.0 latest1 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

Reading

Key
j / kMove down / up (next / previous page once the page is all shown)
h / lMove left / right when zoomed (else previous / next page)
J / KMove to the next / previous page
Ctrl+d / Ctrl+uScroll half a screen down / up
Ctrl+f / Ctrl+bScroll a screen down / up
g g / GJump to the first / last page
N G / : NJump to page (or line) N; a number before j, k, J or K repeats it
/Search the document's text
n / NJump to the next / previous match
+ / -Grow / shrink the zoom
=Reset to fit the whole page
wToggle fitting the page's width
iInvert the colours of pages and pictures (dark mode)
[ / ]Switch to the previous / next file in the folder
f / o / Ctrl+pSearch for a file on the whole system (with a preview)
aOpen the talk with the agent that opened this file, to ask it something
zToggle zen mode: the full screen, nothing but the page
rReload the file (it also reloads by itself when it changes)
yCopy the file's path
q / vClose the popup; the file stays open for next time
xClose the file
?Show every key

Searching for a file

Key
EnterOpen the picked file
Up / Down / Ctrl+j / Ctrl+kMove through the results while typing
EscLeave typing, then j, k, g g, G and Ctrl+d / Ctrl+u move (i types again; Esc again closes)
Tab / Shift+TabSwitch between all files, PDFs, images and Markdown

Talking to the agent

Key
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, a 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.