Use loginctl to find out if a graphical session runs under X11 or Wayland:
- Get the session ID:
loginctl
This shows a table with all active graphical sessions and indicates their session ID in the column "SESSION". - Get the display system of this session:
loginctl show-session <session_id> -p Type
Source
- StackExchange: How to know whether Wayland or X11 is being used