mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-07-11 12:31:59 +00:00
fix friends menu focusing itself
This commit is contained in:
@@ -32,7 +32,7 @@ const PluginView: VFC = () => {
|
|||||||
.map(({ name, icon }) => (
|
.map(({ name, icon }) => (
|
||||||
<PanelSectionRow key={name}>
|
<PanelSectionRow key={name}>
|
||||||
<ButtonItem layout="below" onClick={() => setActivePlugin(name)}>
|
<ButtonItem layout="below" onClick={() => setActivePlugin(name)}>
|
||||||
<div style={{ display: 'flex', alignItems: "center", justifyContent: 'space-between' }}>
|
<div style={{ display: 'flex', alignItems: 'center', justifyContent: 'space-between' }}>
|
||||||
{icon}
|
{icon}
|
||||||
<div>{name}</div>
|
<div>{name}</div>
|
||||||
<NotificationBadge show={updates?.has(name)} style={{ top: '-5px', right: '-5px' }} />
|
<NotificationBadge show={updates?.has(name)} style={{ top: '-5px', right: '-5px' }} />
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ class TabsHook extends Logger {
|
|||||||
});
|
});
|
||||||
this.cNode = scrollRoot;
|
this.cNode = scrollRoot;
|
||||||
this.cNode.stateNode.forceUpdate();
|
this.cNode.stateNode.forceUpdate();
|
||||||
|
this.log('Finished initial injection');
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,14 @@
|
|||||||
import { Patch, ToastData, afterPatch, findInReactTree, findModuleChild, sleep } from 'decky-frontend-lib';
|
import {
|
||||||
|
Patch,
|
||||||
|
ToastData,
|
||||||
|
afterPatch,
|
||||||
|
callOriginal,
|
||||||
|
findInReactTree,
|
||||||
|
findModuleChild,
|
||||||
|
replacePatch,
|
||||||
|
sleep,
|
||||||
|
staticClasses,
|
||||||
|
} from 'decky-frontend-lib';
|
||||||
import { ReactNode } from 'react';
|
import { ReactNode } from 'react';
|
||||||
|
|
||||||
import Toast from './components/Toast';
|
import Toast from './components/Toast';
|
||||||
@@ -27,6 +37,25 @@ class Toaster extends Logger {
|
|||||||
|
|
||||||
async init() {
|
async init() {
|
||||||
let instance: any;
|
let instance: any;
|
||||||
|
const focusManager = findModuleChild((m) => {
|
||||||
|
if (typeof m !== 'object') return false;
|
||||||
|
for (let prop in m) {
|
||||||
|
if (m[prop]?.prototype?.TakeFocus) return m[prop];
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
|
const focusWorkaroundPatch = replacePatch(focusManager.prototype, 'BFocusWithin', function () {
|
||||||
|
// @ts-ignore
|
||||||
|
console.log(this as any);
|
||||||
|
// @ts-ignore
|
||||||
|
if (this.m_node?.m_element && this.m_node?.m_element.classList.contains(staticClasses.TabGroupPanel)) {
|
||||||
|
console.log('got the focus hook');
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return callOriginal;
|
||||||
|
});
|
||||||
while (true) {
|
while (true) {
|
||||||
instance = findInReactTree(
|
instance = findInReactTree(
|
||||||
(document.getElementById('root') as any)._reactRootContainer._internalRoot.current,
|
(document.getElementById('root') as any)._reactRootContainer._internalRoot.current,
|
||||||
@@ -71,6 +100,7 @@ class Toaster extends Logger {
|
|||||||
if (typeof m[prop]?.settings && m[prop]?.communityPreferences) return m[prop];
|
if (typeof m[prop]?.settings && m[prop]?.communityPreferences) return m[prop];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
focusWorkaroundPatch.unpatch();
|
||||||
this.log('Initialized');
|
this.log('Initialized');
|
||||||
this.ready = true;
|
this.ready = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user