mirror of
https://github.com/lhns/steam-frame-nix.git
synced 2026-10-06 07:00:27 +02:00
lib: shared resolvePatch, ensureStyle, logger; legacy wrapper code removed
- finders.js (VERSION 2): resolvePatch (resolveAll or the "signature not found, ... left unpatched" status), ensureStyle and logger, used by the patches instead of their own copies. - hooks.js (VERSION 2) no longer unwinds per-patch wrappers of old patch versions; dashboard-windows and steam-close-button drop their handling of versions <= 2 / <= 6 (in-page only, gone with any SteamVR restart). - VERSIONs: dashboard-windows 4, steam-close-button 9, window-curvature 21, frame-controls 7, steam-keyboard-patch 22, launcher-menu grid 7, pinned-desktop 4, show-all 2.
This commit is contained in:
1 parent
36886d61df
commit
a5ecbad76d
11 files changed
+68
-108
No files matched your search
@@ -22,14 +22,10 @@
|
||||
// mkPatch patch (see lib/default.nix); no options. On a signature mismatch
|
||||
// it returns an error and changes nothing. Idempotent.
|
||||
((find, sigs) => {
|
||||
const VERSION = 21;
|
||||
const VERSION = 22;
|
||||
const send = (msg) => window.__vrkbdKey && window.__vrkbdKey(msg);
|
||||
let mods;
|
||||
try {
|
||||
mods = find.resolveAll(find.getWebpackRequire('webpackChunksteamui'), sigs);
|
||||
} catch (e) {
|
||||
return `signature not found, Steam left unpatched: ${e.message}`;
|
||||
}
|
||||
const mods = find.resolvePatch('webpackChunksteamui', sigs);
|
||||
if (typeof mods === 'string') return mods;
|
||||
const Layouts = mods.layouts.exports; // currentLayout(), enabledLayouts(), arrow keys
|
||||
const Status = mods.vrStatus.exports.holder; // .VRKeyboardStatus
|
||||
const Manager = mods.keyboardManager.exports.VirtualKeyboardManager.prototype;
|
||||
@@ -214,9 +210,7 @@
|
||||
const sel = (keys, suffix = '') => keys.map((key) => `[data-key="${key}"]${suffix}`).join(',');
|
||||
const lastRow = Math.max(...[...doc.querySelectorAll('[data-key-row]')].map((e) => +e.getAttribute('data-key-row')));
|
||||
const added = [...MODS, ...ARROWS.map(first), ...ALTGR_ARROWS].map((x) => x.key);
|
||||
let style = doc.getElementById('vrkbd-style');
|
||||
if (!style) { style = doc.createElement('style'); style.id = 'vrkbd-style'; doc.head.appendChild(style); }
|
||||
style.textContent = [
|
||||
find.ensureStyle(doc, 'vrkbd-style', [
|
||||
`${sel(added)} { width: 43px !important; }`,
|
||||
'[data-key="AltGr"] { width: 52px !important; }',
|
||||
// Steam draws the AltGr variant as a small secondary label: hide it in the
|
||||
@@ -236,7 +230,7 @@
|
||||
// Motiva Sans descent 0.24 em, } 0.094 em below the baseline).
|
||||
`.vrkbd-del-hint [role="gridcell"]:has(+ [role="gridcell"] > [data-key="Backspace"]) > [data-key]:not([data-key="${DEL}"]) > div > span:last-child:not(:first-child) {` +
|
||||
' font-size: 7px !important; bottom: 4.42px !important; }',
|
||||
].join('\n');
|
||||
].join('\n'));
|
||||
|
||||
// ---- key handling ----------------------------------------------------------
|
||||
const release = (v) => { const z = v & 3; return (z === 1 ? 0 : z) | (v & 4); };
|
||||
|
||||
Reference in new issue
Block a user