Skip to content

Rebuild dimmers on monitor hotplug (1.0.1)#3

Merged
Sandersm90 merged 2 commits into
mainfrom
fix/late-arriving-monitor-dimmer
Jun 3, 2026
Merged

Rebuild dimmers on monitor hotplug (1.0.1)#3
Sandersm90 merged 2 commits into
mainfrom
fix/late-arriving-monitor-dimmer

Conversation

@Sandersm90
Copy link
Copy Markdown
Contributor

Summary

  • Fixes a bug where, in daemon mode, the primary monitor stays bright while the others dim correctly. Triggered when GDK's monitor list at daemon-start is missing a monitor that comes online seconds later — e.g. a primary on a multi-GPU rig that briefly attaches to a passthrough HDMI on the secondary GPU during boot before switching to DP on the main GPU.
  • Splits App.surfaces into menu_window + Rc<RefCell<Vec<Window>>> dimmers so the dimmer set is mutable. window::watch_monitor_changes connects items-changed on gdk::Display::default().monitors(), destroys old dimmer windows on every delta, builds fresh ones for every currently-connected monitor, and presents them immediately if the menu is open.
  • Menu window left untouched — it owns the WebKitGTK process that daemon mode keeps alive across hide/show.
  • Bumps 1.0.01.0.1 (patch: bugfix, no API or config changes).

Test plan

  • cargo test — 3/3 pass
  • cargo build — clean
  • CI build (release) green
  • Manual: kill daemon, replug primary via a hotplug to force items-changed, trigger glogout, confirm all monitors dim

The daemon's dimmer set was a one-shot snapshot of
gdk::Display::default().monitors() taken in build_app. On a multi-GPU
rig where the primary briefly attaches to a passthrough HDMI during
boot before switching to DP on the main GPU, the snapshot misses the
real primary and the daemon never builds a dimmer for it — leaving
primary bright after the switch while the secondaries dim correctly.

Split App.surfaces into menu_window + Rc<RefCell<Vec<Window>>> dimmers
so the dimmer set can be replaced without rebuilding the menu (which
owns the WebKitGTK process daemon mode keeps alive across hide/show).
window::watch_monitor_changes connects items-changed on the GDK
monitor list and destroys + rebuilds the dimmer windows on every
delta, presenting them immediately if the menu is open.
@Sandersm90 Sandersm90 merged commit e9a97e1 into main Jun 3, 2026
1 check passed
@Sandersm90 Sandersm90 deleted the fix/late-arriving-monitor-dimmer branch June 3, 2026 19:18
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

Successfully merging this pull request may close these issues.

1 participant