mirror of
https://github.com/morluto/rea.git
synced 2026-11-22 22:45:47 +00:00
The desktop application capture workflow constructed the desktop provider's X11 window observer and content store and called its session runner, application inventory, program lookup and home-folder walker directly. src/ports/DesktopApplicationSession.ts now names them as DesktopCaptureProvider, with the plan, outcome, request and walk types they exchange; src/desktop/DesktopCaptureProvider.ts implements it and the CLI passes it in the capture host. application -> desktop entry imports: 20 -> 14. Refs #11583
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import type { DesktopCaptureProvider } from "../ports/DesktopApplicationSession.js";
|
|
import {
|
|
runDesktopSession,
|
|
runningApplicationWindows,
|
|
} from "./DesktopApplicationSession.js";
|
|
import { DesktopContentStore } from "./DesktopContentStore.js";
|
|
import { walkHomeState } from "./HomeStateWalker.js";
|
|
import { inspectLinuxApplication } from "./LinuxApplicationInventory.js";
|
|
import { resolveProgram } from "./ProgramLookup.js";
|
|
import { X11WindowObserver } from "./X11WindowObserver.js";
|
|
|
|
/**
|
|
* The desktop provider's implementation of the capture port: `xprop` window
|
|
* observation, the supervised session runner, the home-folder walker and the
|
|
* content-addressed store under the capture directory.
|
|
*/
|
|
export const createDesktopCaptureProvider = (): DesktopCaptureProvider => ({
|
|
resolveProgram,
|
|
inspectApplication: (request, signal) =>
|
|
inspectLinuxApplication(request, signal),
|
|
observeWindows: (xprop, environment) =>
|
|
new X11WindowObserver(xprop, environment),
|
|
runningApplicationWindows,
|
|
runSession: runDesktopSession,
|
|
walkHome: walkHomeState,
|
|
openContentStore: async (directory, maxFileBytes, maxContentBytes) => {
|
|
const store = new DesktopContentStore(
|
|
directory,
|
|
maxFileBytes,
|
|
maxContentBytes,
|
|
);
|
|
await store.prepare();
|
|
return store;
|
|
},
|
|
});
|