The problem is that the functions that are being called while the mode-line-format is being processed cannot tell whether their window is "the" selected window because *every* window is temporarily selected before its mode-line-format is being processed. To deal with this the packages mentioned above resort to using several hook functions and advice to keep track of "the" selected window and then they do something like: (eq (selected-window) remembered-selected-window) Because keeping remembered-selected-window up-to-date involves several hooks and advises this is rather ugly and fragile. The value of remembered-selected-window often isn't actually correct because getting these hooks and advises right is hard and maybe even impossible. For an example see for example: https://github.com/milkypostman/powerline/blob/6ef4a06c3c583045accbc957b6f449b7c0c57cd8/powerline.el#L530-L584 It would be nice if Emacs could instead bind a variable that is accessible from lisp to the window that will be the selected window again once we are done updating the mode-line of this and other windows. This should probably happen in display_mode_lines(). Actually this function does already save the selected-window in another variable before it changes the value of this variable, but it only does so for its own use. Lisp_Object old_selected_window = selected_window; ... struct window *sel_w = XWINDOW (old_selected_window); Later this function decides what face to use like so: /* Select mode line face based on the real selected window. */ display_mode_line (w, CURRENT_MODE_LINE_FACE_ID_3 (sel_w, sel_w, w), NILP (window_mode_line_format) ? BVAR (current_buffer, mode_line_format) : window_mode_line_format); The result of this decision unfortunately also isn't accessible from lisp. In summary, please add a way for functions that format elements of the mode-line to determine whether these elements are going to be used in the selected or some other window. Maybe there is a better way to do that than what I suggested above. Thanks! Jonas