Use loginctl to find out if a graphical session runs under X11 or Wayland:

  1. Get the session ID:
    loginctl
    This shows a table with all active graphical sessions and indicates their session ID in the column "SESSION".
  2. Get the display system of this session:
    loginctl show-session <session_id> -p Type

Source