-
Notifications
You must be signed in to change notification settings - Fork 340
feat(ui): add "Try Wake Host" button to no-signal overlay #1236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ import { isWindows } from "@/utils"; | |
| import useKeyboard from "@hooks/useKeyboard"; | ||
| import useMouse from "@hooks/useMouse"; | ||
| import { useRTCStore, useSettingsStore, useUiStore, useVideoStore } from "@hooks/stores"; | ||
| import { useJsonRpc } from "@hooks/useJsonRpc"; | ||
| import VirtualKeyboard from "@components/VirtualKeyboard"; | ||
| import Actionbar from "@components/ActionBar"; | ||
| import MacroBar from "@components/MacroBar"; | ||
|
|
@@ -30,6 +31,8 @@ export default function WebRTCVideo({ | |
| }) { | ||
| // Video and stream related refs and states | ||
| const videoElm = useRef<HTMLVideoElement>(null); | ||
| const [isWaking, setIsWaking] = useState(false); | ||
| const { send } = useJsonRpc(); | ||
| const fullscreenContainerRef = useRef<HTMLDivElement>(null); | ||
| const { mediaStream, peerConnectionState } = useRTCStore(); | ||
| const [isPlaying, setIsPlaying] = useState(false); | ||
|
|
@@ -39,6 +42,18 @@ export default function WebRTCVideo({ | |
| const isPointerLockPossible = | ||
| window.location.protocol === "https:" || window.location.hostname === "localhost"; | ||
|
|
||
| // Wake host handler - sends a spacebar press+release to wake sleeping host | ||
| const handleWakeHost = useCallback(() => { | ||
| setIsWaking(true); | ||
| // Send spacebar (HID usage 0x2C) press | ||
| send("keyboardReport", { keys: [0x2c, 0, 0, 0, 0, 0], modifier: 0 }, () => { | ||
| // Send key release | ||
| send("keyboardReport", { keys: [0, 0, 0, 0, 0, 0], modifier: 0 }, () => { | ||
| setTimeout(() => setIsWaking(false), 3000); | ||
| }); | ||
| }); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wake button stuck forever if RPC send silently failsMedium Severity The |
||
| }, [send]); | ||
|
|
||
| // Store hooks | ||
| const settings = useSettingsStore(); | ||
| const { handleKeyPress, resetKeyboardState } = useKeyboard(); | ||
|
|
@@ -675,7 +690,12 @@ export default function WebRTCVideo({ | |
| > | ||
| <div className="relative h-full w-full rounded-md"> | ||
| <LoadingVideoOverlay show={isVideoLoading} /> | ||
| <HDMIErrorOverlay show={hdmiError} hdmiState={hdmiState} /> | ||
| <HDMIErrorOverlay | ||
| show={hdmiError} | ||
| hdmiState={hdmiState} | ||
| onWakeHost={handleWakeHost} | ||
| isWaking={isWaking} | ||
| /> | ||
| <NoAutoplayPermissionsOverlay | ||
| show={hasNoAutoPlayPermissions} | ||
| onPlayClick={() => { | ||
|
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dead
wakeup_on_writecheck after refactoring tooptionalAttrsLow Severity
The
IgnoreErrors: key == "wakeup_on_write"check inwriteGadgetAttrsis now dead code. This PR movedwakeup_on_writefromattrstooptionalAttrsacross all three HID configs, sowriteGadgetAttrswill never see that key. The leftover condition is misleading and could confuse future maintainers about where optional attribute handling lives.