Hide iPad modifier bar when a hardware keyboard is connected#35
Merged
Conversation
The on-screen modifier-key bar exists for touch/on-screen-keyboard users. When a physical keyboard is attached its modifier keys are already available, so the bar is redundant. Add PhysicalKeyboardObserver (backed by GameController's GCKeyboard connect/disconnect notifications) and let it suppress the bar; the user toggle still controls visibility otherwise, and is disabled while a hardware keyboard is present. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaxWSS3sLMWVddxDtYxS4N
There was a problem hiding this comment.
Pull request overview
Adds iPad-specific behavior to suppress the on-screen modifier-key bar when a physical keyboard is present, while preserving the existing user toggle behavior when no hardware keyboard is connected.
Changes:
- Introduces
PhysicalKeyboardObserver(GCKeyboard connect/disconnect-backed) and a pureModifierBarVisibility.shouldShow(...)rule. - Updates
ViewerViewto compute modifier bar visibility based on both the user toggle and hardware-keyboard presence, and disables the toggle while connected. - Adds unit tests covering the modifier-bar visibility precedence logic.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| KVMConsoleiPadTests/NanoKVMiPadTests.swift | Adds unit tests for modifier-bar visibility precedence logic. |
| KVMConsoleiPad/UI/ViewerView.swift | Uses PhysicalKeyboardObserver to hide the modifier bar when a hardware keyboard is connected and disables the toggle accordingly. |
| KVMConsoleiPad/Input/PhysicalKeyboardObserver.swift | Implements keyboard connection tracking via GCKeyboard notifications and a testable visibility rule helper. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Combine already provides ObservableObject/@published; the file references no SwiftUI symbols, so the import was unnecessary and coupled this input utility to the UI framework. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WaxWSS3sLMWVddxDtYxS4N
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The on-screen modifier-key bar exists for touch/on-screen-keyboard users.
When a physical keyboard is attached its modifier keys are already
available, so the bar is redundant. Add PhysicalKeyboardObserver (backed
by GameController's GCKeyboard connect/disconnect notifications) and let
it suppress the bar; the user toggle still controls visibility otherwise,
and is disabled while a hardware keyboard is present.
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01WaxWSS3sLMWVddxDtYxS4N