$ show sonnyp/Tangram
Tangram is a GNOME desktop application written in JavaScript (GJS) that functions as a specialized browser for managing web applications as persistent, sandboxed tabs. It uses GTK4, Libadwaita, and WebKitGTK to render each tab independently, with per-tab settings (name, URL, user agent, notification priority) stored via GSettings. The application provides a tab overview (Adw.TabOverview), navigation controls, and integrates with the GNOME notification system. It is packaged as a Flatpak and supports translations via Weblate. The codebase is well-structured, modular, and follows modern GNOME development practices, with unit tests for URL utilities and web app metadata extraction.
The LLM identified 3 files worth highlighting for reuse:
A standalone JavaScript module (originally from GNOME Web/Epiphany) that extracts web application metadata from a page's DOM: manifest link, title (via meta tags, og:site_name, apple-mobile-web-app-title, etc.), URL (via msapplication-starturl, og:url), and icon (via link rel icons, apple-touch-icon, msapplication-TileImage, og:image). It is self-contained, has no dependencies on the rest of the Tangram codebase, and can be injected into any WebKit webview to retrieve web app info. This is the most reusable component in the repository.
Exports the `isSameSite` function which implements the SameSite algorithm for URLs, handling punycode, public suffixes, IP addresses, and edge cases like about:blank. It uses GLib and Soup for URI parsing and TLD extraction. This function is self-contained, well-tested (see src/utils.test.js), and could be extracted into any JavaScript project needing robust same-site comparison for security or navigation logic.
Provides a class-based system for managing persistent tab instances. Each instance has an ID, data/cache directories, and a GSettings object for per-instance configuration (name, URL, user agent, notification priority). The module includes factory functions for creating, loading, attaching, detaching, and destroying instances. While tightly coupled to the app's directory structure and GSettings schema, the pattern of encapsulating instance lifecycle and settings is clean and could serve as a template for similar GNOME applications needing per-item persistent state.