doom-modeline icon indicating copy to clipboard operation
doom-modeline copied to clipboard

Modeline not working as expected when mouse hover a frame in an out

Open iris-garcia opened this issue 1 year ago • 6 comments

Thank you for the bug report

  • [X] I am using the latest version of doom-modeline related packages.
  • [X] I checked FAQ.
  • [X] You may also try reproduce the issue using clean environment and minimal configurations with the command emacs -Q.

Bug description

Probably this bug only happens in Linux (GTK) and maybe only with specific Windows Managers. I'm using Qtile as Window Manager.

The bug is the following: moving the mouse out of a frame leaves the modeline in a half-state (active-inactive) and it behaves different if the the mouse hovers another Emacs frame or a different App.

Pictures:

  1. Moving mouse from Frame 1 to different App: image
  2. Moving mouse from Frame 1 to Frame 2: image
  3. Moving mouse from Frame 1 to Frame 2 then clicking on Frame 2 (modeline looks good in this case, but a click is needed) image

Steps to reproduce

Use doom-emacs and a tiling windows manager.

Expected behavior

When focus is lost on a frame the modeline should be inactive. When focus is gain on a frame the modeline should be fully active (not needing an extra click).

OS

Linux

Emacs Version

29 (gccemacs-dev)

Emacs Configurations

Doom Emacs

Error callstack

No response

Anything else

No response

iris-garcia avatar Sep 05 '22 10:09 iris-garcia

Please try (advice-add #'select-window :after #'force-mode-line-update) and/or (add-function :after after-focus-change-function #'force-mode-line-update).

seagle0128 avatar Sep 05 '22 12:09 seagle0128

Please try (advice-add #'select-window :after #'force-mode-line-update) and/or (add-function :after after-focus-change-function #'force-mode-line-update).

Something not working as it should with: (advice-add #'select-window :after #'force-mode-line-update)

apply: Wrong number of arguments: #<subr force-mode-line-update>, 2

In any case, force-mode-line-update does not fix the problem, is there a way to trigger the mouse-click event?

iris-garcia avatar Sep 05 '22 12:09 iris-garcia

No idea what happen to your WM. Try this snippet

(advice-add #'select-window :after (lambda (&rest _) (force-mode-line-update)))
(advice-add #'handle-switch-frame :after #'doom-modeline-set-selected-window)
(add-function :after after-focus-change-function #'doom-modeline-set-selected-window)

seagle0128 avatar Sep 05 '22 16:09 seagle0128

No idea what happen to your WM. Try this snippet

(advice-add #'select-window :after (lambda (&rest _) (force-mode-line-update)))
(advice-add #'handle-switch-frame :after #'doom-modeline-set-selected-window)
(add-function :after after-focus-change-function #'doom-modeline-set-selected-window)

No luck with the snippet above :(.

Adding this one:

(defun do-click ()
  (interactive)
  (mouse-set-point 'click nil))

(global-set-key (kbd "<f9>") 'do-click)

When I press <f9> it fixes the modeline but there are still issues when the frame loses the focus (modeline not getting the inactive face)

iris-garcia avatar Sep 06 '22 07:09 iris-garcia

I think it's related to Emacs 29 and/or WM. I tested on macOS 12.5, Windows 10/11, Ubuntu KDE/Mate, Linux Mint Cinnamon, etc. It's working well. It seems face remapping is not working in your env. How about vanilla Emacs (emacs -Q)?

seagle0128 avatar Sep 06 '22 09:09 seagle0128

I think it's related to Emacs 29 and/or WM. I tested on macOS 12.5, Windows 10/11, Ubuntu KDE/Mate, Linux Mint Cinnamon, etc. It's working well. It seems face remapping is not working in your env. How about vanilla Emacs (emacs -Q)?

If you mean the default modeline without any extra configuration, that works as expected.

Vanilla Emacs + doom-modeline is something I haven't tried yet.

iris-garcia avatar Sep 06 '22 11:09 iris-garcia

Yes. I mean Vanilla Emacs + doom-modeline.

seagle0128 avatar Oct 03 '22 15:10 seagle0128

Ok, I confirm Vanilla Emacs + doom-modeline works as expected, I'll try to find out what is causing the issues in doom.

Thank you @seagle0128

iris-garcia avatar Oct 06 '22 14:10 iris-garcia