feat: Add numerical input and arrow key support for sliders by karanshah229 · Pull Request #1860 · MonitorControl/MonitorControl · GitHub
Skip to content

feat: Add numerical input and arrow key support for sliders#1860

Open
karanshah229 wants to merge 3 commits into
MonitorControl:mainfrom
karanshah229:main
Open

feat: Add numerical input and arrow key support for sliders#1860
karanshah229 wants to merge 3 commits into
MonitorControl:mainfrom
karanshah229:main

Conversation

@karanshah229

Copy link
Copy Markdown

Description

This PR addresses user feedback regarding the difficulty of hitting exact values (e.g., exactly 43% or 87%) through the menu bar sliders via mouse drag.

Changes proposed in this pull request:

  • Editable Values: The percentage labels located to the right of the menu bar sliders are now selectable NSTextField elements.
  • Native Visual Feedback: Clicking the percentage value transitions it into an isBezeled = true .roundedBezel style so the user clearly understands they can type.
  • Arrow Key Support: Overridden control(_:textView:doCommandBy:) to capture continuous Up/Down arrow inputs when the field is actively focused.
  • Modifiers & Clamping:
    • Standard arrow presses increment/decrement by 1%.
    • Holding Shift increments/decrements by 10%.
    • Bounds are clamped between 0% and 100%.
  • Live Syncing: Interactions via arrow keys trigger instantaneous syncs via self.valueChanged(slider:), resulting in fluid DDC brightness/volume ramps without needing to press Enter.
  • Fail-safe Parsing: Non-numeric or invalid string inputs gracefully fall back to the currently configured monitor state without layout breaks.

- Converted menu bar percentage labels into editable text fields.
- Implemented `NSTextFieldDelegate` to handle manual typing with bound clamping (0-100).
- Handled invalid string parsing with graceful fallbacks to the current slider state.
- Added a native rounded bezel effect when the field is actively focused.
- Overrode `control(_:textView:doCommandBy:)` to capture Up/Down arrow presses for live value manipulation.
- Added a `Shift` modifier for arrow keys to toggle between 1% and 10% step increments.
- Ensured all manual inputs immediately sync physical hardware brightness, volume, and contrast via DDC.
@waydabber

Copy link
Copy Markdown
Member

@waydabber waydabber added in progress Issue currently being worked on feedback needed from reporter Waiting for issue reporter to provide feedback (see comments) labels Apr 19, 2026
@karanshah229

Copy link
Copy Markdown
Author

Hey @waydabber, thanks for taking out the time to review the PR and give feedback.

I have addressed all the mentioned issues. Can you re-review the PR ?

@waydabber waydabber added AI contribution / fork recommendation Unplanned PR (typically AI) with improvements which may be of interest to the community and removed in progress Issue currently being worked on feedback needed from reporter Waiting for issue reporter to provide feedback (see comments) labels May 9, 2026
@waydabber

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI contribution / fork recommendation Unplanned PR (typically AI) with improvements which may be of interest to the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants