summaryrefslogtreecommitdiffstats
path: root/core/modules/remote-access/data/opt/openslx/scripts/systemd-remote_x_config
blob: ffa7caf21cb26f51934ee33f294e5567a13f4087 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/ash

. /opt/openslx/config

[ -n "$SLX_REMOTE_VNC" ] || exit 0 # Nothing to do

# Disable all input drivers
cp "/opt/openslx/remote-access/xorg-noinput.conf" "/etc/X11/xorg.conf.d/16-remote-access-noinput.conf"

/opt/openslx/scripts/lightdm-patch_logo "Fernzugriff" '#555555'

# Find connected output, get driver for according card
driver=
fallback=
for cdir in /sys/class/drm/card?; do
	card="${cdir##*/}"
	d="$( awk -F= '{ if ($1 = "DRIVER") { print $2; exit; } }' "$cdir/device/uevent" )"
	[ -z "$d" ] && continue
	[ -z "$fallback" ] && fallback="$d"
	grep -qFx 'connected' "$cdir/$card"-*/status || continue
	driver="$d"
	break
done

[ -z "$driver" ] && driver="$fallback"
# ???
[ -z "$driver" ] && driver="i915"
case "$driver" in
	i915) driver="intel" ;;
	vmwgfx) driver="vmware" ;;
esac

# Enable LoingRPC of greeter
mkdir -p /etc/lightdm/qt-lightdm-greeter.conf.d
cat > /etc/lightdm/qt-lightdm-greeter.conf.d/13-loginrpc.conf <<END
[General]
rpc-port = 7551
END

if [ "$driver" = "intel" ]; then
	# This only works for very old i915 chips that don't support modesetting
	sed "s/%DRIVER%/${driver}/g" "/opt/openslx/remote-access/xorg-virtual.conf" > "/etc/X11/xorg.conf.d/16-remote-access-${driver}-virtual.conf"
fi

# Do NOT use evdi for now, makes 3D slow on some nvidias, completely breaks vmware output on some intels
exit 0

# For everything else, we use th evdi kernel module to add a virtual output
if insmod "/lib/modules/$(uname -r)/kernel/extra/evdi.ko" initial_device_count=1 \
		|| modprobe evdi; then
	echo "evdi virtual display interface loaded"
else
	echo "evdi not found. virtual display not available."
fi

# Currently the zaphod head solution on intel can create a mysterious
# problem where the cursor turns into an X and everything stops working
# disable any warnings and just let the screen enter standby
exit 0

# DISABLED BELOW
[ "$driver" = "intel" ] || exit 0 # Currently only intel supports zaphod head split

# Enable the dual-screen setup
sed "s/%DRIVER%/$driver/g" "/opt/openslx/remote-access/xorg-zaphod.conf" > "/etc/X11/xorg.conf.d/16-remote-access-zaphod.conf"

# Force :0.0 usage

cat > /etc/X11/Xsession.d/00-force-screen0 <<END
#!/bin/ash Being sourced but hey
(
export DISPLAY=:0.1
xrandr --verbose \$( xrandr | grep '^[A-Z].* connected ' | awk '{print "--output " \$1 " --auto"}' )
text="Dieser PC wird gerade aus der Ferne verwendet.
This computer is currently being used for a remote session.

Bitte nicht abschalten.
Please don't turn it off."
zenity --info --width 630 --text "\$text" || xmessage -center "\$text"
) &
export DISPLAY=:0.0
END