Skip to content

Refresh button does not properly re-detect displays #3

Description

@RhoMancer

Bug Description

The refresh button (view-refresh-symbolic) in the header bar does not reliably re-detect displays after hardware changes (e.g., plugging/unplugging a monitor).

Current Behavior

When clicking refresh, the button:

  1. Shuts down the DdcService (releasing I2C locks)
  2. Sleeps 300ms
  3. Closes all windows
  4. Calls build_ui() to rebuild the entire UI

However, users report that the refresh does not properly pick up display changes. This may be because:

  • The 300ms sleep may be insufficient for some I2C bus settle times
  • Closing and rebuilding the entire window is heavy-handed and may not cleanly reinitialize DDC detection
  • The async DDC detection flow (with loading spinner) may not re-trigger properly on rebuild
  • DdcService thread state may not be fully cleaned up before re-detection starts

Expected Behavior

Clicking refresh should reliably detect all connected monitors and rebuild the display list with current brightness values.

Steps to Reproduce

  1. Open Temperlux with monitors connected
  2. Plug in or unplug a monitor
  3. Click the refresh button
  4. Observe that the display list does not correctly reflect the current hardware state

Environment

  • Temperlux version: 2.6.1
  • Relevant code: src/gui/window.rs lines 597-616 (refresh button handler)

Investigation Notes

The refresh handler at window.rs:604 shuts down the DdcService, sleeps 300ms, then closes all windows and calls build_ui(). The issue may be in:

  • Insufficient delay for I2C bus settling
  • build_ui() not properly reinitializing the async detection pipeline
  • Race condition between window close and DdcService cleanup

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions