$ show ahrm/sioyek
Sioyek is a cross-platform PDF viewer optimized for reading research papers and technical books. Built with Qt, OpenGL, and MuPDF, it provides a rich set of features including multi-threaded rendering, annotation management (highlights, bookmarks, portals, freehand drawings), SyncTeX integration for LaTeX forward/inverse search, fuzzy text search, and a customizable command-driven interface. The architecture follows a modular design with a central MainWidget orchestrating UI state, a Document model for PDF handling, a PdfRenderer for threaded rendering, and a DatabaseManager for persistent annotation storage. The application supports both desktop and touch-optimized interfaces, with platform-specific code for Windows, macOS, Linux, and Android. While primarily an application, Sioyek incorporates data-oriented features such as SQLite-based annotation persistence, checksum-based document identification, and integration with external research tools (Google Scholar, arXiv). The repository also includes scripts for paper downloading, text-to-speech, and embedding annotations, as well as precomputed embedding data files (embedding.npy, linear.npy) likely used for text summarization or search enhancement. The codebase demonstrates strong engineering practices with reusable components like a fuzzy matching library (fzf), a SyncTeX parser, a type-safe configuration system, and a set of QML touch UI widgets. However, it also exhibits some technical debt in the form of global state, large monolithic files (main_widget.h), and platform-specific conditionals scattered throughout.
The LLM identified 4 files worth highlighting for reuse:
A standalone fuzzy string matching implementation providing scoring-based algorithms (e.g., fzf_score, fzf_position). It is self-contained, has no internal dependencies, and can be extracted into any project requiring fuzzy search or autocomplete functionality. The code demonstrates efficient string processing and is used by Sioyek's command palette and file search.
A full SyncTeX file parser that builds a node tree representing TeX document structure for forward/inverse search between source and PDF. It is a self-contained C library with a well-defined API (synctex_scanner_new, synctex_display_query, etc.) and can be reused in any PDF viewer or TeX tool requiring synchronization. The implementation uses an object-oriented style in C with function pointers and macro-generated accessors.
A type-safe configuration management system that defines configuration options with typed values (float, int, color, string) and validates them against constraints. It supports loading from INI-like files, runtime modification, and persistence. The pattern is reusable in any application needing structured, validated configuration with minimal boilerplate.
A reusable QML touch slider component that provides a smooth, touch-friendly slider control with customizable range, step size, and visual styling. It is part of a larger set of touch UI widgets (TouchCheckbox, TouchButtonGroup, etc.) that can be extracted and used in any Qt Quick application requiring mobile-optimized controls.