Skip to content
adelekeogunsonaPublic

About

Fast, local-only file viewer and text editor for Linux

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Platen

A fast, local-only file viewer and text editor.

Platen in dark mode, editing a Markdown README in the live preview

Platen opens text, Markdown, TeX, SVG, PDF, DOCX, PPTX, and image files in tabs of one window. You edit the text formats and read the rest. Every file type prints from the same print dialog, to a printer or to a PDF file.

Platen draws its window with a native UI toolkit, so an empty window is ready in about 200 ms and uses about 90 MB of memory. It runs offline and sends nothing anywhere.

Screenshots

Code with highlighting, in light or dark

A Go file in the code editor, dark mode

PDF pages with the outline beside them

A PDF report with its outline, dark mode

Markdown you edit in the rendered view

The Markdown live preview, light mode

Slides with a thumbnail strip

A PowerPoint deck with its slide strip

What it opens

Format Mode What you get
Plain text and code Edit Syntax highlighting, line numbers, find, line wrap, minimap, and zoom. Files above 8 MB open read-only and load only the lines on screen.
Markdown Edit A live preview you type into. Switch to raw source, source with a side preview, or a read-only preview. Double-click the preview to go to the source line.
TeX Edit Source with a side preview, outline, completion, folding, and checks for unmatched environments, unknown labels, and missing files. With a TeX distribution installed, the preview is the compiled PDF with SyncTeX. With no TeX installed, Platen renders the preview itself.
SVG Edit A visual preview and the raw source, both with zoom.
PDF Read Pages, outline, internal links, find, and fit-to-width zoom.
DOCX Read Page layout on white paper, with zoom.
PPTX Read A slide strip and one slide at a time, with zoom.
Images Read PNG, JPG, WebP, GIF, AVIF, BMP, and ICO on a checkerboard, with zoom. Animated GIF and PNG files play.

Platen also does these things for every file:

  • Each file opens in its own tab. Right-click a tab to save, print, reload, copy the path, or show the file in your file manager.
  • If another program changes a file on disk, Platen reloads the tab. If the tab has unsaved edits, a banner asks which version to keep.
  • Ctrl+S saves and Ctrl+Shift+S saves as. Platen asks before it closes a tab with unsaved edits.
  • Ctrl+P opens a print dialog with a page preview, paper size, margins, scale, and a page range.
  • Light and dark themes, several color palettes, and interface zoom from 75% to 200%.
  • Preferences can make Platen the default app for each file type, and give a type back to its earlier app.

Privacy

Platen works on local files only. It has no telemetry, no accounts, and no update checks.

DOCX and PPTX files can hold untrusted content. Platen renders them in a web view that starts only for that tab and closes with it. Every page in a web view gets a strict Content Security Policy that blocks all network requests. Platen removes javascript:, data:, file:, and vbscript: links from rendered documents. An http or https link in a document opens in your browser.

Install

Platen targets Linux. Download a package from the releases page, or build it from source.

Package Command
Debian and Ubuntu sudo apt install ./platen_0.1.0_amd64.deb
Fedora sudo dnf install ./platen-0.1.0-1.x86_64.rpm
Arch makepkg -si in the folder with the PKGBUILD
Any distribution, no root sh install.sh platen-0.1.0-linux-amd64.tar.gz

Platen needs these system libraries at run time:

  • GTK 3
  • WebKitGTK 4.1, for DOCX, PPTX, the TeX preview with no TeX installed, and printing
  • Poppler GLib and Cairo, for PDF pages and the print preview

A TeX distribution is optional. Platen finds TeX Live, MiKTeX, TinyTeX, or Tectonic on PATH or in their usual install folders. You can also set the folder in Preferences.

Build from source

You need Go 1.27, Bun 1.3, and the GTK 3 and WebKitGTK 4.1 development packages. Platen loads Poppler and Cairo at run time, so they need no development packages. On Debian and Ubuntu:

sudo apt install libgtk-3-dev libwebkit2gtk-4.1-dev
  1. Install the dependencies:
     bun install
  2. Check that the toolchain and libraries are present:
     bunx mygo doctor
  3. Build the packages into build/:
     bun run build

bun run build packages with a mygo command line tool built from the MyGo version in go.mod with the patches in patches/mygo/. Run release builds through it, not through a bare mygo build. Its patch adds StartupNotify=true to the desktop entry, so a file opened from a file manager brings the open Platen window to the front.

macOS and Windows builds are possible from source, but releases are for Linux only.

Development

Command Purpose
bun run dev Build the web view scripts, then run Platen with live reload
bun run build:web Typecheck and build the web view scripts. Go builds need this first
bun run typecheck Run the TypeScript typecheck
go vet ./... Check the Go packages
go run ./bench Measure startup time and memory of the packaged binary

The shell and all viewers are Go, drawn with the MyGo native UI on GTK 3. Poppler and Cairo draw PDF pages through purego. TypeScript in web/ runs only inside web views, for DOCX, PPTX, the TeX preview with no TeX installed, and print layouts.

main.go               App entry, single-instance lock, viewer registration
internal/shell/       Window, tabs, menus, preferences, print dialog, shortcuts
internal/viewers/     Code, text, Markdown, TeX, PDF, Office, image, and SVG viewers
internal/ui/          Theme tokens, palettes, components, and icons
internal/web/         Web views, the platen-web: scheme, and its security policy
internal/tex/         TeX compile, log problems, and SyncTeX
internal/files/       File kinds, atomic save, and search in large files
internal/desktop/     Links, fonts, printers, and default apps
web/                  Web view scripts: DOCX, PPTX, TeX preview, print layouts
bench/                Startup and memory benchmark

Benchmarks

go run ./bench launches the packaged binary five times for each case. It records the time until the window shows its first content and the memory of Platen and its web view processes. These are the medians on one Linux desktop:

Case Ready Memory (PSS)
Empty window 209 ms 89 MB
Markdown file, 30 KB 198 ms 100 MB
Log file, 200 MB 184 ms 93 MB

Close all Platen windows before you run the benchmark. Use -file to add a file of your own, such as a PDF.

License

Platen is released under the MIT License.

About

Fast, local-only file viewer and text editor for Linux

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages