weston-socket.sh 436 B

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