1#!/bin/sh
2
3# set weston variables for use with global weston socket
4global_socket="/run/wayland-0"
5if [ -e "$global_socket" ]; then
6	weston_group=$(stat -c "%G" "$global_socket")
7	if [ "$(id -u)" = "0" ]; then
8		export WAYLAND_DISPLAY="$global_socket"
9	else
10		case "$(groups "$USER")" in
11			*"$weston_group"*)
12				export WAYLAND_DISPLAY="$global_socket"
13				;;
14			*)
15				;;
16		esac
17	fi
18	unset weston_group
19fi
20unset global_socket
21