$ show bottlesdevs/Bottles
Bottles is a desktop application for running Windows software on Linux by managing Wine/Proton 'bottles' — isolated Windows prefix environments. In production it creates, imports, configures, and deletes bottles, installs and manages Wine runners (Wine, Proton, Soda) and graphics components (DXVK, VKD3D, NVAPI, D7VK), applies step-based dependency manifests (DLLs, runtimes, registry keys, fonts), and launches Windows executables with per-bottle environment composition (sync modes, HDR, Wayland, gamescope, FSR, mangohud, sandboxing via bwrap/flatpak-spawn). It also integrates with the UMU launcher for running Proton games outside Steam, discovers Steam/Epic/Origin libraries, and tracks playtime in a local SQLite database with crash recovery and aggregation. The dominant character is unambiguously a desktop application, though it embeds a small data layer (playtime SQLite, EagleIntel community-intelligence SQLite, YAML catalog caches) that serves the app rather than constituting a research pipeline. The architecture is a classic backend/frontend split: a singleton Manager orchestrates sub-managers (component, dependency, installer, library, versioning, sandbox, playtime, backup, Eagle), while a GTK4/Adwaita frontend (views, windows, widgets, Blueprint .blp templates) and a companion CLI (bottles-cli) consume it. Loose coupling is achieved through a SignalManager/EventManager pub-sub bus, RunAsync threading helpers, and a standard Result return type. Catalogs for components, dependencies, and installers are fetched as YAML from remote repositories with local caching, offline fallback, and checksum validation; user settings live in GSettings; bottle configs are YAML dataclasses; versioning snapshots are delegated to an external FVS2 tool. A distinctive Eagle subsystem performs static analysis of Windows executables (pefile parsing, YARA rules, installer/ASAR extraction) and consults a bundled community-sourced SQLite database (ProtonDB/winetricks-derived) to recommend compatibility environment variables, DLL overrides, and launch flags. A Microsoft identity bridge implements the Soda OAuth 2.0/PKCE protocol over Unix sockets, with libsecret/cpak secret storage, enabling Microsoft account sign-in inside Wine. Engineering quality is strong: a large pytest suite covers backend managers, Wine wrappers, UMU, playtime integration, and frontend dialogs; the project uses ruff/mypy/pyright via pre-commit; CI builds Flatpak and cpak multi-arch (amd64/arm64) images and runs tests; localization spans 60+ languages. The repository is actively maintained with very recent commits, structured issue templates, and a dependabot-enabled pipeline with zero alerts. Principal drift risks are moderate: a deprecated Gtk.FileChooserNative call (vs Gtk.FileDialog), dual download implementations (pycurl for repos vs requests for Downloader), a vendored ValvePython vdf/vdict copy, hardcoded repository URLs pinned to commit hashes, and version-specific Wine/Proton workarounds that will age. The frontend is tightly coupled to Flatpak runtime resources, limiting its portability, but several backend components are cleanly isolated and genuinely reusable.
The LLM identified 5 files worth highlighting for reuse:
ProcessSessionTracker: a thread-safe SQLite session tracker using WAL mode, a heartbeat thread, atexit cleanup, timestamp-collision retry for uniqueness, forced-failure recovery, and weekly/daily/monthly aggregation. The pattern generalizes to any usage/telemetry tracking system (playtime, uptime, feature usage) and could be extracted into a standalone library with minimal changes.
IdentityBridgeServer and MicrosoftIdentityProvider: a production-grade OAuth 2.0/OpenID Connect bridge implementing a custom binary protocol over Unix sockets, with PKCE token flow, token refresh, callback forwarding via RedirectListener, and an abstract SecretTokenStore that switches between libsecret and cpak subprocess backends. It is a rare, self-contained example of bridging a sandboxed process to a web OAuth flow and is reusable as a template for similar credential-bridge designs.
EagleManager: a Windows executable analyzer that parses PE headers with pefile, extracts installers (7z/patoolib) and ASAR archives, applies YARA rule matching, detects packers/anticheat/.NET CLR/engine markers, and correlates findings against a SQLite community-intelligence database (EagleIntel) for setting recommendations. The analysis pipeline is decoupled from the Bottles UI and could be repurposed as a standalone malware/toolchain triage utility.
WineEnv and WineCommand: a chainable environment builder that composes full Wine runtime environments — GPU library paths, sync modes (esync/fsync/ntsync), HDR/Wayland/hidraw/openxr toggles, FEX support, sandbox wrappers, external terminals, and per-program overrides — with override detection, bundling, and path concatenation. The builder pattern for assembling process environments is directly transferable to any launcher or container-startup project.
_CancellableReader and ProgressTrackingFilter: a cancellable, progress-aware tar/zip extraction pipeline that validates archive entries against path-traversal attacks, supports cooperative cancellation with cleanup, and reports byte-level progress. This solves a recurring packaging/security problem and can be lifted wholesale into any application that handles untrusted archives.