library to connect apps i made n shit
  • C++ 80.2%
  • CMake 12.9%
  • Shell 6.4%
  • C 0.5%
Find a file
Alex 72536dade7 Add SUMMARY.md
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-22 12:30:06 +02:00
cmake Implement core library: Presence, hybrid Bus, launch helper 2026-07-21 21:56:38 +02:00
docs/superpowers/specs Add design spec for milfs-connect cross-app connector library 2026-07-21 21:43:57 +02:00
include/MilfsConnect Implement core library: Presence, hybrid Bus, launch helper 2026-07-21 21:56:38 +02:00
src Fix Presence::isRunning detection, harden log-watcher self-heal, add PKGBUILD 2026-07-21 22:20:29 +02:00
tests Implement core library: Presence, hybrid Bus, launch helper 2026-07-21 21:56:38 +02:00
.gitignore Fix static archive corruption from LTO stripping in packaging 2026-07-22 12:21:05 +02:00
CMakeLists.txt Fix Presence::isRunning detection, harden log-watcher self-heal, add PKGBUILD 2026-07-21 22:20:29 +02:00
PKGBUILD Fix static archive corruption from LTO stripping in packaging 2026-07-22 12:21:05 +02:00
README.md Fix Presence::isRunning detection, harden log-watcher self-heal, add PKGBUILD 2026-07-21 22:20:29 +02:00
SUMMARY.md Add SUMMARY.md 2026-07-22 12:30:06 +02:00

milfs-connect

A small Qt6/C++ library that lets independently-built desktop apps on this machine feel like one system: apps announce events (e.g. "a new photo was saved"), other apps subscribe and react live, and apps can deep-link into each other. No app needs to know about any other app's internals - they only agree on event-type names and payload shapes by convention.

Why

Built to connect Recamara (a camera app) and KaderGallery (a photo gallery), but nothing in this library is specific to either. Any future app links this and joins the same bus.

What it provides

  • MilfsConnect::Presence - is another app installed (isInstalled), or currently running (isRunning, best-effort, requires the other app to own a party.milfs.<appId> D-Bus name).
  • MilfsConnect::Bus - announce(eventType, payload) / subscribe(handler). Delivery is hybrid: every event is emitted live as a D-Bus signal and durably appended to a JSON-lines log (~/.local/share/milfs-connect/events.jsonl), so a subscriber that wasn't running when an event fired still catches up on its next subscribe() call (each subscriber's read position is tracked per-appId). The D-Bus signal is just a low-latency nudge to re-check the log; the log is the single source of truth for delivery and dedup, so nothing is delivered twice regardless of which path noticed it first.
  • MilfsConnect::launch(appId, args) - resolve another app's .desktop entry and start it detached with the given arguments, for deep-linking.

Conventions

Producer/consumer apps agree on event shapes themselves; the library has no built-in knowledge of any specific event. The first one in use:

  • media.added - {"path": "<abs path>", "mimeType": "<mime>", "sourceApp": "<appId>"}, announced by an app after it saves a new photo/video.

Apps that want to support being deep-linked to a specific item should accept a bare file path as their first CLI argument (i.e. myapp /abs/path/to/file), matching the existing %f/%u desktop-entry convention most apps already implement for "open with".

Using it

find_package(MilfsConnect REQUIRED)
target_link_libraries(your_app PRIVATE MilfsConnect::MilfsConnect)
#include <MilfsConnect/Connect.h>

MilfsConnect::Bus bus(QStringLiteral("your-app-id"));
bus.announce(QStringLiteral("media.added"), {
    {QStringLiteral("path"), path},
    {QStringLiteral("mimeType"), QStringLiteral("image/jpeg")},
    {QStringLiteral("sourceApp"), QStringLiteral("your-app-id")},
});

bus.subscribe([](const QString &appId, const QString &eventType, const QVariantMap &payload) {
    if (eventType == QStringLiteral("media.added")) {
        // ingest payload["path"]
    }
});

Building

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j
ctest --test-dir build