Skip to main content

App Examples

Since not all applications behave the same, we decided to create some examples to help you get started adding games and applications to Hermes.

[!TIP] Throughout these examples, any fields not shown are left blank. You can enhance your experience by adding an image or a log file (via the Output field).

[!WARNING] When a working directory is not specified, it defaults to the folder where the target application resides.

Common Examples​

Desktop​

FieldValue
Application NameDesktop
Imagedesktop.png

Steam Big Picture​

[!NOTE] Steam is launched as a detached command because Steam starts with a process that self updates itself and the original process is killed.

On Linux, ending the app stops the Steam this entry started, and any game started from it, after the undo command closes Big Picture. A Steam that was already running when the stream started is left alone. Turn off "Stop detached commands with the app" (stop-detached) to keep Steam running after the stream.

"Limit the game to the stream's frame rate" (limit-fps, Linux, off by default) caps the games this entry's Steam starts at the client's frame rate:

  • DXVK_FRAME_RATE and VKD3D_FRAME_RATE for Proton games, in DXVK/VKD3D-Proton builds that keep their limiter;
  • fps_limit in MANGOHUD_CONFIG (after read_cfg) where MangoHud is enabled. Hermes never turns MangoHud on.

It reaches only games started by a Steam that Hermes starts.

[!IMPORTANT] This entry does not put Steam on a virtual display, and turning on "Always create Virtual Display" for it will not change that. steam://open/bigpicture is a URL handed to the Steam that is already running on your desktop: it asks that process to switch modes, so the window stays wherever that Steam already was — normally your main monitor. No new process is started and nothing is placed on the virtual display.

On Linux, the Gamescope Steam Session entry is the counterpart: hermes-gamescope-launch starts Steam Big Picture inside a Gamescope compositor of its own at the resolution the client asked for. Gamescope runs nested — a fullscreen window of the desktop compositor, which would normally place that window on the primary monitor. The entry therefore ships with virtual-display-layout: mirror, which makes Hermes position the virtual display over the primary output, so the desktop (and the Gamescope window on it) is cloned into the stream. Set the app's virtual-display-layout to primary to keep the monitors on but make the virtual display the primary one, so games launched from Big Picture open in the stream, or to exclusive to hand the desktop to the virtual display and turn the physical monitors off for the session (native resolution, no clone), or to extend for the default side-by-side placement. Gamescope's own log is at ~/.local/state/hermes/gamescope.log. A Steam already running on the desktop is shut down first (stop-desktop-steam, below): Gamescope's Steam would hand its request to it and exit.

Keeping this entry is still useful for the opposite case: reaching the Steam on the host's own desktop. If you do give this entry a virtual display, a virtual-display-layout of mirror will clone the desktop — Steam included — into the stream; that is the mirror doing it, not the window being placed.

FieldValue
Application NameSteam Big Picture
Command Preparations -> Undosetsid steam steam://close/bigpicture
Detached Commandssetsid steam steam://open/bigpicture
Imagesteam.png

Steam game​

[!NOTE] Using the URI method will be the most consistent between various games.

URI​

FieldValue
Application NameSurviving Mars
Detached Commandssetsid steam steam://rungameid/464920

Binary (with a working directory)​

FieldValue
Application NameSurviving Mars
CommandMarsSteam
Working Directory~/.steam/steam/SteamApps/common/Survivng Mars

Binary (without a working directory)​

FieldValue
Application NameSurviving Mars
Command~/.steam/steam/SteamApps/common/Survivng Mars/MarsSteam

Prep Commands​

Changing Resolution and Refresh Rate​

Linux​
X11​
Prep StepCommand
Dosh -c "xrandr --output HDMI-1 --mode ${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT} --rate ${HERMES_CLIENT_FPS}"
Undoxrandr --output HDMI-1 --mode 3840x2160 --rate 120

[!TIP] The above only works if the xrandr mode already exists. You will need to create new modes to stream to macOS and iOS devices, since they use non-standard resolutions.

You can update the Do command to this:

bash -c "${HOME}/scripts/set-custom-res.sh \"${HERMES_CLIENT_WIDTH}\" \"${HERMES_CLIENT_HEIGHT}\" \"${HERMES_CLIENT_FPS}\""

The set-custom-res.sh will have this content:

#!/bin/bash
set -e

# Get params and set any defaults
width=${1:-1920}
height=${2:-1080}
refresh_rate=${3:-60}

# You may need to adjust the scaling differently so the UI/text isn't too small / big
scale=${4:-0.55}

# Get the name of the active display
display_output=$(xrandr | grep " connected" | awk '{ print $1 }')

