Focus Handling

To change focus to a window, you just left click on it, and if skip_focus is off that window will pop into the left track, and the window currently there will pop over to the top of the right track.

If you have it set up to automatically put the focused window in the left track, you might still sometimes want to type something into one of the tiled windows without rearranging all the windows, and to do that you Control-Button1 click on a window. Focus will change, but all windows will stay where they are. This will also prevent any transient windows owned by the application from immediately be raised and get focus.

If you have it in the default mode, where selecting a new window to have focus does not make it pop into the left track you can do that by Control-Button1 clicking it.

Windows that set the input member of the WM_HINTS struct to False will not get focus, either automatically or by clicking on them. You can override this behaviour by Shift-Button1 clicking on the window to force it to be focused.


When you click on a window to give it focus, that click is also passed on to the client. This makes it easier to work with a multi-window application. You can turn this feature off, in which case the click used to focus a window is never seen by the application. The middle and right moue buttons are passed on to the client without changing focus if clickthru is on.

Multi-Head Concerns

When the mouse pointer is moved from one screen to another, focus is given to the appropriate window on the screen it moved into. If there is no window visible on that screen that can be given focus, no window will have focus since it will not stay on the screen the mouse moved out of.

When a window gets mapped, for whatever reason, it is usually given focus. But if the MapRequest event occurs on a different screen than the one you are working on, things could get confusing. I solved this by adding the following rules to how focus is assigned when windows open and close:

  1. If the currently focused window is on the same screen, then the new window will get focus.

  2. If the currently focused window is on a different screen, the new window will get focus only if the mouse pointer is on the same screen as the new window.

  3. If no window is focused, a newly mapped window will get focus only if the mouse pointer is on the same screen as the new window.

  4. If the focused window closes, focus will revert to another window, usually the window that was focused before the one that just closed. Focus will revert only if the mouse pointer is on the same screen as the window that closed.

I believe these rules will help eliminate most cases of having your keystrokes go to a window you did not intend to.