feat: add initial Linux platform support - #145
Conversation
Add aarch64-linux and x86_64-linux targets to flake with WebKit, GTK, and XDG Portal dependencies. Patch dioxus-sdk-window to fix cfg condition overlaps on Linux. Add macOS cfg guards for platform-specific code. Handle dark_light theme detection before async runtime initialization. Note: Linux support is early-stage. Keybinding and theme auto-detection features still need development.
Enable build, open, and install tasks to support both Linux and macOS by using just recipe markers [linux] and [macos]. This allows each platform to use its native build commands and output paths.
Now that Linux platform support has been added, ensure the Nix build works correctly on both platforms by testing in the CI matrix.
There was a problem hiding this comment.
Pull request overview
This PR adds initial Linux platform support to Arto, enabling the application to build and run on aarch64-linux and x86_64-linux systems. The changes focus on cross-platform compatibility by adding platform-specific build configurations, dependencies, and code guards while maintaining existing macOS functionality.
Changes:
- Extended Nix flake to support Linux builds with WebKit, GTK, and XDG Portal dependencies
- Added platform guards (
#[cfg(target_os = "macos")]) for macOS-specific code (oslog, window tabbing, Finder operations) - Implemented workaround for Linux theme detection panic using
catch_unwind - Extended CI build matrix to include
ubuntu-latest
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| flake.nix | Added Linux platform detection, build dependencies (WebKit, GTK, libsoup, glib, openssl, xdotool), and platform-specific build paths |
| desktop/src/lib.rs | Added #[cfg(target_os = "macos")] guard for tracing-oslog dependency |
| desktop/src/menu.rs | Added platform guard for NSWindow automatic tabbing disable function |
| desktop/src/utils/file_operations.rs | Guarded std::process::Command import with macOS-only cfg attribute |
| desktop/src/theme.rs | Added catch_unwind workaround for D-Bus panic when detecting theme on Linux before Tokio runtime starts |
| desktop/Cargo.toml | Added xdg-portal feature to rfd and patched dioxus-sdk-window for Linux compatibility |
| desktop/Dioxus.toml | Added PNG icon for Linux alongside existing macOS ICNS icon |
| desktop/justfile | Added platform-specific [linux] and [macos] markers for build, open, and install recipes |
| justfile | Added [macos] marker to install recipe |
| .github/workflows/build.yml | Extended build-nix job with matrix strategy for ubuntu-latest and macos-latest |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| Theme::Auto => match std::panic::catch_unwind(dark_light::detect) | ||
| .ok() | ||
| .and_then(|r| r.ok()) |
There was a problem hiding this comment.
Using catch_unwind to handle the D-Bus panic on Linux is a workaround that masks the underlying issue. A more robust approach would be to use platform-specific implementations: on Linux, skip automatic theme detection if called before the Tokio runtime starts, or check if the runtime is available before calling dark_light::detect. This would avoid the overhead and uncertainty of panic catching. Consider adding a #[cfg(target_os = "linux")] guard to return a default theme or check runtime availability.
|
Thanks 🎉 |
Summary
aarch64-linuxandx86_64-linuxtargets to the Nix flake with WebKit, GTK, and XDG Portal dependenciesdioxus-sdk-windowto fix overlappingcfgconditions that cause duplicate function definitions on Linux (DioxusLabs/sdk#103)#[cfg(target_os = "macos")]guards for macOS-specific code (tracing-oslog, window tabbing, Finder reveal)dark_lighttheme detection panic on Linux (D-Bus requires Tokio runtime, but detection runs before runtime starts)ubuntu-latest[linux]/[macos]markers to justfile recipesNote
This is experimental Linux support. Basic file browsing works, but some features (e.g. keybindings, automatic theme detection) still need development. Tested on NixOS with Wayland.
Current limitations
Known issues / not yet ported
xdg-openequivalent)Future work (separate PRs)
just buildcan generate deb packages, but needs validation with dependenciesTest plan
nix buildsucceeds on Linux (aarch64-linux,x86_64-linux)nix buildstill succeeds on macOS (aarch64-darwin,x86_64-darwin)ubuntu-latestandmacos-latestRelated issues