FDH2 / UxPlay

AirPlay Unix mirroring server
GNU General Public License v3.0
1.34k stars 71 forks source link

Any working examples of systemd service? #269

Closed 2600box closed 5 months ago

2600box commented 5 months ago

Hello,

trying to get this working as a systemd service.

via ssh, these two commands work for me:

mirror@mirror:~$ export DISPLAY=:0
mirror@mirror:~$ uxplay -vs waylandsink -avdec -fs

however, when trying to replicate this with a systemd service, the window is not shown on screen.

This way my attempt at the service. Any idea what is missing?

Thanks!

# /etc/systemd/system/uxplay-mirror.service

[Unit]
Description=UxPlay Service for User Mirror
After=graphical.target

[Service]
Type=simple
User=mirror
ExecStart=/usr/local/bin/uxplay -vs waylandsink -avdec -fs
Environment="XDG_RUNTIME_DIR=/run/user/$(id -u mirror)"
Environment="WAYLAND_DISPLAY=wayland-0"
Environment="DISPLAY=:0"
[Install]
WantedBy=graphical.target
thiccaxe commented 5 months ago

Try as a user service? https://www.baeldung.com/linux/systemd-create-user-services

2600box commented 5 months ago

Try as a user service? https://www.baeldung.com/linux/systemd-create-user-services

Thanks, that works

thiccaxe commented 5 months ago

Can you share your final working example?

2600box commented 4 months ago

Can you share your final working example?

I didn't try to minimise the config to see what environment parameters are actually required, but this works for me, at least for now:

# /etc/systemd/system/uxplay-mirror.service

[Unit]
Description=UxPlay Service for User
After=graphical.target

[Service]
Type=simple
Environment="XDG_RUNTIME_DIR=/run/user/$(id -u mirror)"
Environment="WAYLAND_DISPLAY=wayland-0"
Environment="DISPLAY=:0"
ExecStart=/usr/local/bin/uxplay -vs waylandsink -avdec -fs
[Install]
WantedBy=graphical.target