neomacs icon indicating copy to clipboard operation
neomacs copied to clipboard

[Feature]: cursor-color-cycle on by default keeps an idle editor redrawing at 24 Hz (~10% CPU on a laptop)

Open worldofgeese opened this issue 2 weeks ago • 1 comments

Problem statement

cursor-color-cycle is on by default (CursorColorCycleConfig { enabled: true, fps: 24 }). A 24 Hz cap keeps it below the display refresh rate, but the frame is still redrawn and presented 24 times a second while the editor is idle. On a laptop that costs a lot of battery for an ambient effect.

Measured on an i7-8565U (Dell XPS 13 9380), Hyprland, Doom Emacs loaded, one frame idle with an org buffer, over 60 s:

neomacs CPU Hyprland CPU
default (cursor-color-cycle enabled) ~10% of one core ~5%
cursor-color-cycle :enabled nil 0% 0%

Nothing else changed between the two runs. The effect was turned off with (customize-set-variable 'neomacs-effect-cursor-color-cycle (plist-put (copy-sequence neomacs-effect-cursor-color-cycle) :enabled nil)).

Proposed solution

Any of these:

  • make the effect opt-in, like the other cursor effects (comet, glow, pulse), which default to off;
  • pause it while the frame is unfocused or Emacs has been idle for a few seconds;
  • pause it on battery power.

Alternatives considered

Turning it off in the user config, which we do now. A new user doesn't know that an animation is why the editor never idles.

Impact

Idle CPU drops to the GNU Emacs level, and so does the compositor work it causes. That means longer battery life for laptop users.

worldofgeese avatar Nov 12 '26 17:11 worldofgeese

An update on this: in v0.0.21, cursor color cycling is enabled by default again. It was a product decision, and I want to be upfront about it, since this issue asked for the opposite.

What stays the same as the opt-in fix:

  • The standing demand is still compositor-only, capped at 24 Hz (and at the display's refresh rate).
  • It pauses whenever the cycle can't change any pixels: unfocused frame, the blink-off phase, and hollow cursors.

If you'd prefer an idle editor with no ambient animation frames, as in your battery measurements, one line in your init file turns it off:

(customize-set-variable 'neomacs-effect-cursor-color-cycle '(:enabled nil))

With :enabled nil, the scheduler behaves exactly as it did after #763: no cursor-cycle demand and no wake deadline while idle. A regression test pins that. The change is feat(display): enable cursor color cycling by default in v0.0.21, and docs/display-engine/EFFECTS.md documents both settings.

eval-exec avatar Nov 22 '26 10:11 eval-exec