Skip to content

Add Linux support with Nix packaging, Flatpak, desktop integration, and CI#197

Open
ndarilek wants to merge 1 commit intotrypsynth:masterfrom
ndarilek:linux-port
Open

Add Linux support with Nix packaging, Flatpak, desktop integration, and CI#197
ndarilek wants to merge 1 commit intotrypsynth:masterfrom
ndarilek:linux-port

Conversation

@ndarilek
Copy link
Copy Markdown

This gets most of Paperback running under Linux, either directly on Nix via nix run, or via Flatpak standalone bundles attached to each PR/release.

What doesn't work?

  • The ToC tree view is entirely inaccessible, I suspect due to WX's TreeView not being accessible under GTK3. It is still keyboard-navigable, but the widget isn't presented nor are any events related to it.
  • Individual keyboard commands like "h" in the document area output a terminal bell and do nothing. My suspicion is that GTK read-only TextViews block anything that looks like text input, that or either WX adds something.

Even with these limitations, having something I can throw just about any document I might want to read at under Linux and get back an accessible version is something I was going to write myself 6 months ago, so thanks for saving me the trouble! I think this is very useful even in its current form.

Followup

Additional tasks to pursue once this gets merged--I'm happy to look into them but I'll put them here in case others might be interested:

  • Other packaging options--AppImage at minimum. I'm prioritizing non-distro-specific formats for easier maintenance, though I needed Nix for the development setup so am willing to own that going forward.
  • Publishing on Flathub
  • Investigating whether WX's TreeView can be made accessible under Linux.
  • Adding ctrl to all hotkeys on Linux in the document view to see if that makes them work.

Disclosure

