Skip to content

Conversation

@mfbaltaza
Copy link

Summary

This feature adds a debounce mechanism to the brightness slider to prevent janky behavior when adjusting display brightness. Previously, every individual step of slider movement immediately triggered a DDCUtil call, causing rapid brightness changes and potential performance issues. Now, brightness changes are deferred until the user stops moving the slider (300ms delay), while linked sliders still update visually in real-time for immediate feedback.

What's changed

  • Modified src/ui/screens/show_displays.c: Implemented debounce pattern using GLib's g_timeout_add() and g_source_remove()
  • Added state tracking: Two static arrays (_pending_brightness_timeout_ids and _pending_brightness_values) to track pending timeout IDs and brightness values per display
  • New function _apply_debounced_brightness(): Handles the actual brightness application when the debounce timeout fires, including linked display support
  • Refactored _update_display_brightness(): Changed from immediate brightness changes to scheduling debounced updates

How to test locally

  1. Clone the branch: git checkout debounced-brightness-slider
  2. Build the project: ./build.sh
  3. Run the application: ./build/app
  4. Step A: Locate the brightness slider(s) in the displays screen
  5. Step B: Drag the slider rapidly up and down
  6. Step C: Verify that the display brightness changes smoothly without rapid flickering
  7. Step D: Stop moving the slider and wait ~300ms
  8. Step E: Verify the final brightness value is applied
  9. Step F: Test with multiple displays and "Link Brightness" enabled
  10. Step G: Verify linked sliders sync visually in real-time while brightness applies together after the delay

@mfbaltaza mfbaltaza mentioned this pull request Jan 8, 2026
@mfbaltaza mfbaltaza force-pushed the main branch 3 times, most recently from 5af2a00 to 52e4352 Compare January 8, 2026 22:26
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