When I woke up, there was a burglar in my room.

Literal

Eye [subject-が] wake-up [when-と] room [at-に] burglar [subject-が] existed.

目が覚める ('eyes awaken') is the standard idiomatic way to say 'wake up' — notice the eyes are the grammatical subject of their own waking, not something you do to them. The と here is the conditional/temporal 'when/upon' marker, commonly used for events where 'as soon as X happened, Y was the case.' The subject of the main clause ('I') is entirely omitted.