summaryrefslogtreecommitdiffstats
path: root/meta/recipes-graphics/wayland/weston-init/weston-socket.sh
blob: 86389d63a3b1c3b159f7a9a789665a8757678365 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

# set weston variables for use with global weston socket
global_socket="/run/wayland-0"
if [ -e "$global_socket" ]; then
	weston_group=$(stat -c "%G" "$global_socket")
	if [ "$(id -u)" = "0" ]; then
		export WAYLAND_DISPLAY="$global_socket"
	else
		case "$(groups "$USER")" in
			*"$weston_group"*)
				export WAYLAND_DISPLAY="$global_socket"
				;;
			*)
				;;
		esac
	fi
	unset weston_group
fi
unset global_socket