Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- [twilightcat@silent ~]$ cat /usr/local/bin/x11vnc-wrapper
- #!/bin/bash
- adisplay=$1
- xmcookie=/run/lightdm/root/:$1
- username=$(who | grep "(:$adisplay)" | awk '{print $1}')
- if [ ! -f $xmcookie ] & [ ! -z "$username" ]; then xmcookie=/home/$username/.Xauthority;
- else if [ ! -f $xmcookie ] & [ -z "$username" ]; then xmcookie=/var/lib/lightdm/.Xauthority; fi;
- fi
- /usr/bin/x11vnc -display WAIT:$adisplay -auth $xmcookie -forever -shared -rfbauth /etc/x11vnc.passwd -autoport 5900 -repeat -o /var/log/x11vnc-display-$adisplay.log
- exit $?
- [twilightcat@silent ~]$ cat /usr/local/bin/x11vnc-light-locker
- #!/bin/bash
- while inotifywait -qq -e modify /sys/class/tty/tty0/active; do
- CURRENTDISPLAY=$(ps -fC Xorg | grep vt$(sed 's/tty//g' /sys/class/tty/tty0/active) | sed -e 's/\(^\)\(.*\)\/run\/lightdm\/root\/\:\s*\(.*\)/\1\3/; s/ .*//')
- /bin/systemctl stop x11vnc@*
- if [[ $CURRENTDISPLAY ]]; then
- /bin/systemctl start x11vnc@$CURRENTDISPLAY
- fi
- done
- [twilightcat@silent ~]$ cat /etc/systemd/system/x11vnc@.service
- [Unit]
- Description=VNC Server for X11
- Requires=graphical.target
- After=graphical.target
- [Service]
- Environment=FD_XDM=1
- Type=simple
- ExecStart=/usr/local/bin/x11vnc-wrapper %i
- SuccessExitStatus=2
- Restart=always
- [Install]
- WantedBy=graphical.target
- [twilightcat@silent ~]$ cat /etc/systemd/system/x11vnc-light-locker.service
- [Unit]
- Description=X11VNC displays autodetect for light-locker
- Requires=graphical.target
- After=graphical.target
- [Service]
- Type=simple
- ExecStart=/usr/local/bin/x11vnc-light-locker
- Restart=always
- [Install]
- WantedBy=graphical.target
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement