Repository navigation
linux-rust: COSMIC support, panel applet, UI redesign, crash and audio fixes - #934
Open
satyakommula96 wants to merge 12 commits into
Open
satyakommula96 wants to merge 12 commits into
satyakommula96 wants to merge 12 commits into
Conversation
Make the Rust app work well on Pop!_OS / COSMIC (and other desktops), add a native COSMIC panel applet, and fix several bugs found while testing with AirPods Pro 2. Startup and Bluetooth - Don't crash when Bluetooth is off or rfkill-blocked (COSMIC's toggle); wait for a powered adapter instead of forcing it on. - Don't abort when no StatusNotifier host is available. - Restart the LE advertisement monitor after Bluetooth is toggled or the system resumes; skip bad events instead of stopping the monitor; log an actionable hint when BlueZ Experimental is disabled. Desktop integration - Set the Wayland app_id to match the .desktop file, embed the window icon, and improve the desktop entry. - Add a "System" theme that follows the desktop light/dark preference. - Add a "Start on login" setting (XDG autostart; Flatpak-aware). - Keep a single instance; a second launch opens the existing window. - Write logs to $XDG_STATE_HOME/librepods/librepods.log when not started from a terminal. - Create config/data directories at startup (librepods-org#633). - Tray: left click opens the window (librepods-org#636), readable outlined text, "100" no longer clipped, radio state updated on selection (librepods-org#635). - Add `just install`, `install-cosmic-applet` and `uninstall`. IPC, CLI and COSMIC applet - Local socket IPC: status subscription and control commands. - CLI: --listening-mode off|anc|transparency|adaptive|cycle (librepods-org#155), --status and --watch for status bars (librepods-org#732). - New cosmic-applet crate: panel button with battery %, popup with battery, noise control, conversation awareness and "Open LibrePods". The tray icon is hidden while the applet is running. Audio - Always resolve the PipeWire card afresh and wait for it to appear; the cached index went stale on reconnect. - When A2DP is missing, ask BlueZ to connect the profile (its own setup can fail with EBUSY racing the AAP connection) instead of restarting WirePlumber, which interrupted all audio. - Don't re-switch an already active A2DP profile (from librepods-org#766). - Fix a deadlock in the playback listener with a second device connected (from librepods-org#896) and don't hold the AACP state lock while sending (from librepods-org#775). Battery and controls - Ignore "unknown" battery sentinels (level > 100, or 0 while disconnected) and merge readings per component instead of replacing them (librepods-org#422); show a bud resting in the case as "in case". - Apply AirPods setting changes to the current state instead of a stale snapshot, fixing "Adaptive" displaying as "Off" (librepods-org#423). Security - Never log proximity keys (IRK / encryption key) (from librepods-org#897). Dependencies - Bump tokio, clap, dbus, env_logger, futures, ksni, log, serde, serde_json and uuid; move aes off 0.9.0-rc.4 to 0.9.4; imageproc 0.27. - Add tests for the RPA hash (Bluetooth Core Spec vector) and tray icon rendering.
- Bump actions/checkout to v7, actions/upload-artifact to v7 and softprops/action-gh-release to v3 (Node 24 runtime). - Replace actions/cache with Swatinem/rust-cache, covering both crates. - Download appimagetool from AppImage/appimagetool (AppImageKit is deprecated). - Fix the paths filter, which referenced a non-existent workflow file. - Also run on pull requests to linux/rust. - Run cargo test and build with --locked. - Build the COSMIC applet (adds libxkbcommon-dev) and publish it as an artifact and release asset.
ubuntu-latest now resolves to Ubuntu 26.04 (glibc 2.43), so the AppImage and binaries failed to start on Ubuntu/Pop!_OS 24.04 with "version `GLIBC_2.43' not found". Pin the build to ubuntu-22.04 (glibc 2.35) and fail the job if a binary requires a newer glibc.
Group runs by workflow and ref so a new push cancels the older run that is still in progress. Release tag builds are never cancelled.
Ubuntu 22.04 doesn't package just, so apt-get failed. Install a prebuilt binary instead.
mktemp -d creates the AppDir with mode 0700. Newer appimagetool rejects that because other users would get "Permission denied" running the AppImage. Set it to 0755.
- Install the metainfo as usr/share/metainfo/me.kavishdevar.librepods.appdata.xml, where appimagetool looks for it and validates it with appstreamcli. - Name the AppImage's desktop file me.kavishdevar.librepods.desktop so it matches the metainfo <launchable> and the Wayland app_id. - Clean up the metainfo (also used by the Flatpak): readable description, homepage and bug tracker URLs, and an OARS content rating. Validates with AppStream 0.15 and 1.0.
The maintained appimagetool defaults to zstd. AppImageLauncher 2.x, the
stable release on many Ubuntu systems, intercepts AppImage launches and
cannot mount zstd images ("Can't open squashfs image: Bad address"), so
the AppImage failed to start there. gzip is supported everywhere.
The maintained appimagetool bundles a mksquashfs that only supports zstd, so --comp gzip fails the build. Keep zstd: the static type2 runtime it produces needs no libfuse2 and runs on stock Ubuntu. AppImageLauncher 2.x users can launch with APPIMAGELAUNCHER_DISABLE=1 or use AppImageLauncher 3.
AppImageLauncher 2.x, still the stable release on many Ubuntu systems,
intercepts AppImage launches and its libappimage only opens gzip or xz
squashfs images ("this version supports only xz, zlib"), so the zstd
AppImage failed to start there. The maintained appimagetool's bundled
mksquashfs only supports zstd, so keep it for validation and building,
then repack the squashfs with gzip on the same type2 runtime, which
reads both. Verified in Ubuntu 22.04/24.04 containers, including
AppImageLauncher 2.2.0 integration.
CI installs squashfs-tools and fails if the AppImage is not gzip.
Window (layout inspired by the MousePods desktop app by Matteo Gaudioso, https://github.com/starman-tech/mousepods; no MousePods code is used): - Sidebar with app header, device list with live battery, Settings and a connection status footer. - AirPods overview: hero card with battery rings (low/critical colors, charging bolt, dimmed bud in case, last known case level), summary tiles, segmented noise-control buttons, Audio card and a collapsible "About this device". - Settings as grouped cards; segmented System/Light/Dark colors. - Reusable components (cards, rows, segmented control, chip, tile, battery ring, page header, nav item) in ui/components.rs. - Use only the bundled SF Pro Regular weight; requesting semibold made the text engine substitute another font. Connect and quit: - "Not connected" card with a Connect button, e.g. after using the AirPods with an iPhone; also in the tray menu, the COSMIC applet and `librepods --connect`. Stay on the device page after a disconnect. - "Quit LibrePods" in the applet popup and `librepods --quit` (the tray icon, and its Exit item, is hidden while the applet runs). Fixes: - Renames update the sidebar, header and applet, and are saved to devices.json. - Forward ear-detection events to the window. - Reset the tray/applet/IPC state when the AirPods disconnect; it kept showing them as connected with stale battery levels. - AirPods commands are sent from update() instead of from view callbacks. - Applet shows the AirPods' name; IPC status includes it.
Reliability: - Cache devices.json in the window instead of reading it on every redraw. - Read AirPods state off the UI thread (no blocking_read/blocking_lock in update or view); removes two unwraps that could abort the app. - Use one shared background runtime instead of a runtime per command. - Send a rename once (on Enter or after typing pauses), not per keystroke. - Window follows the shared tray/applet status (live case battery from BLE broadcasts). - One settings writer that keeps unknown keys. - Fix crashes on malformed packets: short ear detection, connected devices length check off by 2, short smart routing, malformed address in RPA verification. - Don't truncate the running instance's log when launched again. Features: - Low-battery desktop notifications at 20% and 10% (with hysteresis), toggle in Settings. - Pairing helper: pairs AirPods over BR/EDR, avoiding the LE "Find My" identity that makes pairing fail on Linux. - Connect a specific pair when several AirPods are saved (tray, applet, `connect <mac>` IPC command). - Remember the last live case battery across restarts and show its age. UI: - "System" theme follows the XDG portal color scheme directly; iced's own detection was reset to light when a window opened on Wayland. - Responsive layout: fixed-width sidebar, icon-only sidebar and stacked cards below 720 px; default window size 920x640. - Sidebar footer shows the version and warns when Bluetooth is off. Tests: 2 -> 57 (app and applet), including real packet bytes, spec test vectors for the RPA hash and AES, packet handler, IPC contract, low battery rules and UI smoke tests. CI also runs the applet's tests.
Author
|
Hi @kavishdevar , could you please review PR Thanks, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This makes the Rust Linux app work well on Pop!_OS / COSMIC (and other desktops), adds a native COSMIC panel applet, redesigns the window, and fixes a number of bugs, including several crashes found by new tests. Everything was tested on Pop!_OS 24.04 (COSMIC, Wayland, BlueZ 5.72, PipeWire) with AirPods Pro 2.
The PR is large; the commits are grouped by area and I'm happy to split it into smaller PRs if that's easier to review. (Much of the line count is the new applet's
Cargo.lock.)Fixes
Crashes (release builds use
panic = "abort", so each of these took down the whole app):unwrap()s on the device managers when a device connected.Audio
Battery and controls
Other
Debug).Features
linux-rust/cosmic-applet, libcosmic): battery %, popup with battery, noise control, conversation awareness, Connect, Open and Quit. The tray icon hides while the applet runs.librepods --status/--watch(JSON, for status bars, Quickshell Support #732),--listening-mode off|anc|transparency|adaptive|cycle(bind to a shortcut, [Linux] global shortcut to change noise control nodes #155),--connect,--quit.$XDG_STATE_HOME/librepods/librepods.logwhen not started from a terminal.UI
Redesigned window, with the layout inspired by the MousePods desktop app by Matteo Gaudioso (https://github.com/starman-tech/mousepods); no MousePods code is used. Sidebar with device list and live battery, overview card with battery rings, segmented noise-control buttons, grouped settings cards, and a responsive layout for narrow (tiled) windows.
Packaging and CI
ubuntu-latesthad moved to 26.04 (glibc 2.43), and that AppImage failed on 24.04.cargo test --lockedfor the app and the applet, applet built and published, superseded runs cancelled.aesfrom 0.9.0-rc.4 to 0.9.4, checked against the Bluetooth spec test vector, andimageproc0.27).Tests
2 → 57 unit tests (52 app, 5 applet): real packet bytes, Bluetooth Core Spec vectors for the RPA hash, FIPS-197 for AES, the packet handler end to end, the IPC protocol and the app/applet JSON contract, low-battery rules, single instance, and UI smoke tests for every page in both layouts.
Notes for testing
ControllerMode = bredrmay still be needed to pair if the pairing helper doesn't succeed on a given adapter; the helper's error message says so.Experimental = trueis needed for the LE advertisement monitor (case battery from broadcasts); the app logs how to enable it.libxkbcommon-dev.