Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 47 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ A cross-platform, remote desktop (started as a couch keyboard replacement utiliz

## Why?

Quality couch keyboards are not so accessible, STT on Linux isnt in a good state, so we can take advantage of STT on mobile, plus use the phone as a controller for casual gaming.
Quality couch keyboards are not so accessible, STT on Linux isn't in a good state, so we can take advantage of STT on mobile, plus use the phone as a controller for casual gaming.

## Tech Stack

Expand All @@ -27,17 +27,58 @@ Quality couch keyboards are not so accessible, STT on Linux isn’t in a good st
> [!NOTE]
> **For Linux:** On Wayland, the `ydotoold` daemon must be running and your user must be part of the `ydotool` group. Additionally, some native dependencies are required : install them via your package manager (see [`shell.nix`](shell.nix) for the list), or use `nix-shell` directly.

### NixOS

Rein provides a `shell.nix` for a fully reproducible NixOS development environment.

**Enter the dev shell:**
```bash
nix-shell
```

This sets up all required native libraries and makes `ydotool`, `appimage-run`, and `nodejs_24` available automatically.

**Wayland input setup (one time only):**
```bash
# Add your user to the ydotool group
sudo usermod -aG ydotool $USER

# Re-login, then enable the daemon
sudo systemctl enable --now ydotoold
```

**Running the built AppImage on NixOS:**
```bash
npm run dist
appimage-run ./dist/Rein-*.AppImage
```

**Firewall (nftables):**

Add to your `configuration.nix`, then run `sudo nixos-rebuild switch`:
```nix
networking.firewall.allowedTCPPorts = [ 3000 ];
```

**Troubleshooting:**

| Error | Fix |
|-------|-----|
| `Failed to open /dev/uinput` | Run `sudo systemctl start ydotoold` |
| `error while loading shared libraries: libX11.so` | Make sure you are inside `nix-shell` |
| Electron crashes on launch | `LD_LIBRARY_PATH` must be set — the `shellHook` does this automatically |
| AppImage won't start | Use `appimage-run ./dist/Rein-*.AppImage`, not `./dist/Rein-*.AppImage` directly |
Comment on lines +30 to +70

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add blank lines around fenced code blocks for markdown compliance.

Several fenced code blocks in the NixOS section are missing blank lines before or after them, which violates markdown formatting best practices (MD031). This affects readability and consistency.

📝 Proposed fix to add blank lines
 **Enter the dev shell:**
+
 ```bash
 nix-shell

This sets up all required native libraries and makes ydotool, appimage-run, and nodejs_24 available automatically.

Wayland input setup (one time only):
+

# Add your user to the ydotool group
sudo usermod -aG ydotool $USER

# Re-login, then enable the daemon
sudo systemctl enable --now ydotoold

Running the built AppImage on NixOS:
+

npm run dist
appimage-run ./dist/Rein-*.AppImage

Firewall (nftables):

Add to your configuration.nix, then run sudo nixos-rebuild switch:
+

networking.firewall.allowedTCPPorts = [ 3000 ];
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 35-35: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 42-42: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 51-51: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 59-59: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @README.md around lines 30 - 70, The fenced code blocks in the NixOS section
(the three bash blocks that wrap the nix-shell command, the Wayland input setup commands, the AppImage run commands, and the nix block for
networking.firewall.allowedTCPPorts) need a blank line before and after each
fence to satisfy MD031; edit the README.md NixOS section to insert an empty line
immediately above and below each bash and nix fenced block so Markdown
renders correctly and linting passes.


</details>

<!-- fingerprinting:phantom:poseidon:puma -->

<!-- cr-comment:v1:cb1bda0fdc8eef576d4a8720 -->

_Source: Linters/SAST tools_

<!-- This is an auto-generated comment by CodeRabbit -->


### Quick Start

1. Install dependencies:
```bash
```bash
npm install
```
```
2. Start the development server:
```bash
```bash
npm run dev
```
```
Comment on lines +75 to +81

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add blank lines around fenced code blocks in Quick Start.

The bash code blocks are missing surrounding blank lines, causing markdown formatting violations (MD031).

📝 Proposed fix
 1.  Install dependencies:
+
 ```bash
     npm install
  1. Start the development server:
    npm run dev
  1. Open the local app: http://localhost:3000
</details>

<details>
<summary>🧰 Tools</summary>

<details>
<summary>🪛 markdownlint-cli2 (0.22.1)</summary>

[warning] 75-75: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 77-77: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 78-78: Ordered list item prefix
Expected: 1; Actual: 2; Style: 1/1/1

(MD029, ol-prefix)

---

[warning] 79-79: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

---

[warning] 81-81: Fenced code blocks should be surrounded by blank lines

(MD031, blanks-around-fences)

</details>

</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @README.md around lines 75 - 81, Quick Start's fenced bash code blocks lack
surrounding blank lines, triggering MD031; edit the README.md Quick Start
section to add a blank line before and after each bash code block (the two occurrences of bash around "npm install" and "npm run dev"), and ensure
there's a blank line after the closing fences and before the next numbered step
(also add a blank line before the "Open the local app" line if present) so each
fenced block is separated from adjacent text.


</details>

<!-- fingerprinting:phantom:poseidon:puma -->

<!-- cr-comment:v1:0dee14dfc288159491979e54 -->

_Source: Linters/SAST tools_

<!-- This is an auto-generated comment by CodeRabbit -->

3. Open the local app: `http://localhost:3000`

## How to Use (Remote Control)
Expand Down Expand Up @@ -69,7 +110,6 @@ Visit the [Discord Channel](https://discord.com/invite/C8wHmwtczs) for interacti

---


## Testing Rein on Virtual Machines

When testing Rein inside a Virtual Machine (VirtualBox), the VM must allow devices on the same network to access the server.
Expand All @@ -87,7 +127,6 @@ This allows devices on the same LAN to connect to the Rein server running inside

Grant Accessibility permission to your terminal/IDE in System Settings → Privacy & Security → Accessibility.


---

## Expected Architecture
Expand Down Expand Up @@ -198,6 +237,4 @@ flowchart TD
| **Screen mirroring** | `getDisplayMedia()` feeds a MediaTrack directly into the `RTCPeerConnection`. The phone renders it in a `<video>` element. The server never handles video frames. |
| **Client settings** | Sensitivity, scroll invert, and theme are stored in `localStorage` on the phone only — no server round-trip. |
| **Server settings** | Port changes call `POST /api/config`, which writes `server-config.json`. The client redirects to the new port URL. The change is picked up on the next server start. |
| **Input injection** | Input events arrive at the server via the DataChannel bridge, dispatched through `InputHandler` (throttle + validation), and injected at OS level via a virtual input device. |


| **Input injection** | Input events arrive at the server via the DataChannel bridge, dispatched through `InputHandler` (throttle + validation), and injected at OS level via a virtual input device. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Add trailing newline at end of file.

Markdown files should end with a single newline character (MD047) for POSIX text file compliance and cleaner git diffs.

📝 Proposed fix
 | **Input injection** | Input events arrive at the server via the DataChannel bridge, dispatched through `InputHandler` (throttle + validation), and injected at OS level via a virtual input device. |
+
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
| **Input injection** | Input events arrive at the server via the DataChannel bridge, dispatched through `InputHandler` (throttle + validation), and injected at OS level via a virtual input device. |
| **Input injection** | Input events arrive at the server via the DataChannel bridge, dispatched through `InputHandler` (throttle + validation), and injected at OS level via a virtual input device. |
🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 240-240: Files should end with a single newline character

(MD047, single-trailing-newline)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` at line 240, The README.md file is missing a trailing newline;
open the file and ensure it ends with a single newline character (add one blank
line/line break at EOF) so the final line containing the description of Input
injection (mentioning DataChannel bridge, InputHandler, virtual input device)
terminates with a POSIX-compliant newline.

Source: Linters/SAST tools

25 changes: 18 additions & 7 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,35 @@ let
libxtst
libx11
libxext
libxrandr
libxcomposite
libxdamage
libxfixes
git
];
in

pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_24
procps
appimage-run
ydotool
] ++ sharedLibs;

shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath sharedLibs}:$LD_LIBRARY_PATH
alias g="git"
# git clone https://github.com/AOSSIE-Org/Rein .
npm i
npm run dist
appimage-run ./dist/Rein-1.0.0.AppImage
# npm run electron-dev
'';
}

echo ""
echo "=== Rein NixOS Dev Shell ==="
echo "Run 'npm install' to install dependencies"
echo "Run 'npm run dev' to start the dev server"
echo "Run 'npm run dist && appimage-run ./dist/Rein-*.AppImage' to build and run"
echo ""
echo "NOTE (Wayland): Ensure ydotoold is running and your user is in the 'ydotool' group:"
echo " sudo usermod -aG ydotool \$USER (then re-login)"
echo " sudo systemctl start ydotoold"
echo ""
'';
}