# Get the modeline info from the 2nd row in the cvt output
modeline=$(cvt ${width} ${height} ${refresh_rate} | awk 'FNR == 2')
xrandr_mode_str=${modeline//Modeline \"*\" /}
mode_alias="${width}x${height}"

echo "xrandr setting new mode ${mode_alias} ${xrandr_mode_str}"
xrandr --newmode ${mode_alias} ${xrandr_mode_str}
xrandr --addmode ${display_output} ${mode_alias}

# Reset scaling
xrandr --output ${display_output} --scale 1

# Apply new xrandr mode
xrandr --output ${display_output} --primary --mode ${mode_alias} --pos 0x0 --rotate normal --scale ${scale}

# Optional reset your wallpaper to fit to new resolution
# xwallpaper --zoom /path/to/wallpaper.png
Wayland (wlroots, e.g. hyprland)​
Prep StepCommand
Dosh -c "wlr-xrandr --output HDMI-1 --mode \"${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT}@${HERMES_CLIENT_FPS}Hz\""
Undowlr-xrandr --output HDMI-1 --mode 3840x2160@120Hz

[!TIP] wlr-xrandr only works with wlroots-based compositors.

Gnome (X11)​
Prep StepCommand
Dosh -c "xrandr --output HDMI-1 --mode ${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT} --rate ${HERMES_CLIENT_FPS}"
Undoxrandr --output HDMI-1 --mode 3840x2160 --rate 120
Gnome (Wayland)​
Prep StepCommand
Dosh -c "displayconfig-mutter set --connector HDMI-1 --resolution ${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT} --refresh-rate ${HERMES_CLIENT_FPS} --hdr ${HERMES_CLIENT_HDR}"
Undodisplayconfig-mutter set --connector HDMI-1 --resolution 3840x2160 --refresh-rate 120 --hdr false

Installation instructions for displayconfig-mutter can be found here. Alternatives include gnome-randr-rust and gnome-randr.py, but both of those are unmaintained and do not support newer Mutter features such as HDR and VRR.

[!TIP] HDR support has been added to Gnome 48, to check if your display supports it, you can run this:

displayconfig-mutter list

If it doesn't, then remove --hdr flag from both Do and Undo steps.

KDE Plasma (Wayland, X11)​
Prep StepCommand
Dosh -c "kscreen-doctor output.HDMI-A-1.mode.${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT}@${HERMES_CLIENT_FPS}"
Undokscreen-doctor output.HDMI-A-1.mode.3840x2160@120

[!CAUTION] The names of your displays will differ between X11 and Wayland. Be sure to use the correct name, depending on your session manager. e.g., On X11, the monitor may be called HDMI-A-0, but on Wayland, it may be called HDMI-A-1.

[!TIP] Replace HDMI-A-1 with the display name of the monitor you would like to stream. You can list the monitors available to you with:

kscreen-doctor -o

These will also give you the supported display properties for each monitor. You can select them either by hard-coding their corresponding number (e.g. kscreen-doctor output.HDMI-A1.mode.0) or using the above do command to fetch the resolution requested by your client (which has a chance of not being supported by your monitor).

NVIDIA​
Prep StepCommand
Dosh -c "nvidia-settings -a CurrentMetaMode=\"HDMI-1: nvidia-auto-select { ViewPortIn=${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT}, ViewPortOut=${HERMES_CLIENT_WIDTH}x${HERMES_CLIENT_HEIGHT}+0+0 }\""
Undonvidia-settings -a CurrentMetaMode=\"HDMI-1: nvidia-auto-select { ViewPortIn=3840x2160, ViewPortOut=3840x2160+0+0 }"

Additional Considerations​

Experimental independent Linux sessions​

[!WARNING] Independent client sessions are under re-evaluation and are not recommended. They will change in ways that are not backwards compatible, so an app configuration built on the fields below is likely to need rebuilding.

When hermes_kms_isolated_sessions is enabled, it acts as a server capability rather than switching the entire server into an isolated mode. Each application can select an isolation-method in the Web UI or apps.json:

  • default: follow the global isolation_method when the launch requests a virtual display, and stay on the shared host session otherwise. Under gamescope, an entry with no cmd becomes a KWin desktop, as there is nothing to run in Gamescope. An explicit extend, primary, mirror or exclusive virtual-display-layout stays on the host session;
  • gamescope: always start only the configured application inside an independent DRM Gamescope session, without a desktop panel;
  • kwin_virtual: always start an independent desktop with the session compositor chosen by hermes_kms_session_compositor, by default the user's own Plasma desktop on KWin's virtual backend. With a compositor profile such as weston, when cmd is set, Hermes launches it after the desktop socket and scanout are ready, and ties it to the session so that ending the session ends it too - as a member of the session's process group where the session runs as the Hermes user, or as a unit bound to the session's where the session broker gave it a user of its own;

"host-session": true (available in apps.json) keeps an entry on the existing host desktop/session whatever its method.

"virtual-display" is the app's default: a client that makes its own choice (Hestia's "Use Virtual Display", sent with session/prepare) gets that choice instead. "force-virtual-display": true applies the app's "virtual-display" to every client, on or off. The shipped Gamescope Steam Session forces it, since Gamescope needs a display at the client's mode. Each launch logs the decision and who made it ([Settings] Virtual display ...).

