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

Non-Emacs windows blink when Mingus window is open #259

Closed
kahrkunne opened this issue May 19, 2017 · 16 comments
Closed

Non-Emacs windows blink when Mingus window is open #259

kahrkunne opened this issue May 19, 2017 · 16 comments

Comments

@kahrkunne
Copy link

kahrkunne commented May 19, 2017

Opening a window with Mingus (https://github.com/pft/mingus) somewhere makes X windows (i.e. Chrome etc) blink with my Emacs background colour when in focus.

EDIT: only happens in the mingus playlist, not in the browser or controls page

@ch11ng
Copy link
Owner

ch11ng commented May 21, 2017

The problem is mingus sets up an idle timer that would call force-mode-line-update to update the mode-line when Emacs gets idle, and that it also sets up the mode-line so that Emacs would call mingus-make-mode-line-string when updating the mode-line. mingus-make-mode-line-string interacts with mpd through libmpdee that involves some process handling stuffs conflicting with XELB or EXWM.

@kahrkunne
Copy link
Author

I see. That must be related to mingus' ability to display the currently playing song.

For what it's worth, I've tried running (defun mingus-make-mode-line-string (lambda () nil)) because I don't actually need that behaviour, but that doesn't fix the problem; the windows no longer blink the background colour, but they still blink in and out of focus.

@ch11ng
Copy link
Owner

ch11ng commented May 29, 2017

Sorry for leaving out one thing. mingus-make-mode-line-help-echo also gets called during that time. Please try redefining mingus-mode-line-object to something like "".

@kahrkunne
Copy link
Author

Doesn't solve the problem, sadly.

@ch11ng
Copy link
Owner

ch11ng commented Jun 3, 2017

(setq mingus-mode-line-object "") seems to fix the problem here. You need to set this variable before calling mingus.

@kahrkunne
Copy link
Author

It does not fix the problem here. The chrome window doesn't blink the background colour anymore, but it still blinks, and typing is essentially impossible.

@ch11ng
Copy link
Owner

ch11ng commented Jun 11, 2017

Is #264 related?

@tidux
Copy link

tidux commented Jun 21, 2017

I'm pretty sure this is just Mingus calling (redisplay) and not technically a bug in exwm or Emacs.

@ch11ng
Copy link
Owner

ch11ng commented Jun 25, 2017

@tidux Could you elaborate on this?

@tidux
Copy link

tidux commented Jun 25, 2017

Mingus uses (redisplay) to redraw itself once a second. For normal emacs windows this isn't an issue, but for X windows it causes blinking at that same pace since they get forcibly redrawn from scratch. My fix was using other mpd clients, like ncmpcpp in urxvt, or Cantata.

@ch11ng
Copy link
Owner

ch11ng commented Jun 25, 2017

@tidux Thanks but did you mean Mingus indirectly called redisplay? I didn't find any direct call in its source (https://github.com/pft/mingus)?

@kahrkunne
Copy link
Author

kahrkunne commented Jun 30, 2017

(run-with-idle-timer 1 t #'redisplay), which runs (redisplay) once a second, was not able to reproduce the issue, so that can't be it.

@kahrkunne
Copy link
Author

kahrkunne commented Jun 30, 2017

Running mingus-cancel-timer with mingus open seems to at least temporarily fix the problem. I'll look through the source code and see how I can reproduce the issue.

EDIT: the offending line is (mingus-set-NP-mark t)

EDIT2: I've narrowed the offending code down to

(save-excursion
  (save-window-excursion
    (mingus-switch-to-playlist)))

The problem seems to be that mingus is constantly switching buffers to its playlist and back; that's the flickering we're seeing. The window that our currently focused buffer (in our case, an X buffer) is in switches to the Mingus buffers for a split second.
The relevant code is this:

(defun mingus-switch-to-playlist ()
  (cond
   ((get-buffer-window "*Mingus*")
    (select-window (get-buffer-window "*Mingus*")))
   (t
    (switch-to-buffer "*Mingus*")))
  (mingus-playlist-mode))```

@kahrkunne
Copy link
Author

kahrkunne commented Jul 1, 2017

I think I'm gonna call this a Mingus bug... Thinking about it, Mingus is basically relying on being able to switch buffer sufficiently quick that it never renders.

EXWM isn't the only package which has problems with this; ace-window also has a bug when using in combination with mingus.

EDIT: I've submitted an issue to the EXWM bug tracker (pft/mingus#26). However, that bug tracker hasn't been active since january 2015, so I'm unsure if mingus is even supported anymore...

@ch11ng
Copy link
Owner

ch11ng commented Jul 9, 2017

@kahrkunne Thanks for your work!

@ch11ng
Copy link
Owner

ch11ng commented Oct 21, 2018

@kahrkunne I'd assume there is nothing can be done here. So I'm closing this issue now.

@ch11ng ch11ng closed this as completed Oct 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants