Skip to content

zvakanaka/remote-pi-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Remote Pi Web

Operate your Raspberry Pi (or any Linux machine) from a web browser. Streams the screen as MJPEG and accepts mouse and keyboard input over a socket connection.

Screen capture

Requirements

  • Node.js
  • System dependencies depending on your display server (see below)

Installation

git clone https://github.com/zvakanaka/remote-pi-web
cd remote-pi-web
npm install

Then install the dependencies for your display server below and run npm start.

Wayland — Sway and other wlroots-based compositors

Install build dependencies and runtime tools:

sudo apt install libwayland-dev wayland-scanner wtype

Install dotool for mouse control (the dotoold daemon must be running):

sudo apt install libxkbcommon-dev scdoc
git clone https://git.sr.ht/~geb/dotool
cd dotool
./build.sh
sudo ./build.sh install

Grant /dev/uinput access:

sudo cp /usr/local/share/dotool/80-dotool.rules /etc/udev/rules.d/
sudo udevadm control --reload
sudo udevadm trigger
sudo usermod -aG input $USER
# log out and back in for the group change to take effect

Start the daemon. To start it for the current session only:

dotoold &

To start it automatically with Sway, add to ~/.config/sway/config:

exec dotoold

To run it as a persistent systemd user service:

cat > ~/.config/systemd/user/dotoold.service << 'EOF'
[Unit]
Description=dotool input daemon

[Service]
ExecStart=dotoold
Restart=on-failure

[Install]
WantedBy=default.target
EOF

systemctl --user enable --now dotoold

Run the server:

npm start

Wayland — GNOME (Ubuntu 24.04)

Screen capture uses org.gnome.Mutter.ScreenCast via D-Bus, PipeWire, and GStreamer:

sudo apt install python3-gi python3-dbus gir1.2-gstreamer-1.0 gir1.2-gst-plugins-base-1.0 gstreamer1.0-pipewire

Mouse and keyboard use dotool (no daemon needed here — it is spawned directly). Install from source and grant uinput access as shown in the Sway section above.

Run the server:

XDG_SESSION_TYPE=wayland XDG_CURRENT_DESKTOP=GNOME npm start

X11 (older systems)

For older hardware or systems still running X11.

sudo apt install libx11-dev xdotool

Run the server:

env DISPLAY=:0 npm start

Configuration

The following environment variables can be set at startup:

Variable Default Description
QUALITY 25 JPEG quality (1–100)
CAPTURE_INTERVAL 500 Milliseconds between screen captures
VIEW_ONLY false Disable mouse and keyboard input
CAPTURE_METHOD native Set to scrot to use scrot instead

Raspberry Pi screen setup

If your Pi has no physical display attached, you can force HDMI output by editing /boot/config.txt and uncommenting:

hdmi_safe=1

Testing

npm run postinstall && npm test && xdg-open output.jpg

About

Web app alternative to VNC for Wayland and X11 (meant for Raspberry Pi)

Topics

Resources

Stars

Watchers

Forks

Contributors