"scale-factor" works the same way: a client that sends its own resolution scale gets it, the app's applies to clients that send none (when it isn't 100), then the host's default_scale_factor. "force-scale-factor": true applies the app's scale to every client ([Settings] Resolution scale ...).

Launches without an explicit virtual-display request on the default method remain shared-host routes. Shared-host and independent sessions may run at the same time; enabling the capability does not disable host multi-output management or Remote Input. These values have no effect while independent client sessions are disabled.

A gamescope session runs gamescope --backend=drm -W -H -w -h -r <client mode> <scanout option> <card> <steam mode> <flags> -O <connector> -- <cmd>, where the scanout option is whichever of --prefer-drm or --drm-device the installed Gamescope lists in its --help (see experimental-isolated-gamescope.md). Three fields tune it:

  • gamescope-steam-mode: auto (default) turns Steam mode on when the command's program is steam; on/off force it. Steam mode passes -e --xwayland-count 2: Steam then picks the visible app and draws its overlay, and games run on their own Xwayland so the overlay cannot take their X focus (Wine games minimize when it does). App windows without a Steam app ID cannot take focus in Steam mode. Off passes --xwayland-count 1.
  • gamescope-args: replaces the default --expose-wayland --force-windows-fullscreen; empty keeps it. These flags come after the Steam mode ones, so e.g. --xwayland-count 1 overrides it. Like cmd here, the line is split on whitespace; quotes are not interpreted.
  • first-frame-timeout (seconds, 0 by default): how long the session has to show its first frame before the launch fails. 0 means 30 seconds for the application profile and 5 for desktop.

Both profiles take two fields for what the session sees of the host's /dev (sessions running as the Hermes user; values auto (default), on, off):

  • isolate-devices: the session runs in its own mount namespace with a private /dev: basic nodes, the GPUs (/dev/dri), pts, shm, uinput, fuse, ntsync, and in /dev/input (and hidraw) only the session client's devices and the Valve virtual pads Steam Input makes inside the session, added as they appear. The host's controllers, keyboards, USB devices and cameras are absent, and the client's devices and the session's Valve virtual devices are closed to the desktop (they get the session's seat, and no ACL). A uinput device does not record who made it, so a Valve device counts as the session's only while no process outside it, Hermes aside, holds /dev/uinput. Hermes needs cap_sys_admin,cap_mknod,cap_sys_chroot+p; auto runs without isolation (with a warning) when they are missing, on refuses to start.
  • isolate-sound: no /dev/snd, so applications only reach sound through the session's own audio server.

stop-desktop-steam (auto, on, off; auto when cmd runs steam, or, for an isolated session, when cmd or a detached command starts Steam): Steam runs once per user and hands a second launch to the running client. If the pid in ~/.steam/steam.pid is a live Steam outside Hermes' sessions, Hermes sends it SIGTERM (it logs off and saves its settings, usually in a few seconds) before starting the session, and kills it and its children if it is still running after 30 seconds. The same applies to an app on the desktop that starts Steam in a nested Gamescope, such as Gamescope Steam Session: otherwise Gamescope's Steam hands its request to the running one and exits, and Gamescope ends with it. When such an app ends, Hermes starts the desktop's Steam again (steam -silent, in the tray) once the app's own Steam has exited, as a unit of the user's service manager so later apps leave it alone. Big Picture on the desktop is unaffected; it is meant to use the running Steam.

With hermes_kms_session_compositor = plasma, the default, the kwin_virtual method is the user's own Plasma desktop on KWin's virtual backend: it runs as the same user with the same home, files and settings, on a virtual KWin output that no physical monitor or local keyboard and mouse can reach. It needs no Hermes-KMS card or seatd, and it does not run cmd, detached or prep commands.

With a compositor profile such as weston instead, the kwin_virtual method is a reference Weston desktop, not a complete Plasma session. Before such a launch, configure the driver's private-seat broker for the Hermes user with sudo /usr/lib/hermes-kms/hermes-kms-setup configure --user auto, which starts one broker per session card; Hermes assigns the corresponding private broker socket to the compositor automatically.

{
"name": "Steam Big Picture",
"cmd": "steam -gamepadui",
"isolation-method": "gamescope",
"gamescope-steam-mode": "auto",
"isolate-devices": "on",
"first-frame-timeout": 45
}

Linux (Flatpak)​

[!CAUTION] Because Flatpak packages run in a sandboxed environment and do not normally have access to the host. A downstream Flatpak with host access may require flatpak-spawn --host before a host command.