### Start Basic VNC Server
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Starts a VNC server on a specified port with a custom desktop name. Ensure the port is not already in use.
```sh
trollvncserver -p 5901 -n "My iPhone"
```
--------------------------------
### TrollVNC Server Performance Presets
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Examples of launching the trollvncserver with different command-line arguments to optimize for various network conditions and quality requirements.
```sh
# Low-latency interactive (LAN)
trollvncserver -p 5901 -n "My iPhone" -s 0.75 -d 0.008 -Q 1 -t 32 -P 35 -R 512
# Battery/bandwidth saver (cellular / WAN)
trollvncserver -p 5901 -n "My iPhone" -s 0.5 -d 0.025 -Q 2 -t 64 -P 50 -R 128
# High quality on fast LAN (pixel-perfect)
trollvncserver -p 5901 -n "My iPhone" -s 1.0 -d 0.012 -Q 2 -t 32 -P 30 -R 512
```
--------------------------------
### Enable noVNC Web Client with TLS
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Starts a VNC server and embeds a noVNC web client accessible via HTTPS. Requires valid SSL certificate and key files.
```sh
trollvncserver -p 5901 -H 5801 \
-e /usr/share/trollvnc/ssl/host/cert.pem \
-k /usr/share/trollvnc/ssl/host/key.pem
```
--------------------------------
### Start TrollVNC with Secure WebSockets (WSS)
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Launch the TrollVNC server with WSS enabled by providing paths to the certificate and private key files. This ensures encrypted WebSocket communication.
```sh
trollvncserver -p 5901 -H 5801 \
-e /usr/share/trollvnc/ssl/192.168.2.100/cert.pem \
-k /usr/share/trollvnc/ssl/192.168.2.100/key.pem
```
--------------------------------
### Managed Configuration (Managed.plist) Example
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
This XML plist file configures TrollVNC settings for fleet or enterprise deployments. When present, it locks all settings and displays a 'managed by your organization' banner.
```xml
Enabled
DesktopName Fleet iPhone
BindHost 192.168.10.5
Port 5901
Scale 0.75
FrameRateSpec 30:60:120
DeferWindowSec 0.012
MaxInflight 2
TileSize 32
FullscreenThresholdPercent 35
MaxRects 512
FullPassword editpass
ViewOnlyPassword viewpass
HttpPort 5801
HttpDir /usr/share/trollvnc/webclients
SslCertFile /usr/share/trollvnc/ssl/host/cert.pem
SslKeyFile /usr/share/trollvnc/ssl/host/key.pem
ReverseMode viewer
ReverseSocket 203.0.113.10:5500
ViewOnly
OrientationSync
NaturalScroll
ModifierMap std
AutoAssistEnabled
ServerCursor
WheelTuning amp=0.25,cap=1.0,max=256
ClipboardEnabled
KeepAliveSec 15
BonjourEnabled
SingleNotifEnabled
ClientNotifsEnabled
KeyLogging
```
--------------------------------
### Enable HTTP Server for noVNC
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Start the built-in HTTP server to serve the noVNC browser client. Specify the port for the HTTP server and optionally a custom directory for web client files.
```sh
# Enable web client on port 5801 using the default web root
trollvncserver -p 5901 -H 5801
```
```sh
# Enable web client on port 8081 with a custom web root
trollvncserver -p 5901 -H 8081 -D /var/www/trollvnc/webclients
```
--------------------------------
### Run TrollVNC Server
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
This command starts the TrollVNC server on an iOS device or simulator. Configure options to customize its behavior.
```sh
trollvncserver -p 5901 -n "My iPhone" [options]
```
--------------------------------
### Initialize RFB and Connect to VNC Server
Source: https://github.com/owngoalstudio/trollvnc/blob/main/layout/usr/share/trollvnc/webclients/novnc/vnc_lite.html
This snippet initializes the RFB object, which starts a new VNC connection. It constructs the WebSocket URL based on query parameters and attaches event listeners for connection status and authentication.
```javascript
let rfb;
// Read parameters specified in the URL query string
// By default, use the host and port of server that served this file
const host = readQueryVariable('host', window.location.hostname);
let port = readQueryVariable('port', window.location.port);
const password = readQueryVariable('password');
const path = readQueryVariable('path', 'websockify');
// | | | | | | // | | | Connect | | | // v v v v v v
status("Connecting");
// Build the websocket URL used to connect
let url;
if (window.location.protocol === "https:") {
url = 'wss';
} else {
url = 'ws';
}
url += '://' + host;
if(port) {
url += ':' + port;
}
url += '/' + path;
// Creating a new RFB object will start a new connection
rfb = new RFB(document.getElementById('screen'), url, {
credentials: { password: password }
});
// Add listeners to important events from the RFB module
rfb.addEventListener("connect", connectedToServer);
rfb.addEventListener("disconnect", disconnectedFromServer);
rfb.addEventListener("credentialsrequired", credentialsAreRequired);
rfb.addEventListener("desktopname", updateDesktopName);
// Set parameters that can be changed on an active connection
rfb.viewOnly = readQueryVariable('view_only', false);
rfb.scaleViewport = readQueryVariable('scale', false);
```
--------------------------------
### Generate Local CA Certificate
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Example command to generate a local Certificate Authority (CA) using minica for secure WebSocket (WSS) connections. This is a prerequisite for setting up TLS.
```sh
brew install minica
minica -ip-addresses "192.168.2.100"
```
--------------------------------
### Copy Certificate and Key to Device
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Securely copy the generated host certificate and private key to the server's designated SSL directory using scp. This is part of the WSS setup.
```sh
scp -r 192.168.2.100 root@192.168.2.100:/usr/share/trollvnc/ssl/
```
--------------------------------
### Control Socket Commands
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Interact with the TrollVNC server via its control socket to manage client connections. Ensure the server is started with the `-c` flag to enable this functionality.
```APIDOC
## Control Socket API
When `-c port` is non-zero, `trollvncserver` listens on `127.0.0.1:` for line-delimited text commands. This provides a local programmatic interface for monitoring and managing connected clients.
### Commands
- **count**
- Description: Get the number of currently connected clients.
- Example:
```sh
echo "count" | nc 127.0.0.1
```
- Response Example:
```
2
```
- **list**
- Description: List all connected clients with their ID, address, and state.
- Example:
```sh
echo "list" | nc 127.0.0.1
```
- Response Example (TSV):
```
1 192.168.1.5 active
2 192.168.1.8 active
```
- **subscribe on**
- Description: Subscribe to receive notifications for client connection and disconnection events.
- Example:
```sh
(echo "subscribe on"; sleep 60) | nc 127.0.0.1
```
- Response Example (on event):
```
changed
```
- **subscribe off**
- Description: Unsubscribe from client change event notifications.
- Example:
```sh
echo "subscribe off" | nc 127.0.0.1
```
- **disconnect [id]**
- Description: Disconnect a specific client by its ID.
- Example:
```sh
echo "disconnect 1" | nc 127.0.0.1
```
- **kick ALL**
- Description: Disconnect all currently connected clients.
- Example:
```sh
echo "kick ALL" | nc 127.0.0.1
```
- **block [id]**
- Description: Block a specific client by its ID, preventing it from reconnecting.
- Example:
```sh
echo "block 2" | nc 127.0.0.1
```
*Note: Replace `` with the actual port number configured with the `-c` flag.*
```
--------------------------------
### Configure TRWatchDog for TrollVNC Server
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Configure and start TRWatchDog to supervise the trollvncserver process. This includes setting executable path, arguments, environment variables, working directory, user, group, keep-alive behavior, throttling, exit timeouts, and log file redirection.
```objc
#import "TRWatchDog.h"
TRWatchDog *watchdog = [[TRWatchDog alloc] init];
// Configure the watched process
watchdog.executableURL = [NSURL fileURLWithPath:@"/usr/bin/trollvncserver"];
watchdog.arguments = @[@"-daemon"];
watchdog.environmentVariables = @{
@"TROLLVNC_PASSWORD": @"secret",
@"TROLLVNC_REPEATER_RETRY_INTERVAL": @"30.0"
};
watchdog.workingDirectory = [NSURL fileURLWithPath:@"/var/mobile"];
watchdog.userName = @"mobile";
watchdog.groupName = @"mobile";
// Keep-alive: restart the process if it exits for any reason
watchdog.keepAlive = YES;
watchdog.throttleInterval = 5.0; // wait at least 5s between restarts
watchdog.exitTimeOut = 3.0; // send SIGKILL 3s after SIGTERM if not exited
// Redirect stdout/stderr to log files
watchdog.standardOutputPath = @"/var/mobile/Library/Caches/trollvnc-stdout.log";
watchdog.standardErrorPath = @"/var/mobile/Library/Caches/trollvnc-stderr.log";
// Start supervision
[watchdog start];
// Restart the supervised process (if running, sends SIGTERM then re-starts)
[watchdog restart];
// Stop supervision and the child process
[watchdog stop];
```
--------------------------------
### Generate Managed.plist with Environment Variables
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
This shell script generates the Managed.plist file using environment variables, suitable for CI or scripted deployments. It supports various configurations, including reverse connections and full LAN setups with TLS.
```sh
# Minimal reverse-connection deployment
export TVNC_ENABLED=true
export TVNC_DESKTOP_NAME="My iPhone"
export TVNC_REVERSE_MODE=viewer
export TVNC_REVERSE_SOCKET=203.0.113.10:5500
export TVNC_CLIPBOARD_ENABLED=true
export TVNC_KEEPALIVE_SEC=60
export TVNC_BONJOUR_ENABLED=false
bash devkit/gen-managed-plist.sh
# Output: Managed configuration generated at prefs/TrollVNCPrefs/Resources/Managed.plist
# Full LAN deployment with TLS and dirty detection
export TVNC_ENABLED=true
export TVNC_DESKTOP_NAME="Corp iPhone"
export TVNC_PORT=5901
export TVNC_SCALE=0.75
export TVNC_FRAME_RATE_SPEC="30:60:120"
export TVNC_DEFER_WINDOW_SEC=0.012
export TVNC_MAX_INFLIGHT=2
export TVNC_TILE_SIZE=32
export TVNC_FULLSCREEN_THRESHOLD_PERCENT=35
export TVNC_MAX_RECTS=512
export TVNC_HTTP_PORT=5801
export TVNC_HTTP_DIR=/usr/share/trollvnc/webclients
export TVNC_SSL_CERT_FILE=/usr/share/trollvnc/ssl/host/cert.pem
export TVNC_SSL_KEY_FILE=/usr/share/trollvnc/ssl/host/key.pem
export TVNC_FULL_PASSWORD=editpass
export TVNC_VIEWONLY_PASSWORD=viewpass
export TVNC_CLIPBOARD_ENABLED=true
export TVNC_ORIENTATION_SYNC=true
export TVNC_BONJOUR_ENABLED=false
bash devkit/gen-managed-plist.sh
```
--------------------------------
### ClipboardManager: Bidirectional Clipboard Sync
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Manages clipboard synchronization between local and remote sources. Registers a change handler for local changes and allows setting the pasteboard from a remote source without echoing back. Ensure to call start() to begin listening and stop() to end.
```objc
#import "ClipboardManager.h"
ClipboardManager *cb = [[ClipboardManager alloc] init];
// Register a change handler (called on main thread whenever clipboard changes locally)
cb.onChange = ^(NSString *newString, BOOL fromLocal) {
if (fromLocal) {
NSLog(@"Local clipboard changed → send to remote: %@", newString);
// Push to all connected VNC clients via rfbSendServerCutTextUTF8
} else {
NSLog(@"Remote clipboard applied locally: %@", newString);
}
};
// Start listening for pasteboard changes
[cb start];
// Receive clipboard text from a remote VNC client → set locally (suppresses echo)
[cb setStringFromRemote:@"Hello from remote"];
// Set clipboard locally (fires onChange with fromLocal=YES)
[cb setString:@"Hello from local"];
// Stop listening
[cb stop];
```
--------------------------------
### Control Socket API: Get Connected Client Count
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
When the control socket is enabled (via -c port), you can query the number of currently connected clients. This command sends 'count' to the control socket.
```bash
# --- Connect (port set via -c 46750) ---
# Get connected client count
echo "count" | nc 127.0.0.1 46750
# Output: 2
```
--------------------------------
### Control Socket API: Subscribe to Client Events
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Subscribe to server events to receive notifications when clients connect or disconnect. The server will push 'changed\n' to the socket upon such events. Ensure the subscription is kept alive, for example, by sleeping.
```bash
# Subscribe to change events (server pushes "changed\n" on connect/disconnect)
(echo "subscribe on"; sleep 60) | nc 127.0.0.1 46750
# Output when a client connects or disconnects:
# changed
```
--------------------------------
### Build TrollVNC with Theos
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
These commands demonstrate how to build TrollVNC using Theos, supporting four package schemes: legacy, rootless, roothide, and bootstrap. Use `build-all.sh` for all schemes or source specific scripts for individual builds.
```sh
# Build all four schemes (legacy, rootless, roothide, bootstrap)
bash devkit/build-all.sh
# Build a single scheme manually
source devkit/default.sh # legacy (elucubratus / Cydia)
FINALPACKAGE=1 gmake clean package
source devkit/rootless.sh # rootless (palera1n / Dopamine rootless)
FINALPACKAGE=1 gmake clean package
source devkit/roothide.sh # roothide (Dopamine roothide)
FINALPACKAGE=1 gmake clean package
source devkit/bootstrap.sh # bootstrap / THEBOOTSTRAP (roothide + manager + app)
FINALPACKAGE=1 gmake clean package
```
--------------------------------
### LaunchDaemon Control (Rootless Jailbreak)
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Manually load or unload the TrollVNC launch daemon for rootless jailbreaks, prefixing the path with `/var/jb`.
```sh
# Rootless jailbreak (prefix with /var/jb)
launchctl load -w -F /var/jb/Library/LaunchDaemons/com.82flex.trollvnc.plist
launchctl unload /var/jb/Library/LaunchDaemons/com.82flex.trollvnc.plist
```
--------------------------------
### Minimal TrollVNC Configuration
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Use this minimal configuration for a reverse connection to a listening viewer with a custom desktop name. It enables the clipboard and sets a keep-alive interval.
```xml
Enabled
DesktopName
My iPhone
ReverseMode
viewer
ReverseSocket
203.0.113.10:5500
ClipboardEnabled
KeepAliveSec
60
```
--------------------------------
### Configure VNC Authentication
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Set up classic VNC password authentication using environment variables. This enables password protection for server access.
```sh
export TROLLVNC_PASSWORD=editpass
export TROLLVNC_VIEWONLY_PASSWORD=viewpass # optional
trollvncserver -p 5901 -n "My iPhone"
```
--------------------------------
### Build TrollVNC for Simulator
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Set the environment variable for simulator builds and then clean and package the project.
```sh
export THEOS_DEVICE_SIMULATOR=1
gmake clean package
```
--------------------------------
### Manual Control of LaunchDaemon (Legacy Root)
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Manually load or unload the TrollVNC launch daemon using `launchctl` for legacy root jailbreaks.
```sh
# Manual control (legacy root jailbreak)
launchctl load -w -F /Library/LaunchDaemons/com.82flex.trollvnc.plist
launchctl unload /Library/LaunchDaemons/com.82flex.trollvnc.plist
```
--------------------------------
### Print Full TrollVNC Server Usage
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Use the -h flag to display all available command-line options and their descriptions. This is useful for understanding the server's configuration capabilities.
```bash
trollvncserver -h
```
--------------------------------
### TrollVNC Server: Wheel Scroll Tuning Options
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Configures wheel scroll emulation as drag gestures using command-line arguments or a plist key. Adjust parameters like step, coalesce, max, clamp, amp, cap, minratio, durbase, durk, durmin, durmax, and natural for desired scrolling behavior.
```sh
trollvncserver -p 5901 -W 32 -w minratio=0.3,durbase=0.06,durmax=0.16
```
```sh
trollvncserver -p 5901 -W 64 -w amp=0.25,cap=1.0,max=256,clamp=3.0
```
```sh
trollvncserver -p 5901 -w minratio=0.5,durbase=0.055
```
```sh
trollvncserver -p 5901 -N
```
```sh
trollvncserver -p 5901 -w natural=1
```
```sh
trollvncserver -p 5901 -W 0
```
--------------------------------
### Initiate Reverse VNC Connection
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Establishes a reverse connection where the VNC server dials out to a listening VNC viewer. Useful for traversing firewalls.
```sh
trollvncserver -reverse 203.0.113.10:5500 -n "My iPhone"
```
--------------------------------
### Download Built TrollVNC Packages
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Download the built TrollVNC packages for different schemes after a workflow completes, using the run ID and package name.
```sh
# Download built packages after the workflow completes
gh run download --name packages-default # .deb (legacy)
gh run download --name packages-rootless # .deb (rootless)
gh run download --name packages-roothide # .deb (roothide)
gh run download --name packages-bootstrap # .tipa (bootstrap)
```
--------------------------------
### Wheel/Scroll Tuning Parameters
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Configuration options for tuning wheel scroll events, which are emulated as drag gestures. These parameters can be set via the command line or a managed plist.
```APIDOC
## Wheel/Scroll Tuning
Wheel scroll events are emulated as short linear drag gestures. Tuning parameters are passed via `-w key=val,...` or the `WheelTuning` managed plist key.
```sh
# Smooth, slow scrolling
trollvncserver -p 5901 -W 32 -w minratio=0.3,durbase=0.06,durmax=0.16
# Fast, long scrolls (aggressive amplification)
trollvncserver -p 5901 -W 64 -w amp=0.25,cap=1.0,max=256,clamp=3.0
# More sensitive small scrolls
trollvncserver -p 5901 -w minratio=0.5,durbase=0.055
# Natural scroll direction
trollvncserver -p 5901 -N
# or via tuning key:
trollvncserver -p 5901 -w natural=1
# Disable wheel entirely
trollvncserver -p 5901 -W 0
```
| Key | Default | Description |
|-----|---------|-------------|
| `step` | `48` | Pixels per wheel tick (same as `-W`) |
| `coalesce` | `0.03` | Coalescing window in seconds (0–0.5) |
| `max` | `192` | Base max drag distance per gesture before clamp |
| `clamp` | `2.5` | Absolute clamp factor (final max = clamp × max) |
| `amp` | `0.18` | Velocity amplification for fast scrolls |
| `cap` | `0.75` | Max extra amplification |
| `minratio` | `0.35` | Minimum effective distance vs. step for tiny scrolls |
| `durbase` | `0.05` | Gesture duration base (seconds) |
| `durk` | `0.00016` | Duration factor applied to sqrt(distance) |
| `durmin` | `0.05` | Min gesture duration (seconds) |
| `durmax` | `0.14` | Max gesture duration (seconds) |
| `natural` | `0` | Natural scroll direction (1 = invert delta) |
```
--------------------------------
### Download Debug Symbols
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Download the debug symbols for the default build scheme after a workflow completes, using the run ID.
```sh
# Download debug symbols
gh run download --name dsym-default
```
--------------------------------
### Connect to Listening VNC Viewer
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Initiate a reverse connection from TrollVNC to a VNC viewer listening for inbound connections. Ensure your firewall allows inbound connections on the viewer's listening port.
```sh
trollvncserver -reverse 203.0.113.10:5500 -n "My iPhone"
```
```sh
trollvncserver -reverse [2001:db8::1]:5500 -n "My iPhone"
```
--------------------------------
### Configure VNC Server Performance
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Optimizes VNC output by scaling the display and limiting the frame rate and in-flight updates. Useful for managing bandwidth and responsiveness.
```sh
trollvncserver -p 5901 -n "My iPhone" -s 0.75 -F 30-60 -Q 1
```
--------------------------------
### TrollVNC Server Non-blocking Swap Option
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Adds the non-blocking swap option (`-a`) to any profile to potentially reduce stalls due to encoder contention. Remove if tearing becomes noticeable.
```sh
trollvncserver ... -a
```
--------------------------------
### Handle VNC Connection Events
Source: https://github.com/owngoalstudio/trollvnc/blob/main/layout/usr/share/trollvnc/webclients/novnc/vnc_lite.html
These functions are callbacks for various VNC connection events. They update the status display and handle required actions like prompting for credentials.
```javascript
// When this function is called we have // successfully connected to a server
function connectedToServer(e) {
status("Connected to " + desktopName);
}
// This function is called when we are disconnected
function disconnectedFromServer(e) {
if (e.detail.clean) {
status("Disconnected");
} else {
status("Something went wrong, connection is closed");
}
}
// When this function is called, the server requires // credentials to authenticate
function credentialsAreRequired(e) {
const password = prompt("Password Required:");
rfb.sendCredentials({ password: password });
}
// When this function is called we have received // a desktop name from the server
function updateDesktopName(e) {
desktopName = e.detail.name;
}
```
--------------------------------
### Control Socket API: Kick All Clients
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Disconnect all currently connected VNC clients simultaneously by sending the 'kick ALL' command to the control socket.
```bash
# Kick all connected clients
echo "kick ALL" | nc 127.0.0.1 46750
```
--------------------------------
### TrollVNC Server Older Devices (CPU-Limited) Preset
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Tailored for older or less powerful devices with CPU limitations. Reduces CPU load by lowering scaling and increasing tile size for more efficient dirty detection.
```sh
trollvncserver -p 5901 -n "My iPhone" -s 0.5 -d 0.02 -Q 1 -t 64 -P 40 -R 256
```
--------------------------------
### TrollVNC Server Low-latency Interactive (LAN) Preset
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Use this configuration for low-latency interactive sessions on a local area network. It balances responsiveness with reasonable resource usage.
```sh
trollvncserver -p 5901 -n "My iPhone" -s 0.75 -d 0.008 -Q 1 -t 32 -P 35 -R 512
```
--------------------------------
### Connect via UltraVNC Repeater Mode
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Connects to a VNC viewer through an UltraVNC Repeater using numeric repeater ID. Requires the repeater to be running and configured.
```sh
trollvncserver -repeater 12345679 repeater.example.com:5500 -n "My iPhone"
```
--------------------------------
### Connect to UltraVNC Repeater (Mode II)
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Establish a reverse connection through an UltraVNC Repeater. TrollVNC connects to the repeater's server port, and the viewer connects to the repeater's viewer port. Both connections are outbound.
```sh
trollvncserver -repeater 12345679 repeater.example.com:5500 -n "My iPhone"
```
```sh
trollvncserver -repeater 12345679 [2001:db8::1]:5500 -n "My iPhone"
```
--------------------------------
### Enable Dirty-Region Detection
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Activates dirty-region detection to save bandwidth on static screens by only sending updated areas. Requires tuning of detection and region parameters.
```sh
trollvncserver -p 5901 -n "My iPhone" -t 32 -P 35 -R 512
```
--------------------------------
### Bypass iOS OOM Killer with OhMyJetsam
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Link the OhMyJetsam.mm file into your binary to automatically prevent the iOS OOM killer (Jetsam) from terminating the VNC server by setting critical process parameters.
```objc
// Automatically called at startup via __attribute__((constructor(101)))
// No user code required — just link OhMyJetsam.mm into the binary.
//
// Equivalent manual call:
#include "OhMyJetsam.h"
BypassJetsam(); // sets priority=CRITICAL, HWM=-1, limit=1GB, not managed, not freezable
```
--------------------------------
### Trigger Managed TrollVNC Build via GitHub CLI
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Manually trigger a managed build workflow for TrollVNC using the GitHub CLI, specifying various parameters for the desktop environment and VNC connection.
```sh
# Manually trigger via GitHub CLI (standard managed build for a fleet deployment)
gh workflow run "Build TrollVNC" \
--field is_managed=true \
--field desktop_name="Corp iPhone" \
--field port=5901 \
--field scale=0.75 \
--field frame_rate_spec="30-60" \
--field modifier_map=std \
--field reverse_mode=none
```
--------------------------------
### TrollVNC Server High Quality (Fast LAN) Preset
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Provides high visual quality for fast local area network connections. Maximizes detail and smoothness at the cost of higher bandwidth and CPU usage.
```sh
trollvncserver -p 5901 -n "My iPhone" -s 1.0 -d 0.012 -Q 2 -t 32 -P 30 -R 512
```
--------------------------------
### Control Socket API: List Connected Clients
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Retrieve a tab-separated list of all connected clients, including their ID, address, and state. This helps in identifying and managing individual client sessions.
```bash
# List all connected clients (tab-separated: id, address, state)
echo "list" | nc 127.0.0.1 46750
# Output (TSV):
# 1 192.168.1.5 active
# 2 192.168.1.8 active
```
--------------------------------
### LAN TrollVNC Configuration with HTTP and TLS
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
This configuration enables the built-in HTTP client and TLS for local network access. It includes settings for port, scaling, frame rate, window deferral, and security credentials.
```xml
Enabled
DesktopName
TrollVNC
Port
5901
Scale
0.75
FrameRateSpec
30:60:120
DeferWindowSec
0.012
MaxInflight
2
TileSize
32
FullscreenThresholdPercent
35
MaxRects
512
HttpPort
5801
HttpDir
/usr/share/trollvnc/webclients
SslCertFile
/usr/share/trollvnc/ssl/host/cert.pem
SslKeyFile
/usr/share/trollvnc/ssl/host/key.pem
ClipboardEnabled
ViewOnly
FullPassword
editpass
ViewOnlyPassword
viewpass
```
--------------------------------
### TrollVNC Server Frame Rate Control (Full Range with Preferred)
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Defines the minimum, preferred, and maximum frame rates for the display link. On iOS 15+, this uses `preferredFrameRateRange`; on iOS 14, it uses `preferredFramesPerSecond`.
```sh
-F 30:60:120
```
--------------------------------
### Tune Scroll Wheel Behavior
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Adjust scroll wheel emulation parameters for smoother or faster scrolling. Use these options to customize the sensitivity and duration of scroll gestures.
```sh
trollvncserver ... -W 32 -w minratio=0.3,durbase=0.06,durmax=0.16
```
```sh
trollvncserver ... -W 64 -w amp=0.25,cap=1.0,max=256,clamp=3.0
```
```sh
trollvncserver ... -w minratio=0.5,durbase=0.055
```
```sh
trollvncserver ... -W 0
```
--------------------------------
### TrollVNC Server Keep-Alive (Prevent Sleep)
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Enables the keep-alive feature using the `-A` flag. This periodically sends a dummy key event to prevent the device from sleeping while clients are connected.
```sh
-A
```
--------------------------------
### Set VNC Passwords as Repository Secrets
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Set the full and view-only VNC passwords as repository secrets using the GitHub CLI. These secrets are used in managed builds.
```sh
# Set VNC passwords as repository secrets (used in managed builds)
gh secret set TVNC_FULL_PASSWORD --body "editpass"
gh secret set TVNC_VIEWONLY_PASSWORD --body "viewpass"
```
--------------------------------
### ClipboardManager API
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
The ClipboardManager facilitates bidirectional clipboard synchronization between the local device and remote VNC clients. It allows registering callbacks for clipboard changes and setting the clipboard content without causing echo effects.
```APIDOC
## ClipboardManager — Bidirectional Clipboard Sync API
`ClipboardManager` listens for `UIPasteboard` changes and delivers them to a callback, and allows setting the pasteboard from a remote source without echoing back.
```objc
#import "ClipboardManager.h"
ClipboardManager *cb = [[ClipboardManager alloc] init];
// Register a change handler (called on main thread whenever clipboard changes locally)
cb.onChange = ^(NSString *newString, BOOL fromLocal) {
if (fromLocal) {
NSLog(@"Local clipboard changed → send to remote: %@", newString);
// Push to all connected VNC clients via rfbSendServerCutTextUTF8
} else {
NSLog(@"Remote clipboard applied locally: %@", newString);
}
};
// Start listening for pasteboard changes
[cb start];
// Receive clipboard text from a remote VNC client → set locally (suppresses echo)
[cb setStringFromRemote:@"Hello from remote"];
// Set clipboard locally (fires onChange with fromLocal=YES)
[cb setString:@"Hello from local"];
// Stop listening
[cb stop];
```
```
--------------------------------
### TrollVNC Server Frame Rate Control (Single Value)
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Sets a single preferred frame rate for the display link. Useful for balancing smoothness and performance.
```sh
-F 60
```
--------------------------------
### TrollVNC Server Reverse Connection
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Initiates a reverse VNC connection to a listening viewer or an UltraVNC Repeater. When using reverse connection, local VNC, HTTP/WebSockets, and Bonjour are disabled.
```sh
trollvncserver -reverse host:port
```
```sh
trollvncserver -repeater id host:port
```
--------------------------------
### TrollVNC Server Choppy Network (High RTT/Loss) Preset
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Configured for choppy networks with high round-trip times or packet loss. Prioritizes reliability and reduces latency impact by adjusting update coalescing and frame rates.
```sh
trollvncserver -p 5901 -n "My iPhone" -s 0.66 -d 0.035 -Q 1 -t 64 -P 60 -R 128
```
--------------------------------
### Bind to Interface and Prevent Sleep
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Binds the VNC server to a specific network interface and sets a keep-alive interval to prevent the device from sleeping. Useful for stable remote access.
```sh
trollvncserver -p 5901 -b 192.168.1.10 -A 30
```
--------------------------------
### TrollVNC Server Battery/Bandwidth Saver (Cellular/WAN) Preset
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Optimized for battery life and bandwidth conservation, suitable for cellular or wide area network connections. Reduces frame rate and increases compression.
```sh
trollvncserver -p 5901 -n "My iPhone" -s 0.5 -d 0.025 -Q 2 -t 64 -P 50 -R 128
```
--------------------------------
### BulletinManager API
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
The BulletinManager provides an interface for posting and managing user notifications using iOS's `UNUserNotificationCenter`. It is used by the VNC server to inform the device owner about connection statuses.
```APIDOC
## BulletinManager — User Notification API
`BulletinManager` wraps `UNUserNotificationCenter` to post and manage iOS notification banners, used by the VNC server to display connection status to the device owner.
```objc
#import "BulletinManager.h"
BulletinManager *bm = [[BulletinManager alloc] init];
// --- Post a one-time connect/disconnect event notification ---
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.title = @"TrollVNC";
content.body = @"Client 192.168.1.5 connected";
content.sound = [UNNotificationSound defaultSound];
[bm popBannerWithContent:content userInfo:@{ @"type": @"connect" }];
// → Displays an active-level banner with sound
// --- Update the persistent status notification (passive, replaces previous) ---
UNMutableNotificationContent *statusContent = [[UNMutableNotificationContent alloc] init];
statusContent.title = @"TrollVNC";
statusContent.body = @"2 active VNC clients";
[bm updateSingleBannerWithContent:statusContent
badgeCount:2
userInfo:@{ @"type": @"status" }];
// → Silently updates the persistent banner; badge shows "2"
// --- Remove the persistent status notification ---
[bm revokeSingleNotification];
// --- Clear all TrollVNC notifications ---
[bm revokeAllNotifications];
```
```
--------------------------------
### TrollVNC Server Frame Rate Control (Range)
Source: https://github.com/owngoalstudio/trollvnc/blob/main/README.md
Specifies a range for the preferred frame rate. The system will attempt to maintain a rate within this range.
```sh
-F 30-60
```
--------------------------------
### Control Socket API: Block a Client
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Prevent a specific client from reconnecting by using the 'block' command, which first disconnects the client and then adds it to a blocklist.
```bash
# Block a client (kick + prevent reconnect)
echo "block 2" | nc 127.0.0.1 46750
```
--------------------------------
### Send Ctrl+Alt+Del Sequence
Source: https://github.com/owngoalstudio/trollvnc/blob/main/layout/usr/share/trollvnc/webclients/novnc/vnc_lite.html
This function emulates the Ctrl+Alt+Del key sequence, which is often intercepted by the browser. It's triggered by a button click.
```javascript
// Since most operating systems will catch Ctrl+Alt+Del // before they get a chance to be intercepted by the browser, // we provide a way to emulate this key sequence.
function sendCtrlAltDel() {
rfb.sendCtrlAltDel();
return false;
}
document.getElementById('sendCtrlAltDelButton')
.onclick = sendCtrlAltDel;
```
--------------------------------
### Control Socket API: Unsubscribe from Client Events
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Disable event notifications from the server by sending the 'subscribe off' command to the control socket.
```bash
# Unsubscribe
echo "subscribe off" | nc 127.0.0.1 46750
```
--------------------------------
### Control Socket API: Disconnect a Specific Client
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Terminate a specific client's connection by providing its ID to the 'disconnect' command. This is useful for removing unwanted or problematic sessions.
```bash
# Disconnect a specific client by ID
echo "disconnect 1" | nc 127.0.0.1 46750
```
--------------------------------
### Display status text
Source: https://github.com/owngoalstudio/trollvnc/blob/main/layout/usr/share/trollvnc/webclients/novnc/vnc_lite.html
Updates the text content of the status element in the top bar to provide feedback to the user.
```javascript
// Show a status text in the top bar
function status(text) {
document.getElementById('status').textContent = text;
}
```
--------------------------------
### Utility function to read query variables
Source: https://github.com/owngoalstudio/trollvnc/blob/main/layout/usr/share/trollvnc/webclients/novnc/vnc_lite.html
This function extracts a variable's value from the URL's query string. It handles URL decoding and provides a default value if the variable is not found.
```javascript
// This function extracts the value of one variable from the // query string. If the variable isn't defined in the URL // it returns the default value instead.
function readQueryVariable(name, defaultValue) {
// A URL with a query parameter can look like this:
// https://www.example.com?myqueryparam=myvalue
//
// Note that we use location.href instead of location.search
// because Firefox < 53 has a bug w.r.t location.search
const re = new RegExp('.\[?&' + name + '=(\[^\]\[)
'), match = document.location.href.match(re);
if (match) {
// We have to decode the URL since want the cleartext value
return decodeURIComponent(match[1]);
}
return defaultValue;
}
```
--------------------------------
### BulletinManager: User Notification API
Source: https://context7.com/owngoalstudio/trollvnc/llms.txt
Wraps UNUserNotificationCenter to post and manage iOS notification banners. Used for displaying connection status. Use popBannerWithContent for one-time events and updateSingleBannerWithContent for persistent status updates. revokeSingleNotification or revokeAllNotifications can be used to clear notifications.
```objc
#import "BulletinManager.h"
BulletinManager *bm = [[BulletinManager alloc] init];
// --- Post a one-time connect/disconnect event notification ---
UNMutableNotificationContent *content = [[UNMutableNotificationContent alloc] init];
content.title = @"TrollVNC";
content.body = @"Client 192.168.1.5 connected";
content.sound = [UNNotificationSound defaultSound];
[bm popBannerWithContent:content userInfo:@{ @"type": @"connect" }];
// → Displays an active-level banner with sound
// --- Update the persistent status notification (passive, replaces previous) ---
UNMutableNotificationContent *statusContent = [[UNMutableNotificationContent alloc] init];
statusContent.title = @"TrollVNC";
statusContent.body = @"2 active VNC clients";
[bm updateSingleBannerWithContent:statusContent
badgeCount:2
userInfo:@{ @"type": @"status" }];
// → Silently updates the persistent banner; badge shows "2"
// --- Remove the persistent status notification ---
[bm revokeSingleNotification];
// --- Clear all TrollVNC notifications ---
[bm revokeAllNotifications];
```
=== COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.