I have Xorg with Twm and xterm installed on Arch linux, and when I start the X server, I can type in xterm only when the mouse pointer is over its window. I have been searching options to Xorg and Twm which can have something related with focus when mouse is over window but I didn't succeed.How can I set my system up so that focus isn't bound to the mouse position?
Xorg/Twm window has focus only when mouse is over
x11;focus;twm
What you see is the normal way of twm to handle the mouse focus.The method is called focus follows mouse.  Since 1989, twm was the default window manager of the X Window System. That means that it is a reference implementation, like other default components of X.  Most reference implementations of other X components had incremental changes since that time, and are still in use. The window manager twm is different; It did not evolve and stay in widespread use. Because the topic of window management got a lot of progress, it has been replaced by other solutions which applied new ideas and methods. That is why it looks pretty old now - it has been long out of practial use.So it's basically old in relation to the ongoing developments in user interfaces.At the time twm was most used, focus follows mouse was verry common. I remember I used it myself.From the documentation, twm does not seem to have alternative modes. It may be possible to create a custom .twmrc implementing such a mode, but I do not assume such a .twmrc is available.Practically, if you want a different focus mode, you need to change the window manager.Is there anything that makes you locked to twm?In case you can use a different window manager, there is one that has been started from the source code of twm, and got lots of features suporting many configuration styles to support usability, called FVWM.It is old too, but less so. Like twm without the minimalism.A more modern window manager would be metacity. There are also compositors, like compiz, which solve the same problem of managing windows, but are much more complex - they make all programms draw their output in some hidden place, and can fully maniplulate that output, before showing it to the user. (There is an interesting variant of focus follows mouse: sloppy focus. That mode allows the mouse pointer to leave a window for a short time, before the focus is changed to the window under the pointer. (Try it if it's available in similar window managers.))