refactoring of window buttons + rtl support