vix desktop
vix desktop runs a Vix web UI inside a desktop shell.
It is made for applications that already render a web interface with Vix, then need to open that interface as a desktop app.
vix desktop run ui_dashboard.cpp --port 8080The command can start a local Vix server, wait until it is ready, and open the app in a desktop window.
Overview
vix desktop is the desktop command for Vix UI applications.
It supports three workflows:
run start a desktop app for development
build build a desktop server target
package create a distributable desktop folderMost of the time during development, use:
vix desktop run app.cppor the shorter form:
vix desktop app.cppBoth forms start the C++ file as the managed desktop server and open the desktop shell.
Basic example
#include <vix/core.hpp>
#include <vix/ui.hpp>
int main()
{
vix::App app;
app.get("/", [](vix::Request &, vix::Response &res) {
res.ui(
vix::ui::HtmlResponse::html(
"<h1>Hello from Vix Desktop</h1>"
)
);
});
app.run(8080);
return 0;
}Run it as a desktop app:
vix desktop run main.cpp --port 8080Vix builds the C++ file, starts it as a local server, waits for the server, then opens the desktop window.
Usage
vix desktop run [target.cpp|binary] [options]
vix desktop build <target.cpp|binary> [options]
vix desktop package <target.cpp|binary> [options]
vix desktop [target.cpp|binary] [options]The short form:
vix desktop ui_dashboard.cppis equivalent to:
vix desktop run ui_dashboard.cppRun a desktop app
Use run during development.
vix desktop run ui_dashboard.cppWith a custom port:
vix desktop run ui_dashboard.cpp --port 8080With a custom name and window title:
vix desktop run ui_dashboard.cpp \
--name "Vix Dashboard" \
--title "Vix Dashboard"With a custom window size:
vix desktop run ui_dashboard.cpp \
--width 1280 \
--height 720Enable developer tools:
vix desktop run ui_dashboard.cpp --devtoolsRun an existing local server
Use --url when the server is already running.
vix desktop run --url http://127.0.0.1:8080This opens the URL inside the desktop shell.
Run an existing binary
A compiled server binary can be used directly.
vix desktop run ./build/my_server --port 8080Vix starts the binary as the managed server and opens:
http://127.0.0.1:8080Managed server mode
When a C++ file or server binary is passed to vix desktop run, Vix treats it as a managed server.
vix desktop run ui_dashboard.cpp --port 8080This means Vix will:
- build the C++ file when needed,
- start the server,
- wait for the target URL,
- open the desktop shell,
- stop when the desktop session closes.
The target URL is built from the host and port:
http://127.0.0.1:8080Attach mode
When only a URL is passed, Vix does not start a server.
vix desktop run --url http://127.0.0.1:8080Use this when the app is already running somewhere else.
Readiness URL
By default, the desktop shell waits for the target URL.
Set a custom readiness URL when the server has a health route:
vix desktop run ui_dashboard.cpp \
--port 8080 \
--readiness-url http://127.0.0.1:8080/healthDisable readiness waiting:
vix desktop run ui_dashboard.cpp --no-waitSet the startup timeout:
vix desktop run ui_dashboard.cpp --timeout-ms 10000Build a desktop server
build compiles the server target used by the desktop app.
vix desktop build ui_dashboard.cppWith an app name:
vix desktop build ui_dashboard.cpp --name "Vix UI Dashboard"With clean rebuild:
vix desktop build ui_dashboard.cpp --cleanWith parallel jobs:
vix desktop build ui_dashboard.cpp -j 8Use an already-built server binary:
vix desktop build --binary ./build/ui_dashboard --name "Vix UI Dashboard"Package a desktop app
package creates a desktop folder containing the server, launcher, desktop metadata, and runtime resources.
vix desktop package ui_dashboard.cpp --target dirWith a custom output directory:
vix desktop package ui_dashboard.cpp \
--target dir \
--out dist/dashboardWith app metadata:
vix desktop package ui_dashboard.cpp \
--target dir \
--name "Vix Dashboard" \
--title "Vix Dashboard" \
--app-id com.vix.dashboard \
--app-version 1.0.0 \
--vendor "Vix.cpp"With an icon:
vix desktop package ui_dashboard.cpp \
--target dir \
--icon assets/icon.pngThe supported package target is currently:
dirRuntime resources
When packaging, Vix can copy common runtime folders automatically.
Default resource folder names:
templates
assets
static
public
views
resources
wwwrootThis is useful for apps that load templates, CSS, JavaScript, images, or public files at runtime.
Add an extra resource path:
vix desktop package ui_dashboard.cpp \
--target dir \
--resources ./uploadsDisable automatic resource discovery:
vix desktop package ui_dashboard.cpp \
--target dir \
--no-auto-resourcesServer options
vix desktop run ui_dashboard.cpp \
--host 127.0.0.1 \
--port 8080Available server options:
| Option | Description |
|---|---|
--url <url> | Target URL to open |
--host <host> | Local server host. Default: 127.0.0.1 |
--port <port> | Local server port. Default: 8080 |
--readiness-url <url> | URL checked before opening the shell |
--server <command> | Custom server command |
--cwd <dir> | Working directory for the server command |
--working-directory <dir> | Same as --cwd |
--wait | Wait for server readiness |
--no-wait | Do not wait for server readiness |
--timeout-ms <ms> | Startup timeout in milliseconds |
Window options
vix desktop run ui_dashboard.cpp \
--width 1200 \
--height 800 \
--resizableAvailable window options:
| Option | Description |
|---|---|
--width <px> | Window width. Default: 1200 |
--height <px> | Window height. Default: 800 |
--fullscreen | Start fullscreen |
--resizable | Allow resizing |
--no-resizable | Disable resizing |
--devtools | Enable WebView developer tools when supported |
--no-devtools | Disable developer tools |
App metadata options
vix desktop run ui_dashboard.cpp \
--name "Vix Dashboard" \
--title "Vix Dashboard" \
--app-id com.vix.dashboard \
--app-version 1.0.0 \
--vendor "Vix.cpp"Available metadata options:
| Option | Description |
|---|---|
--name <name> | Application name |
--title <title> | Window title |
--app-id <id> | Stable desktop application id |
--app-version <version> | Application version |
--version <version> | Same as --app-version |
--vendor <name> | Vendor name |
--icon <path> | Desktop icon path |
Build options
vix desktop build ui_dashboard.cpp \
--clean \
-j 8Available build options:
| Option | Description |
|---|---|
--clean | Clean or rebuild before building |
-j, --jobs <n> | Parallel build jobs |
--with-sqlite | Enable SQLite support for script build |
--with-mysql | Enable MySQL support for script build |
--local-cache | Use local script cache |
--binary <path> | Use an already-built server binary |
--server-binary <path> | Same as --binary |
Package options
vix desktop package ui_dashboard.cpp \
--target dir \
--out dist/dashboardAvailable package options:
| Option | Description |
|---|---|
--out <dir> | Output directory |
--target <target> | Package target. Supported: dir |
--resources <path> | Copy an extra runtime resource file or directory |
--resource <path> | Same as --resources |
--no-auto-resources | Disable automatic resource copying |
--icon <path> | Copy an application icon |
Output options
| Option | Description |
|---|---|
--quiet, -q | Only print errors |
--json | Print machine-readable lifecycle events |
--no-color | Disable ANSI colors |
Vix also respects:
NO_COLOR
FORCE_COLORExamples
Run a UI dashboard:
vix desktop run ui_dashboard.cpp --port 8080Run a form-heavy UI:
vix desktop run ui_forms.cpp --port 8080Run a live UI page:
vix desktop run ui_live.cpp --port 8080Open an already-running server:
vix desktop run --url http://127.0.0.1:8080Build a desktop server:
vix desktop build ui_dashboard.cpp --name "Vix UI Dashboard"Package a desktop folder:
vix desktop package ui_dashboard.cpp \
--target dir \
--name "Vix UI Dashboard"Package with templates and assets:
vix desktop package ui_dashboard.cpp \
--target dir \
--resources templates \
--resources assetsCommon mistakes
Passing vix run as the server command
Wrong:
vix desktop run --server "vix run ui_dashboard.cpp"Correct:
vix desktop run ui_dashboard.cpp --port 8080For desktop development, pass the C++ file directly.
Forgetting the port
If your app runs on port 8080, keep the desktop command on the same port:
vix desktop run ui_dashboard.cpp --port 8080Opening a URL before the server is ready
Use a readiness URL:
vix desktop run ui_dashboard.cpp \
--readiness-url http://127.0.0.1:8080/healthPackaging without runtime files
If the app needs templates or assets, include them:
vix desktop package ui_dashboard.cpp \
--target dir \
--resources templates \
--resources assetsDifference between run, build, and package
| Command | Purpose |
|---|---|
vix desktop run | Start a desktop app for development |
vix desktop build | Build the desktop server target |
vix desktop package | Create a distributable desktop folder |
Related commands
| Command | Purpose |
|---|---|
vix run | Build and run a normal Vix target |
vix dev | Run a development server with reload |
vix mobile | Prepare mobile app workflows |
vix note | Run the Vix Note UI |
vix build | Compile a project or target |