Saturday, October 05, 2019

vnc using systemd in user mode

File: /home/mwo2/.config/systemd/user/myvnc@:1.service [Unit]
Description=My VNC

[Service]
Type=simple
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -geometry 1920x1080 :%i -xstartup /home/mwo2/.vnc/xstartup -SecurityTypes None -fg
ExecStop=/usr/bin/vncserver -kill :i

[Install]
WantedBy=default.target


-fg and Type=simple are important!

systemctl --user enable myvnc@\:1.service