This PR was made largely with the help of Claude Code. As per my usual agentic workflow, I've reviewed every line of this PR. While nothing appears to rm -rf / or exfiltrate the nuclear launch codes, I can't speak to:

  • The quality of the CMake additions
  • The quality of the Flatpak build manifest. It looks good, albeit verbose, but Flatpak manifests kind of ar. I've done Flatpak manifests, but long enough ago that I don't know what current best practices are. But I've confirmed that the Flatpak installs and runs.
  • The C++ changes. -Werror flagged a bunch of issues with my version of GCC, and not having done C++ in a couple decades, I let Claude fix them. At first glance it looks like pedantic style/correctness fixes, and a variable rename to prevent a shadowing-related error, but that's the smallest part of the diff so hopefully should be easy to review.
  • The extracted icons. I needed icons for the .desktop files and Flatpak. Claude claims it extracted and resized the icons from the Windows installer. The description it gives me for the icons it added seems to make sense, but we should probably have someone visually confirm them (or confirm them via your own/someone else's VLLM analysis.)

@trypsynth
Copy link
Copy Markdown
Owner

Thanks a ton for this! This is a fairly sizable diff and I do have software engineering employment, so my apologies if this takes me a little bit to merge, but thanks a ton for all your work! It does look like CMakeLists has some conflicts, but those should be easy to fix.
FWIW, I have the very same agentic coding workflow. Write a massive prompt, let Claude or Codex cook, review every single line multiple times.

@ndarilek
Copy link
Copy Markdown
Author

No problem, I'm in no rush here.

FWIW, I'm partway through a fix for the inaccessible TOC tree--creating a tree widget type that either loosely wraps the native WX widget on most platforms, or just uses a GTK TreeView under WXGTK. I can either add that to this branch or to a followup PR--just wanted to let you know I wasn't done. That one will include a pile of C++ though, so it'll probably need closer review.

@ndarilek
Copy link
Copy Markdown
Author

  • Added missing Nix package dependencies--the package worked because they were in my runtime environment, but this now makes them explicit.
  • Cleaned up issue where Flatpak binary cleanup cleaned up the application binary too--previously worked until a cleanup section consolidation in the manifest.
  • Added required prefix to desktop icons in Flatpak so they're included in the final package.
  • Added documentation to final Nix package and Flatpak.
  • Added small helper function to find documentation. Under Linux this checks FHS paths first--/usr/share/doc/paperback, /usr/local/share/doc/paperback, Flatpak's prefix, etc. The current behavior is the default Linux fallback, and the default on all other platforms. This gets the help documentation loading both internally and in external browsers.
  • Removed pulse Flatpak permission--no need for sound yet.
  • Skip fetching submodules in flatpak build. This omits downloading vcpkg since all dependencies are either fetched by flatpak-builder or are already in the runtime.

@ndarilek
Copy link
Copy Markdown
Author

I just fixed the conflicts between this branch and master.

I also have, on separate branches rebased on this one, fixes for both the inaccessible ToC tree under Linux, as well as a fix for the menu accelerators not working in the text area, including a GTK-based live region implementation. Again, no rush on reviewing any of this--I can run my own branch indefinitely under Nix pretty easily. Just wanted to keep the PR updated as to the state of things.

@trypsynth
Copy link
Copy Markdown
Owner

Seems I just broke some of your hard work when I merged in my Rust branch. Sorry about that :(

@trypsynth
Copy link
Copy Markdown
Owner

Also, FWIW, a custom implementation of the tree for linux would be great, we're already going to have to do this for the mac :( wxWidgets really sucks at treeviews on not Windows, I guess.

@ndarilek ndarilek force-pushed the linux-port branch 2 times, most recently from 458c9b4 to eeadb63 Compare January 5, 2026 22:27
@trypsynth
Copy link
Copy Markdown
Owner

@ndarilek This looks good to me, are you okay if I merge this? I know that #253 breaks our Linux build at the second, but I've gone ahead and reviewed this and it all looks good! That way, you can submit your other Linux fixes as other PR's.

@ndarilek
Copy link
Copy Markdown
Author

ndarilek commented Jan 7, 2026

Please hold off just a bit, there's an odd issue where it segfaults if I attempt to open a book when launching from the desktop but works fine when opened from the CLI. Going to attach a debugger and investigate that today, should hopefully have a fix later this afternoon.

@trypsynth
Copy link
Copy Markdown
Owner

Okay, sounds good. Thanks for all your work!

@ndarilek
Copy link
Copy Markdown
Author

Sorry for the delay. Aside from the conflicts, this should be ready to merge. Note that it doesn't have the textarea and tree accessibility fixes which I saved for followup. If you like, I can throw those plus the conflicts at Claude Code over the next few days.

I also found that it's possible to make AppImages pretty easily from Nix packages. I can set those up instead of or in addition to flatpaks if you'd like something a little more download-and-run for Linux.

@trypsynth
Copy link
Copy Markdown
Owner

Yeah, feel free to throw all that into this PR, I would like to have basic Linux support in 0.8, but 0.8 is also going to involve rewriting the entire GUI in Rust, so it may be a little

@trypsynth
Copy link
Copy Markdown
Owner

Okay, well the entire GUI has been rewritten minus IPC, and I plan to do that next. Last huge bit of merge conflicts for a while, sorry...

@trypsynth trypsynth mentioned this pull request Feb 11, 2026
@trypsynth
Copy link
Copy Markdown
Owner

@ndarilek are you still interested in working on this? If not, I'll close it.

@ndarilek
Copy link
Copy Markdown
Author

Actively working on this now, but am hitting odd issues trying to make treeviews accessible. Something about trying to shoehorn GTK trees into WX is causing activedescendant mismatches, and arrowing around ToCs presents things out of order. I'll keep trying to work around it, but worst case I do know that a flat list works, so if all else fails I'll switch to that and we'll just take the slightly suckier experience on Linux like we're used to anyway. :)

@trypsynth
Copy link
Copy Markdown
Owner

Ah, okay so get ready to hate wx.
wxTreeCtrl is fully native and accessible on Windows, but is a custom owner-drawn control with no accessibility implementation on macOS/Linux. wxDataViewTreeCtrl, on the other hand, is custom drawn on Windows with no accessibility, and a native control on macOS and Linux. SO maybe just try that tree ctrl?

@ndarilek
Copy link
Copy Markdown
Author

Oh believe me, I've hated WX's tree control for years, it's been a pretty huge tetanus-encrusted papercut for Linux users for as long as I can remember. Which tree control do you mean by "that tree control?" The one I'm working on, or some other WX control?

I now have an awful hack--take a ListView, append ": collapsed" or ": expanded" to the accessible representations of rows as appropriate, announce "expanded" or "collapsed" via the live region when left/right arrow is pressed, and if you hold your nose and don't use flat review it feels mostly identical. I'll probably ship this unless you have another approach. It isn't quite what I want but at least gets us something that does the job.

@trypsynth
Copy link
Copy Markdown
Owner

I mean wxDataViewTreeCtrl, https://docs.wxwidgets.org/stable/classwx_data_view_tree_ctrl.html It apparently is accessible o nmacOS and Linux.

@ndarilek
Copy link
Copy Markdown
Author

Got it.

The good news is that it is accessible. The bad news is 2-fold:

  1. There's some weird ordering issue I can't work out, where it seems like tree items are unordered even though they appear correct in both debugging output and Orca flat review. Arrowing up/down presented chapters/subsections in weird and random orders.
  2. WXDataViewTreeControl reliably froze Orca whenever I attempted flat review to verify the contents were in fact ordered. I have to assume they were correct in the data model since the behavior persisted across both attempts, but I wasn't able to verify because of the consistent freeze.

So we're back to the weird hacky list, and someone smarter than me will have to figure it out. But as of now both the ToC and elements list use this hacky tree and are accessible.

Marking this as draft because I haven't fully reviewed the code myself yet. I'll do that tomorrow morning or early afternoon and undraft.

@ndarilek ndarilek marked this pull request as draft March 26, 2026 18:35
@ndarilek ndarilek marked this pull request as ready for review March 31, 2026 12:36
@ndarilek
Copy link
Copy Markdown
Author

I think we're good for review. Sorry that took longer than anticipated.

After initially starting work on this, I did discover a fairly easy way to convert Nix derivations into AppImage bundles. Not sure if you have a preference on those vs. Flatpak but happy to add that as well, to replace flatpak with appimage, etc. Also happy to help get this on Flathub so it's available in most distros' software centers. But we'll save either for followups.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants