Merge remote-tracking branch 'origin/v4-dev' into aa/esmodule-steam

This commit is contained in:
AAGaming
2026-11-21 21:16:14 -05:00
19 changed files with 291 additions and 84 deletions
+1 -1
View File
@@ -80,7 +80,7 @@ jobs:
working-directory: ./backend
run: |
poetry dynamic-versioning
DECKY_REPO="${{ github.repository }}" DECKY_BRANCH="${{ github.event.number && format('PR{0}/{1}', github.event.number, github.head_ref) || github.ref_name }}" ${{ inputs.noconsole == true && 'DECKY_NOCONSOLE=1 ' || '' }}pyinstaller pyinstaller.spec
DECKY_REPO="${{ github.repository }}" DECKY_BRANCH="${{ github.event.number && github.head_ref || github.ref_name }}" DECKY_PR="${{ github.event.number }}" ${{ inputs.noconsole == true && 'DECKY_NOCONSOLE=1 ' || '' }}pyinstaller pyinstaller.spec
echo Builds:
ls ./dist
+2 -2
View File
@@ -190,7 +190,7 @@ class Tab:
# Page finishes loading when breakpoint hits
for _ in range(20):
# this works around 1/5 of the time, so just send it 8 times.
# this works around 1/5 of the time, so just send it 20 times.
# the js accounts for being injected multiple times allowing only one instance to run at a time anyway
await self._send_devtools_cmd({
"method": "Runtime.evaluate",
@@ -508,4 +508,4 @@ async def close_old_tabs():
if not t.title or (t.title not in SHARED_CTX_NAMES and any(url in t.url for url in CLOSEABLE_URLS) and not any(url in t.url for url in DO_NOT_CLOSE_URLS)):
logger.debug("Closing tab: " + getattr(t, "title", "Untitled"))
await t.close()
await sleep(0.5)
# await sleep(0.5)
+2
View File
@@ -44,6 +44,7 @@ class Updater:
self.isSupported: bool = ON_LINUX
self.repo = getenv('DECKY_REPO', 'SteamDeckHomebrew/decky-loader')
self.git_branch = getenv('DECKY_BRANCH', 'dirty')
self.git_pr = getenv('DECKY_PR', None)
try:
self.currentBranch = self.get_branch(self.context.settings)
@@ -98,6 +99,7 @@ class Updater:
"current": self.localVer,
"repo": self.repo,
"gitBranch": self.git_branch,
"gitPR": self.git_pr,
"remote": self.remoteVer,
"all": self.allRemoteVers,
"updatable": self.localVer != "unknown" and self.localVer != "dev",
+1 -1
View File
@@ -442,7 +442,7 @@ class Utilities:
enumerable: true,
configurable: true,
get: function() {
return (GamepadNavTree?.m_context?.m_controller || FocusNavController)?.m_ActiveContext?.ActiveWindow || window;
return (window?.GamepadNavTree?.m_context?.m_controller || window?.FocusNavController)?.m_ActiveContext?.ActiveWindow || window;
}
});
""" + await res.text() + "\n}"
+3
View File
@@ -7,6 +7,7 @@ noconsole_str = os.getenv('DECKY_NOCONSOLE', '0')
noconsole = bool(noconsole_str)
repo = os.getenv('DECKY_REPO', 'SteamDeckHomebrew/decky-loader')
branch = os.getenv('DECKY_BRANCH', 'main')
pr = os.getenv('DECKY_PR', None)
with open('build_config.py', 'w') as f:
f.write(f"""
import os
@@ -15,6 +16,8 @@ os.environ['DECKY_PACKAGED_BUILD'] = '1'
# Build info
os.environ['DECKY_REPO'] = {repr(repo)}
os.environ['DECKY_BRANCH'] = {repr(branch)}
if {repr(pr)} is not None:
os.environ['DECKY_PR'] = {repr(pr)}
# Windows-specific
os.environ['DECKY_NOCONSOLE'] = {repr(noconsole_str)}
+4 -5
View File
@@ -1,7 +1,6 @@
minimumReleaseAgeExclude:
- "@decky/api"
- "@decky/ui"
allowBuilds:
esbuild: true
overrides:
'@decky/ui': link:../../lib
minimumReleaseAgeExclude:
- '@decky/api'
- '@decky/ui'
+42 -13
View File
@@ -2,23 +2,52 @@ import { CSSProperties, FunctionComponent } from 'react';
interface NotificationBadgeProps {
show?: boolean;
vr?: boolean;
style?: CSSProperties;
}
const NotificationBadge: FunctionComponent<NotificationBadgeProps> = ({ show, style }) => {
const NotificationBadge: FunctionComponent<NotificationBadgeProps> = ({ show, style, vr }) => {
return show ? (
<div
style={{
position: 'absolute',
top: '8px',
right: '8px',
height: '10px',
width: '10px',
background: 'orange',
borderRadius: '50%',
...style,
}}
/>
vr ? (
// whoever made transform:scale completely break absolute positioning goes straight to super turbo hell this took me an hour
<div
style={{
top: 0,
left: 0,
marginLeft: 'auto',
width: 0,
height: 0,
overflow: 'visible',
transform: 'translate(0px, 0px)',
}}
>
<div
style={{
position: 'fixed',
top: '-18px',
right: '-6px',
width: '10px',
height: '10px',
background: 'orange',
borderRadius: '50%',
...style,
}}
/>
</div>
) : (
<div
style={{
position: 'absolute',
top: '8px',
right: '8px',
height: '10px',
width: '10px',
background: 'orange',
borderRadius: '50%',
...style,
}}
/>
)
) : null;
};
+33 -7
View File
@@ -1,4 +1,12 @@
import { ButtonItem, ErrorBoundary, Focusable, PanelSection, PanelSectionRow } from '@decky/ui';
import {
ButtonItem,
ErrorBoundary,
Focusable,
PanelSection,
PanelSectionRow,
joinClassNames,
vrDashboardClasses,
} from '@decky/ui';
import { FC, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import { FaBan, FaEyeSlash } from 'react-icons/fa';
@@ -8,7 +16,7 @@ import NotificationBadge from './NotificationBadge';
import { useQuickAccessVisible } from './QuickAccessVisibleState';
import TitleView from './TitleView';
const PluginView: FC = () => {
const PluginView: FC<{ vr?: boolean }> = ({ vr }) => {
const {
plugins,
disabledPlugins,
@@ -40,20 +48,38 @@ const PluginView: FC = () => {
if (activePlugin) {
return (
<Focusable onCancelButton={closeActivePlugin}>
<Focusable
onCancelButton={closeActivePlugin}
className={
(vr && joinClassNames(vrDashboardClasses.QuickAccessPopupPanel, vrDashboardClasses.BottomFade)) || ''
}
style={{
display: 'flex',
flexDirection: 'column',
paddingBottom: '20px', // override bottomfade, there is prolly a better way
}}
>
<TitleView />
<div style={{ height: '100%', paddingTop: '16px' }}>
<div style={{ paddingTop: '16px', overflowY: vr ? 'auto' : undefined }}>
<ErrorBoundary>{(visible || activePlugin.alwaysRender) && activePlugin.content}</ErrorBoundary>
</div>
</Focusable>
);
}
return (
<>
<div
className={(vr && joinClassNames(vrDashboardClasses.QuickAccessPopupPanel, vrDashboardClasses.BottomFade)) || ''}
style={{
display: 'flex',
flexDirection: 'column',
paddingBottom: '20px', // override bottomfade, there is prolly a better way
}}
>
<TitleView />
<div
style={{
paddingTop: '16px',
paddingTop: vr ? '16px' : '16px',
overflowY: vr ? 'auto' : undefined,
}}
>
<PanelSection>
@@ -92,7 +118,7 @@ const PluginView: FC = () => {
</div>
</PanelSection>
</div>
</>
</div>
);
};
@@ -1,16 +1,21 @@
import { FC, PropsWithChildren, createContext, useContext, useState } from 'react';
const QuickAccessVisibleState = createContext<boolean>(false);
export const QuickAccessVisibleState = createContext<boolean>(false);
export const useQuickAccessVisible = () => useContext(QuickAccessVisibleState);
export const QuickAccessVisibleStateProvider: FC<PropsWithChildren<{ tab: any }>> = ({ children, tab }) => {
const initial = tab.initialVisibility;
export const QuickAccessVisibleStateProvider: FC<PropsWithChildren<{ tab?: any; initialVal?: boolean }>> = ({
children,
tab,
initialVal,
}) => {
const initial = initialVal || tab?.initialVisibility;
const [visible, setVisible] = useState<boolean>(initial);
// HACK but i can't think of a better way to do this
tab.qAMVisibilitySetter = (val: boolean) => {
if (val != visible) setVisible(val);
};
if (tab)
tab.qAMVisibilitySetter = (val: boolean) => {
if (val != visible) setVisible(val);
};
return <QuickAccessVisibleState.Provider value={visible}>{children}</QuickAccessVisibleState.Provider>;
};
@@ -9,7 +9,7 @@ import {
Toggle,
showModal,
} from '@decky/ui';
import { useRef, useState } from 'react';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { FaFileArchive, FaLink, FaReact, FaSteamSymbol, FaTerminal } from 'react-icons/fa';
@@ -49,7 +49,6 @@ export default function DeveloperSettings() {
const [acceptedWarning, setAcceptedWarning] = useSetting<boolean>('developer.warn.third_party', false);
const waitTime = acceptedWarning ? 0 : 5;
const [pluginURL, setPluginURL] = useState('');
const textRef = useRef<HTMLDivElement>(null);
const { t } = useTranslation();
return (
@@ -82,13 +81,6 @@ export default function DeveloperSettings() {
</Field>
<Field
label={t('SettingsDeveloperIndex.third_party_plugins.label_url')}
description={
<TextField
label={t('SettingsDeveloperIndex.third_party_plugins.label_desc')}
value={pluginURL}
onChange={(e) => setPluginURL(e?.target.value)}
/>
}
icon={<FaLink style={{ display: 'block' }} />}
>
<DialogButton
@@ -114,6 +106,11 @@ export default function DeveloperSettings() {
{t('SettingsDeveloperIndex.third_party_plugins.button_install')}
</DialogButton>
</Field>
<TextField
label={t('SettingsDeveloperIndex.third_party_plugins.label_desc')}
value={pluginURL}
onChange={(e) => setPluginURL(e?.target.value)}
/>
</DialogControlsSection>
<DialogControlsSection>
<DialogControlsSectionHeader>{t('SettingsDeveloperIndex.header')}</DialogControlsSectionHeader>
@@ -160,18 +157,7 @@ export default function DeveloperSettings() {
<Field
label={t('SettingsDeveloperIndex.react_devtools.label')}
description={
<>
<span style={{ whiteSpace: 'pre-line' }}>{t('SettingsDeveloperIndex.react_devtools.desc')}</span>
<br />
<br />
<div ref={textRef}>
<TextField
label={t('SettingsDeveloperIndex.react_devtools.ip_label')}
value={reactDevtoolsIP}
onChange={(e) => setReactDevtoolsIP(e?.target.value)}
/>
</div>
</>
<span style={{ whiteSpace: 'pre-line' }}>{t('SettingsDeveloperIndex.react_devtools.desc')}</span>
}
icon={<FaReact style={{ display: 'block' }} />}
>
@@ -184,6 +170,11 @@ export default function DeveloperSettings() {
}}
/>
</Field>
<TextField
label={t('SettingsDeveloperIndex.react_devtools.ip_label')}
value={reactDevtoolsIP}
onChange={(e) => setReactDevtoolsIP(e?.target.value)}
/>
</DialogControlsSection>
</DialogBody>
);
@@ -58,7 +58,8 @@ export default function GeneralSettings({
<DialogControlsSectionHeader>{t('SettingsGeneralIndex.about.header')}</DialogControlsSectionHeader>
<Field label={t('SettingsGeneralIndex.about.decky_version')} focusable={true}>
<div style={{ color: 'var(--gpSystemLighterGrey)' }}>
{versionInfo?.current} ({versionInfo?.repo}#{versionInfo?.gitBranch})
{versionInfo?.current} ({versionInfo?.repo}#{versionInfo?.gitBranch}
{versionInfo?.gitPR ? ` (#${versionInfo.gitPR})` : ''})
</div>
</Field>
</DialogControlsSection>
+13 -12
View File
@@ -30,17 +30,18 @@ export async function setShowValveInternal(show: boolean) {
}
}
export async function setShouldConnectToReactDevTools(enable: boolean) {
DeckyPluginLoader.toaster.toast({
title: enable ? (
<TranslationHelper transClass={TranslationClass.DEVELOPER} transText={'enabling'} />
) : (
<TranslationHelper transClass={TranslationClass.DEVELOPER} transText={'disabling'} />
),
body: <TranslationHelper transClass={TranslationClass.DEVELOPER} transText={'5secreload'} />,
icon: <FaReact />,
});
await sleep(5000);
export async function setShouldConnectToReactDevTools(enable: boolean, skipWait?: boolean) {
skipWait ||
DeckyPluginLoader.toaster.toast({
title: enable ? (
<TranslationHelper transClass={TranslationClass.DEVELOPER} transText={'enabling'} />
) : (
<TranslationHelper transClass={TranslationClass.DEVELOPER} transText={'disabling'} />
),
body: <TranslationHelper transClass={TranslationClass.DEVELOPER} transText={'5secreload'} />,
icon: <FaReact />,
});
skipWait || (await sleep(5000));
return enable ? DeckyBackend.call('utilities/enable_rdt') : DeckyBackend.call('utilities/disable_rdt');
}
@@ -51,5 +52,5 @@ export async function startup() {
if (isValveInternalEnabled) setShowValveInternal(isValveInternalEnabled);
if ((isRDTEnabled && !window.deckyHasConnectedRDT) || (!isRDTEnabled && window.deckyHasConnectedRDT))
setShouldConnectToReactDevTools(isRDTEnabled);
setShouldConnectToReactDevTools(isRDTEnabled, true);
}
@@ -16,15 +16,15 @@ import {
DeckyGlobalComponentsState,
DeckyGlobalComponentsStateContextProvider,
useDeckyGlobalComponentsState,
} from './components/DeckyGlobalComponentsState';
} from '../components/DeckyGlobalComponentsState';
import {
DeckyRouterState,
DeckyRouterStateContextProvider,
RoutePatch,
RouterEntry,
useDeckyRouterState,
} from './components/DeckyRouterState';
import Logger from './logger';
} from '../components/DeckyRouterState';
import Logger from '../logger';
declare global {
interface Window {
@@ -72,7 +72,7 @@ class RouterHook extends Logger {
this.patchGamepadRouter();
break;
// Not fully implemented yet
// case UIMode.Desktop:
// case EUIMode.Desktop:
// this.debug("Patching desktop router");
// this.patchDesktopRouter();
// break;
@@ -10,8 +10,8 @@ import {
getReactRoot,
} from '@decky/ui';
import { QuickAccessVisibleStateProvider } from './components/QuickAccessVisibleState';
import Logger from './logger';
import { QuickAccessVisibleStateProvider } from '../components/QuickAccessVisibleState';
import Logger from '../logger';
declare global {
interface Window {
@@ -9,8 +9,8 @@ import {
replacePatch,
} from '@decky/ui';
import Toast from './components/Toast';
import Logger from './logger';
import Toast from '../components/Toast';
import Logger from '../logger';
declare global {
interface Window {
+105
View File
@@ -0,0 +1,105 @@
// Hook the SteamVR Hotbar
import { ErrorBoundary, Patch, afterPatch, findInReactTree, findModuleExport, getReactRoot } from '@decky/ui';
import { ReactNode, createElement } from 'react';
import Logger from '../logger';
declare global {
interface Window {
__VR_DASHBAORD_BAR_HOOK_INSTANCE: any;
}
}
// TODO kinda dumb
enum VRDashboardBarButtonID {
Decky = 999,
}
export interface VRDashboardBarButton {
id: VRDashboardBarButtonID | number;
active?: boolean;
children?: ReactNode;
tooltip?: ReactNode;
popupContents?: ReactNode;
onActivate?: () => void;
refBarPopupHandle?: any; // TODO idk
onPopupVisibilityChanged?: (visible: boolean) => void;
}
class VRDashboardBarHook extends Logger {
rightSideButtons: VRDashboardBarButton[] = [];
private rendererdRightSideButtons: ReactNode[] = [];
private barPatch?: Patch;
private barButton?: any;
constructor() {
super('VRDashboardBarHook');
this.log('Initialized');
window.__VR_DASHBAORD_BAR_HOOK_INSTANCE?.deinit?.();
window.__VR_DASHBAORD_BAR_HOOK_INSTANCE = this;
}
init() {
this.barButton = findModuleExport((e) => e?.render?.toString()?.includes('VRDashboardBarSmallButtonActive'));
const barComponent = findModuleExport((e) => e?.type?.toString()?.includes('vrLocation=="dashboard-bar"'));
this.barPatch = afterPatch(barComponent, 'type', (_, ret) => {
const nodes = findInReactTree(ret, (x) => x?.length > 6);
if (!window?.securitystore?.IsLockScreenActive?.()) nodes.splice(4, 0, this.rendererdRightSideButtons);
return ret;
});
// Patch already rendered bar
const root = getReactRoot(document.getElementById('root') as any);
const barNode =
root &&
findInReactTree(
root,
(n: any) => n.elementType == barComponent || (barComponent != null && n.elementType == barComponent),
); // need elementType, because case where type is actually mobx wrapper
if (barNode) {
// Only affects this fiber node so we don't need to unpatch here
barNode.type = barNode.elementType.type;
if (barNode?.alternate) {
barNode.alternate.type = barNode.type;
}
}
}
deinit() {
this.barPatch?.unpatch();
}
addRightSideButton(button: VRDashboardBarButton) {
this.debug('Adding RSB', button.id, 'to render array');
this.rightSideButtons.push(button);
this.renderRightSideButtons();
}
removeRightSideButton(id: number) {
this.debug('Removing RSB', id);
this.rightSideButtons = this.rightSideButtons.filter((button) => button.id !== id);
this.renderRightSideButtons();
}
renderRightSideButtons() {
const arr = [];
for (const button of this.rightSideButtons) {
arr.push(
createElement(this.barButton, {
active: button.active,
children: <ErrorBoundary>{button.children}</ErrorBoundary>,
tooltip: button.tooltip,
popupContents: <ErrorBoundary>{button.popupContents}</ErrorBoundary>,
onActivate: button.onActivate,
refBarPopupHandle: button.refBarPopupHandle,
onPopupVisibilityChanged: button.onPopupVisibilityChanged,
}),
);
}
this.rendererdRightSideButtons = arr;
}
}
export default VRDashboardBarHook;
+50 -6
View File
@@ -7,9 +7,11 @@ import {
PanelSectionRow,
QuickAccessTab,
findSP,
joinClassNames,
quickAccessMenuClasses,
showModal,
sleep,
vrDashboardClasses,
} from '@decky/ui';
import { FC, lazy } from 'react';
import { FaDownload, FaExclamationCircle, FaExclamationTriangle, FaPlug } from 'react-icons/fa';
@@ -24,19 +26,20 @@ import PluginInstallModal from './components/modals/PluginInstallModal';
import PluginUninstallModal from './components/modals/PluginUninstallModal';
import NotificationBadge from './components/NotificationBadge';
import PluginView from './components/PluginView';
import { useQuickAccessVisible } from './components/QuickAccessVisibleState';
import { QuickAccessVisibleStateProvider, useQuickAccessVisible } from './components/QuickAccessVisibleState';
import WithSuspense from './components/WithSuspense';
import ErrorBoundaryHook from './errorboundary-hook';
import { FrozenPluginService } from './frozen-plugins-service';
import { HiddenPluginsService } from './hidden-plugins-service';
import RouterHook from './hooks/router';
import TabsHook from './hooks/tabs';
import Toaster from './hooks/toaster';
import VRDashboardBarHook from './hooks/vr-dashboard-bar';
import Logger from './logger';
import { NotificationService } from './notification-service';
import { DisabledPlugin, InstallType, Plugin, PluginLoadType } from './plugin';
import RouterHook from './router-hook';
import { deinitSteamFixes, initSteamFixes } from './steamfixes';
import { PluginUpdateMapping, checkForPluginUpdates } from './store';
import TabsHook from './tabs-hook';
import Toaster from './toaster';
import { getVersionInfo } from './updater';
import { getPluginDisplayName } from './utils/pluginHelpers';
import { getSetting, setSetting } from './utils/settings';
@@ -70,6 +73,7 @@ class PluginLoader extends Logger {
private plugins: Plugin[] = [];
public errorBoundaryHook: ErrorBoundaryHook = new ErrorBoundaryHook();
private tabsHook: TabsHook = new TabsHook();
private vrDashboardBarHook: VRDashboardBarHook = new VRDashboardBarHook(); // TODO public? unsure
public routerHook: RouterHook = new RouterHook();
public toaster: Toaster = new Toaster();
private deckyState: DeckyState = new DeckyState();
@@ -105,10 +109,11 @@ class PluginLoader extends Logger {
DeckyBackend.addEventListener(`loader/plugin_event`, this.pluginEventListener);
this.tabsHook.init();
this.vrDashboardBarHook.init();
const TabBadge = () => {
const TabBadge = ({ vr }: { vr?: boolean }) => {
const { updates, hasLoaderUpdate } = useDeckyState();
return <NotificationBadge show={(updates && updates.size > 0) || hasLoaderUpdate} />;
return <NotificationBadge vr={vr} show={(updates && updates.size > 0) || hasLoaderUpdate} />;
};
this.tabsHook.add({
@@ -127,6 +132,44 @@ class PluginLoader extends Logger {
),
});
this.vrDashboardBarHook.addRightSideButton({
id: 999,
tooltip: 'Decky',
popupContents: (
<QuickAccessVisibleStateProvider initialVal={true}>
{' '}
{/*for compat only, these don't render when inactive*/}
<DeckyStateContextProvider deckyState={this.deckyState}>
<div className={joinClassNames(vrDashboardClasses.DashboardBarPopupContents)}>
<PluginView vr={true} />
</div>
</DeckyStateContextProvider>
</QuickAccessVisibleStateProvider>
),
children: (
<DeckyStateContextProvider deckyState={this.deckyState}>
<div
style={{
display: 'flex',
alignItems: 'center',
justifyContent: 'center',
}}
className={'deckyVRIcon'}
>
<FaPlug style={{ marginRight: '0px' }} />
<TabBadge vr={true} />
<style>
{`
div:has(>.deckyVRIcon) {
overflow: visible !important;
}
`}
</style>
</div>
</DeckyStateContextProvider>
),
});
this.routerHook.addRoute('/decky/store', () => (
<DeckyStateContextProvider deckyState={this.deckyState}>
<WithSuspense route={true}>
@@ -399,6 +442,7 @@ class PluginLoader extends Logger {
deinitFilepickerPatches();
this.routerHook.deinit();
this.tabsHook.deinit();
this.vrDashboardBarHook.deinit();
this.toaster.deinit();
this.errorBoundaryHook.deinit();
}
+1
View File
@@ -20,6 +20,7 @@ export interface VerInfo {
current: string;
repo: string;
gitBranch: string;
gitPR: string | null;
remote: RemoteVerInfo | null;
all: RemoteVerInfo[] | null;
updatable: boolean;
+1 -1
View File
@@ -10,7 +10,7 @@ fi
# https://jackson.dev/post/a-portable-nix-shell-shebang/
if [ -z "$INSIDE_NIX_RANDOMSTRING" ] && command -v nix &> /dev/null; then
if [ -z "$INSIDE_NIX_RANDOMSTRING" ] && command -v nix &> /dev/null && test -e /etc/NIXOS; then
# If the user has nix, relaunch in nix shell with dependencies added
INSIDE_NIX_RANDOMSTRING=1 nix shell \
nixpkgs#websocat \