I’m not sure if that depends mostly on the Window Decorator of the OS, and in Linux there are many of them. I think that something simpler to implement is just to change the order of the buttons so that the “close” button does not stay close to the “close” window decorator button.
Or maybe replace “cross” icon with a “trash can” icon or something else.