In “cad é atà tù a dhèanamh”, “cad è” is the direct object of the verb. When your word is the subject or the direct object of the verb, you use the direct relative.

In “cén chaoi a bhfuil tù”, which means “what (is) the manner that you are”, “manner” isn’t the direct object nor the subject, it’s something else, so you use the indirect relative.

Daltaí na Gaeilge