zathura

repository·develop·Indexed 25 days ago

https://github.com/pwmt/zathura

A highly customizable and functional document viewer built on the girara user interface library. It features keyboard-centric interaction, a command-line interface, and extensive configuration via the zathurarc file. Supports SyncTeX for editor synchronization and an experimental sandboxed mode via zathura-sandbox.

Tokens
3.8K
Snippets
7
Records
28
Agent score
85%

What's inside zathura

  1. Run zathura in a sandbox

    develop

    The zathura-sandbox binary runs zathura with a seccomp and/or landlock based sandbox. Note that several features are disabled in sandbox mode:

    • Saving/writing files
    • Input methods (e.g., ibus)
    • Printing
    • Bookmarks and history
    • D-Bus integration
    • SyncTeX support

    Sandbox mode is experimental and currently tested with glibc.

  2. Configure zathura via zathurarc

    develop

    Zathura uses a plain text configuration file named zathurarc to customize behavior and appearance.

    File Locations:

    • /etc/zathurarc (System-wide)
    • $XDG_CONFIG_HOME/zathura/zathurarc (User-specific)

    Rules:

    • Each line is evaluated independently (except empty lines and comments starting with #).
    • You cannot write multiple commands on a single line.
    • For string values containing spaces, you must use escaping or quotes (e.g., "hello world").
  3. Set up SyncTeX for editor synchronization

    develop

    Zathura supports SyncTeX forward and backward synchronization. For forward synchronization, use the --synctex-forward and --synctex-editor-command options. For backward synchronization, zathura provides a D-Bus interface that editors can call.

    # Example gvim configuration for SyncTeX
    function! Synctex()
      execute "silent !zathura --synctex-forward " . line('.') . ":" . col('.') . ":" . bufname('%') . " " . g:syncpdf
      redraw!
    endfunction
    map <C-enter> :call Synctex()<cr>
    
    # Launching zathura with gvim integration
    zathura -x "gvim --servername vim -c \"let g:syncpdf='$1'\" --remote +%{line} %{input}" $file
  4. Configure zathura build dependencies

    develop
    Zathura requires several system libraries to function. If you wish to build a sandboxed version, you can control the sandbox features via meson configuration flags. Note that enabling sandboxing will produce a separate binary named zathura-sandbox which operates in a restricted, read-only mode.
  5. Install zathura from source

    develop

    To build and install zathura, use the meson build system with the ninja backend. Ensure you have the necessary build dependencies installed before running these commands.

    meson build
    cd build
    ninja
    ninja install
  6. Configure document page sizing and layout

    develop

    Adjust how documents are displayed upon opening using these settings:

    • adjust-open: Sets the auto adjustment mode. Options: best-fit (default) or width.
    • page-mode: Sets the default page sizing mode. Options: none (default), equal_width (scales all pages to match current width), or equal_height (scales all pages to match current height).
    • pages-per-row: Defines the number of pages rendered side-by-side in a row (default: 1).
    • single-page-mode: If true, documents open in single-page view mode.
    • first-page-column: Defines the column for the first page in multi-column layouts. Uses a colon-separated list for different pages-per-row values (e.g., 1:2 means for 1 page per row use col 1, for 2 pages per row use col 2).
  7. Change options using the set command

    develop

    Use the set command in zathurarc to change and make permanent any zathura options.

    Syntax: set <option> <new value>

    Supported Value Types:

    • INT: Integer number
    • FLOAT: Floating point number
    • STRING: Character string (requires escaping for spaces/special characters)
    • BOOL: true or false

    Colors: Supports HTML color codes and CSS3-style rgb(r,g,b) or rgba(r,g,b,a).

    • For rgba, components are integers (0-255) and alpha is a float (0-1).
    • When using HTML hex codes, escape the hash symbol (\#CCBBCC) or use quotes.
    set option1 5
    set option2 2.0
    set option3 hello
    set option4 hello\ world
    set option5 "hello world"
    
    # Color examples
    set default-fg "#CCBBCC"
    set default-fg \#CCBBCC
  8. Configure statusbar display options

    develop

    Customize what information appears in the statusbar:

    • statusbar-basename: If true, uses the file's basename in the statusbar.
    • statusbar-home-tilde: If true, replaces $HOME with ~ in the file path.
    • statusbar-page-percent: If true, displays the current page as a percentage of total pages.
    • statusbar-h-padding / statusbar-v-padding: Horizontal and vertical padding for the statusbar.
  9. Configure SyncTeX and Editor integration

    develop

    For developers using SyncTeX for backward synchronization:

    • synctex: Enables/disables SyncTeX backward synchronization support (default: true).
    • synctex-editor-command: The command to execute for SyncTeX backward synchronization.
    • synctex-edit-modifier: The modifier key required with the left mouse button to trigger SyncTeX backward synchronization. Options: shift, ctrl, alt (default: ctrl).
  10. Configure search and highlighting behavior

    develop

    Customize how searching and highlighting work:

    • incremental-search: Enables/disables searching while typing (default: true).
    • nohlsearch: Enables/disables the highlighting of search results (default: false).
    • search-hadjust: Enables/disables horizontally centered search results (default: true).
    • abort-clear-search: If true, search results are cleared when the search is aborted (default: true).