Could you show me how to write macro in
xmacro (that will work in whole desktop environment) that is able to expand strings?
E.g. I will type "thx" and it will expand to "thank you".
xmacro is a basic macro-recorder/macro-player.. it is good for some things, but is not suited to monitoring your keystrokes dynamically (other than for recording)...