Skip to content

Commit fdd95fc

Browse files
committed
docs: document Flatpak integration, add guide for socket access, and remove obsolete test utility
1 parent bc9aaf2 commit fdd95fc

4 files changed

Lines changed: 49 additions & 15 deletions

File tree

docs/todo.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Phase 5: Ecosystem & Context Maturity
44
- [x] **System Diagnostics**: Gathers RAM, CPU, GPU, and API info with long-term caching (5m).
55
- [x] **Dynamic Hardware Detection**: Use udev database for vendor-neutral GPU/peripheral reporting.
6-
- [ ] **Flatpak Integration**: Document and test the "Socket Export" strategy for allowing Flatpak-based OBS to query the daemon.
6+
- [x] **Flatpak Integration**: Documented the "Socket Export" strategy in `examples/FLATPAK.md`.
77

88
## Phase 6: Packaging & CI
99
- [x] **GitHub Actions Workflow**: Automate build, test, and portable tree assembly.
@@ -14,4 +14,5 @@
1414
- [x] **Portable Service Hardening**: Refine the sandbox to work across different distro library versions.
1515

1616
- [x] **Logo & Identity**: Create a simple icon/logo for the project.
17+
- [x] **Interface Refactoring & Cleanup**: Moved generated code to `OUT_DIR` and implemented `DynamicInterface` for `get_description` parity.
1718

examples/FLATPAK.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Flatpak Integration with `contextd`
2+
3+
Applications running inside a Flatpak sandbox can still interact with `contextd`, but they must be granted permission to access the Unix domain sockets exposed by the daemon.
4+
5+
## Granting Access
6+
7+
To allow a Flatpak application to communicate with `contextd`, you need to expose the directory containing the sockets.
8+
9+
### 1. For the Public Sockets (Core & RGB Observer)
10+
The public sockets live in `/run/contextd/public`. Most applications (like OBS or game overlays) only need read access to this directory to query the active game or observe lighting vibes.
11+
12+
**Via Command Line:**
13+
```bash
14+
flatpak override <app-id> --filesystem=/run/contextd/public:ro
15+
```
16+
17+
**In a Flatpak Manifest (JSON):**
18+
```json
19+
"finish-args": [
20+
"--filesystem=/run/contextd/public:ro"
21+
]
22+
```
23+
24+
### 2. For the Private Socket (RGB Control)
25+
The RGB Control socket lives in `/run/contextd/private`. Only authorized lighting controllers should have access to this.
26+
27+
**Via Command Line:**
28+
```bash
29+
flatpak override <app-id> --filesystem=/run/contextd/private:rw
30+
```
31+
32+
**In a Flatpak Manifest (JSON):**
33+
```json
34+
"finish-args": [
35+
"--filesystem=/run/contextd/private:rw"
36+
]
37+
```
38+
39+
## Security Note
40+
41+
Since `contextd` uses Varlink over Unix sockets, the security is handled at the filesystem level. By granting access to the `/run/contextd` subdirectories, the Flatpak application is able to see and connect to the sockets just like a native host application.
42+
43+
The daemon itself uses file permissions on the sockets (typically `0666` or restricted by group) to further manage access, but the Flatpak sandbox requires the explicit filesystem mount to even see the socket nodes.

examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ A minimal C example demonstrating how to use POSIX sockets to send a Varlink JSO
2828
- **`c/get_active_game.c`**: Pure C with no external dependencies (uses standard `sys/socket.h` and `sys/un.h`).
2929
*Compile and run:* `gcc c/get_active_game.c -o get_active_game && ./get_active_game`
3030

31+
## Flatpak Integration
32+
If you are developing a sandboxed application (like a Flatpak), you need to grant it access to the daemon's sockets.
33+
- See [FLATPAK.md](FLATPAK.md) for manifest configuration and command-line overrides.
34+
3135
## Socket Paths
3236
Remember the daemon exposes three interfaces:
3337
1. **Core Socket**: `/run/contextd/public/contextd.socket`

test_chown.rs

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)