Also $ echo $XDG_SESSION_TYPE does the job.