This service allows to use the users desktop after login on a secure server similar to the webdav service.
user-headless.service
[Unit]
Description=Sway - Wayland Window Manager Headless
# technically not needed
ConditionUser=youruser
ConditionHost=vdi
[Service]
ExecStart=/usr/bin/sway
Restart=always
Environment="XDG_RUNTIME_DIR=/run/user/%U"
Environment="WLR_BACKENDS=headless"
Environment="WLR_RENDERER_ALLOW_SOFTWARE=1"
Environment="WLR_RENDERER=pixman"
Environment="WLR_LIBINPUT_NO_DEVICES=1"
WorkingDirectory=~
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=default.target
Save this for the user in .config/systemd/user
then enable on vdi server with systemctl --user enable user-headless.service
on the server for this user enable loginctl linger so a user session starts on reboot:
root@vdi:~# loginctl enable-linger youruser
That's it!
This config will be loaded by extending my base sway config not shown here but has this line to include the current running host:
### 💻 Machine-spec configs ###
# Needs to run before waybar to catch all custom vars
include "~/.config/sway/`hostname -f`/config"
.config/sway/vdi.domain.tld/config
### Only 1 virtual output! ###
### 🖥️ Outputs 🖥️ ###
### HEADLESS OUTPUTS ###
# you cannot rename the output! It will be HEADLESS-x
# 📳 HEADLESS for VDI (1920x1200)
exec swaymsg create_output
output HEADLESS-1 resolution 1920x1200 position 0 0 scale 1
exec_always wayvnc -S $XDG_RUNTIME_DIR/wayvncctl1 -o HEADLESS-1 0.0.0.0 5900
### 🖋️ Workspace 2 Output 🖥️ ###
workspace 1 output HEADLESS-0
workspace 2 output HEADLESS-0
workspace 3 output HEADLESS-0
workspace 4 output HEADLESS-0
workspace 5 output HEADLESS-0
workspace 6 output HEADLESS-0
workspace 7 output HEADLESS-0
workspace 8 output HEADLESS-0
workspace 9 output HEADLESS-0
workspace 10 output HEADLESS-0
### 🖼️ Wallpapers ###
### 🧑🏼💻 Applications ###
set $browser firefox
set $mailreader thunderbird
set $codeide codium
set $filebrowser thunar
### 🎨 Layout Stuff ###
# Golden Ratio resize - not needed in machine anymore, ppt in user
# bindsym $mod+g resize set width 618px resize set height 494x
exec_always ~/mediathekviewLoop.sh
This listens on 0.0.0.0 so 0 security at testing!