mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 06:00:22 +02:00
- drop cruft: v4 DispatchKeypress undo, unused VKM import and __vrkbdPatched flag, redundant VRKBD_DISPLAY env in the unit - one wrap() helper for all replaced functions; key names for the stylesheet derived from the key definitions instead of repeated - unpatch: restore every layout ever patched (also ones disabled since) and the remembered component class instead of walking the tree again - helper: debounce re-injects after bursts of new JS contexts; resolve pending DevTools calls when the connection closes - arrow icons vertically centered again (hint stays at the bottom edge) - updated header comments
25 lines
1.0 KiB
JavaScript
25 lines
1.0 KiB
JavaScript
// Reverts patch.js in Steam's SharedJSContext; evaluated by helper.mjs
|
|
// when it stops (service stopped, module disabled). Every patched function
|
|
// keeps its original as __vrkbdOrig. Safe to run when nothing is patched.
|
|
(() => {
|
|
if (!window.__vrkbdWr) return 'not patched';
|
|
const unwrap = (obj, name) => {
|
|
const f = obj?.[name];
|
|
if (f?.__vrkbdOrig) obj[name] = f.__vrkbdOrig;
|
|
};
|
|
for (const l of window.__vrkbdLayouts || []) unwrap(l, 'rgLayout');
|
|
unwrap(SteamClient.Input, 'ControllerKeyboardSendText');
|
|
unwrap(window.__vrkbdProto, 'TypeKeyInternal');
|
|
clearInterval(window.__vrkbdHoldTimer);
|
|
|
|
const inst = window.__vrkbdInst;
|
|
if (inst) {
|
|
delete inst.__vrkbd;
|
|
inst.setState({ standardLayout: window.__vrkbdWr(40222).r_() });
|
|
inst.forceUpdate();
|
|
}
|
|
for (const p of g_PopupManager.GetPopups?.() || []) p.window?.document.getElementById('vrkbd-style')?.remove();
|
|
for (const k of ['__vrkbdHoldTimer', '__vrkbdHeld', '__vrkbdInst', '__vrkbdProto', '__vrkbdLayouts']) delete window[k];
|
|
return 'unpatched';
|
|
})()
|