Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powerline confused about frame focus #2545

Closed
skrat opened this issue Aug 5, 2015 · 17 comments
Closed

Powerline confused about frame focus #2545

skrat opened this issue Aug 5, 2015 · 17 comments

Comments

@skrat
Copy link

skrat commented Aug 5, 2015

Look at this http://i.imgur.com/ke3t4Gc.gif

It's from i3-wm, I have multiple frames open, and the powerline doesn't reflect correctly whichever frame is focused.

@travisbhartwell
Copy link
Contributor

I have noticed similar behavior. What I noticed with i3wm is due to the container nature of i3. When you move the mouse I believe what happens is the container gets focused, not the window. I have verified this by enabling a "focus child" keybinding in my i3 config, say by uncommenting the following line from the default config:

#bindsym Mod1+d focus child

After I move the mouse over the other frame, I hit Mod1+d (or whatever you bind this to), and the next keystroke I press causes the Emacs window to behave as if it has focus and the powerline displays appropriately. It's as if i3 is not sending the focus events to the Emacs window otherwise.

Does this explain the behavior you're seeing?

@skrat
Copy link
Author

skrat commented Aug 5, 2015

Yes that would explain it. Have you found any way around it?

@skrat
Copy link
Author

skrat commented Aug 5, 2015

Well, you can see in my screencast that the the current line gets highlighted, and also the cursor changes to its focused look. So actually no, it doesn't explain it :) It's just the powerline that doesn't do the right thing.

@travisbhartwell
Copy link
Contributor

I guess I haven't investigated it further since I discovered that focusing the child would get around it. I need to figure out what event causes Powerline to change appearance and see why i3wm isn't sending it.

@syl20bnr
Copy link
Owner

syl20bnr commented Aug 5, 2015

What is weird is that the powerline behavior is exactly inversed, empty when focused and full when not focused. Maybe digging powerline-selected-window-active would give some answers.

@sexptherapy
Copy link

Also in i3wm, when I create a new frame, the modeline colors are totally wrong.
borked-modeline-on-new-frame

@CestDiego
Copy link
Contributor

@felipe-barros make sure you don't have custom-variables regarding theme faces in your .spacemacs

@sexptherapy
Copy link

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(ahs-case-fold-search nil)
 '(ahs-default-range (quote ahs-range-whole-buffer))
 '(ahs-idle-interval 0.25)
 '(ahs-idle-timer 0 t)
 '(ahs-inhibit-face-list nil)
 '(ring-bell-function (quote ignore) t))
(custom-set-faces
 ;; custom-set-faces was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(company-tooltip-common ((t (:inherit company-tooltip :weight bold :underline nil))))
 '(company-tooltip-common-selection ((t (:inherit company-tooltip-selection :weight bold :underline nil)))))

Besides this at the end (and I still don't understand this auto-generated code), there is nothing else changing theme faces.

@ghost
Copy link

ghost commented Aug 26, 2015

I have faced that bug too and tried another wms: xmonad, wmii and awesome. But bug still present.

But I have small workaround: I'm removing not from 'powerline-set-selected-window' (in powerline package, file poweline.el) and all windows become grey despite focus.

@ghost
Copy link

ghost commented Sep 14, 2015

Also, I noticed that if you open some window (for example type and open helm window), powerline focus move to the right window.

@ghost
Copy link

ghost commented Sep 15, 2015

So, also tried fluxbox, and behavior was exactly the same. Then I put some debug output and what I've got:

Setting (powerline-selected-window) is done by calling (focus-in-hook) and (focus-out-hook). Therein, in handlers, (powerline-selected-window) set to the (frame-selected-window). BUT the frame-selected-window is pointed to the wrong window, the window that was previously selected. If then you execute (print (frame-selected-window)) you will get the correct answer. So, the problem is deeper in core of emacs, in code that handling focusing events and setting (frame-selected-window). For some reason focus hooks raising earlier then setting frame-selected-window.

Moreover, by the documentation (frame-selected-window) is pointing to the last frame that gains input focus. So, if you move focus from the emacs at all to some other window, the (powerline-selected-window) will be not nill and one of the emacs window will have a colored modeline, despite the real focus.

May be this questions should be asked to the powerline developers?

@ghost
Copy link

ghost commented Sep 15, 2015

And I discovered more convenient workaround with powerline: i make the powerline-selected-window-active always returning true, and unselected windows disappear at all, all windows are like a selected now.

Just rewrite the powerline-selected-window-active elpa/powerline-x/powerline.el as

(defun powerline-selected-window-active () "Return whether the current window is active." t)

@curtmack
Copy link
Contributor

I can confirm this happens in xmonad.

@StreakyCobra
Copy link
Contributor

Still happening with spaceline (and i3-wm in my case). It's not inverted between focused and unfocused windows, as previously suggested, but it's always the previously focused windows that is "highlighted". In other words, the highlighting is always one windows behind.

@mskorzhinskiy
Copy link
Contributor

There is new pull request to powerline appeared and merged to powerline not so far ago. Check it: milkypostman/powerline#111. It's solves this issue for me.

But, it introduces a new bug. Check here for explanation and fix: zakame/.emacs.d@818b5e3

Anyway, I believe this issue can be closed after @skrat confirmation.

@TheBB
Copy link
Contributor

TheBB commented Mar 3, 2016

I can confirm that something seems to have fixed this, at least. :-)

@TheBB
Copy link
Contributor

TheBB commented Jun 10, 2016

Closing since this appears to be fixed, and no reports to the contrary.

@TheBB TheBB closed this as completed Jun 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants