-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathdesktop_command.hpp
More file actions
46 lines (35 loc) · 1.49 KB
/
Copy pathdesktop_command.hpp
File metadata and controls
46 lines (35 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#pragma once
#include "../desktop/open_request.hpp"
#include <filesystem>
#include <functional>
#include <string>
#include <vector>
namespace acecode {
class CommandRegistry;
struct DesktopLaunchResult {
bool ok = false;
std::filesystem::path executable;
std::string error;
};
using DesktopProcessSpawner =
std::function<bool(const std::vector<std::string>& argv)>;
using DesktopLauncher = std::function<DesktopLaunchResult(
const desktop::DesktopOpenRequest& request)>;
// Resolve the flat-layout desktop binary beside the running acecode binary.
std::filesystem::path sibling_desktop_executable(
const std::filesystem::path& acecode_executable);
// Validate and launch a desktop sibling through an injectable detached-process
// seam. The spawner receives argv[0] followed by the current TUI workspace and
// session as separate arguments.
DesktopLaunchResult launch_sibling_desktop(
const std::filesystem::path& acecode_executable,
const desktop::DesktopOpenRequest& request,
const DesktopProcessSpawner& spawn_process);
// Production launcher: resolve the current process through the native daemon
// platform layer, then start its desktop sibling detached.
DesktopLaunchResult launch_sibling_desktop(
const desktop::DesktopOpenRequest& request);
// Register /desktop. Tests may inject a launcher to avoid creating a process.
void register_desktop_command(CommandRegistry& registry,
DesktopLauncher launcher = {});
} // namespace acecode