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

Hi there,

thanks for the PR. I think the idea is great. Some minor observations:

  • The text field seems to be selected by default when the app menu is opened, which is a bit annoying. I think an intentional selecting of the text field should be required and there should be an easy way to stop the editing (maybe a small (x) sign next to it?). Also, upon subsequent menu opening the percentage should not be selected.
  • The text field style seems to be a bit raw (you mention roundedBezel, but this does not seem to be the case).
  • Using the arrow keys for whatever reason the max is stuck at 52% when I was testing.
  • Holding SHIFT as modifier key did nothing, except selecting/deselecting the editable value (did not do the +/- 10%).

(note: I added UIDesignRequiresCompatibility to info.plist so the UI compiles properly for Tahoe).

Screenshot 2026-04-19 at 8 41 29

@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

Note: As AI generated PRs are getting more numerous now, I made decision that I won't review AI generated PRs/forks due to lack of time and resources. Of course other maintainers can help with this. I will not close such PRs however, but add a fork recommendation label so these forks are visible here for anybody who might be interested in this specific addition. If this is an original (non-AI) work with major effort involved, please let me know - I want to better honor such PRs and provide a more appropriate feedback as soon as I have the time. Thank you for your understanding!

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