Files
dotfiles/hosts/mainframe/sway/headless.conf
T

65 lines
3.0 KiB
Plaintext

# A compositor that exists only so Sunshine has something to capture.
# mainframe has no desktop: the only connected output (HDMI-A-2) hangs off the
# Intel iGPU, while the RTX 3060 that does the encoding drives no monitor at
# all. Capturing the real output would mean grabbing on Intel and encoding on
# NVIDIA — a cross-GPU copy every frame. A virtual output on the 3060 keeps
# capture and NVENC on one card.
output HEADLESS-1 mode 1920x1080@60Hz position 0,0
output HEADLESS-1 background #101920 solid_color
# Start Xwayland eagerly rather than on first X client. Steam is an X app, and
# with the default lazy start DISPLAY does not exist yet when the line below
# imports the environment — so Steam launched by Sunshine got
# "Unable to open a connection to X" and showed a blank stream.
xwayland force
# Sunshine is a systemd user unit and inherits nothing from this session, so
# hand it the display variables before starting it.
#
# ONE exec with &&, not two. sway runs exec lines asynchronously and does not
# order them, so as two separate lines Sunshine won every time: it started in
# the same second as the compositor, before DISPLAY was imported, and passed no
# DISPLAY to the apps it launched. Steam then failed with "Unable to open a
# connection to X" even though Xwayland was up and the manager environment was
# correct.
exec systemctl --user import-environment WAYLAND_DISPLAY DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP && systemctl --user start sunshine.service
# Input arrives from the Moonlight client, so keybinds are worth having even
# though nobody is sitting at this machine. Without them the Desktop app
# streams an empty screen with no way to open anything.
set $mod Mod4
# Floating, not tiling. Nobody sits at this machine and nothing here is a
# workstation: the stream shows one thing at a time, usually Steam fullscreen.
# Tiling only ever meant a dialog box stealing half the screen. Both criteria
# are needed - app_id matches Wayland clients, class matches Xwayland ones,
# and Steam is an X client.
for_window [app_id=".*"] floating enable
for_window [class=".*"] floating enable
# Title bars are the handle you grab with the mouse, so floating windows keep
# a real border rather than the thin default.
default_floating_border normal 2
# Super+drag moves a window, Super+right-drag resizes it. Without this the
# only way to move a window is the title bar, which a fullscreen app has none of.
floating_modifier $mod normal
# The stream forwards a mouse, so pointing and clicking is the primary way
# around; these are for when the pointer is not enough.
bindsym Alt+Tab focus next
bindsym Alt+Shift+Tab focus prev
bindsym $mod+f fullscreen
bindsym $mod+Return exec kitty
bindsym $mod+d exec wofi --show drun
bindsym $mod+Shift+q kill
bindsym $mod+Shift+e exec swaymsg exit
# Something visible on login, so a working capture is obviously working rather
# than indistinguishable from a broken one.
exec kitty
# No bar, no idle daemon, no lock screen — there is no one sitting here.