Files
decky-frontend-lib/src/globals/steam-client/Window.ts
Yao Chung Hu 131ab4cc11 feat(globals): Steam client reference (#92)
* change: Add SteamClient types

Steam Version:  1690583737
Steam Client Build Date:  Sat, Jul 29 02:44 UTC -08:00

* new: Document some SteamClient interfaces

Using the SDH discord server, GitHub and some personal findings, I tried to document as much SteamClient functions as I can.

* new: Document some SteamClient interfaces - part 2

* new: Document some SteamClient interfaces - part 3

* new: Document some SteamClient interfaces - part 4

* new: Document some SteamClient interfaces - part 5

* new: Document some SteamClient interfaces - part 6

* new: Document some SteamClient interfaces - part 7

* change: Update interfaces to Steam Version 1691097434

Steam Version:  1691097434
Steam Client Build Date:  Fri, Aug 4 04:54 UTC -08:00

* new: Document some SteamClient interfaces - part 8

* new: Document some SteamClient interfaces - part 9

* change: Update interfaces to Steam Version 1694466342

Steam Version:  1694466342
Steam Client Build Date:  Tue, Sep 12 04:59 UTC +08:00

* new: Document some SteamClient interfaces - part 10

* new: Document some SteamClient interfaces - part 11

* new: Document some SteamClient interfaces - part 12

* new: Document some SteamClient interfaces - part 13

* new: Document some SteamClient interfaces - part 14

* change: Update interfaces to Steam Version 1698260427

Steam Version:  1698260427
Steam Client Build Date:  Thu, Oct 26 2:40 AM UTC -08:00

* new: Document some SteamClient interfaces - part 10

* change: Update interfaces to Steam Version 1700160213

Steam Version:  1700160213
Steam Client Build Date:  Fri, Nov 17 2:23 AM UTC +08:00

* docs(SteamClient): document some interfaces

* change: Fix formatting style

* docs(SteamClient): document protobufs & System.Report

* docs(SteamClient): document CMsgMonitorInfo

* docs(SteamClient): document remaining messages

* docs(SteamClient): update interfaces to Steam Version 1702515219
Steam Version:  1702515219
Steam Client Build Date:  Thu, Dec 14 00:36 UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1704329464
Steam Version:  1704329464
Steam Client Build Date:  Thu, Jan 4 12:23 AM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1705630720
Steam Version:  1705630720
Steam Client Build Date:  Fri, Jan 19 1:58 AM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1706914901
Steam Version:  1706914901
Steam Client Build Date:  Fri, Feb 2 8:46 PM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1709920887
Steam Version:  1709920887
Steam Client Build Date:  Thu, Mar 7 5:29 PM UTC -08:00

* docs(SteamClient): update interfaces to Steam Version 1710786209
Steam Version:  1710786209
Steam Client Build Date:  Mon, Mar 18 7:07 PM UTC -08:00

* docs(SteamClient): document even more interfaces

* new: Document some SteamClient interfaces - part 15

* Fix QAM button bit number

* new: Document some SteamClient interfaces - part 16

* change: Update interfaces to Steam Version 1714854927

Steam Version: 1714854927
Steam Client Build Date:  Sat, May 4 7:11 AM UTC -08:00

* change: Refactor and reorganize SteamClient

* docs(SteamClient): document more notification interfaces

* docs(SteamClient): document more interfaces

* docs(SteamClient): add some descriptions

* docs(SteamClient): remove duplicate types

* change: Fix rebase errors

* Updated ControllerStateChange

* Fix typo

* docs(SteamClient): update interfaces to Steam Version 1723601482

Steam Version:  1723601482
Steam Client Build Date:  Wed, Aug 14 01:51 UTC -08:00

* docs(SteamClient): update interfaces to 1725654351

* docs(SteamClient): update interfaces to 1730416762

* docs(SteamClient): forgot some stuff

* docs(SteamClient): add missed interfaces

* docs(SteamClient): update enums

* docs(SteamClient): add some things and move stuff around

* docs(SteamClient): move shared enums/interfaces to a separate file

* docs(SteamClient): add more stuff

* docs(SteamClient): reword some things

* docs(SteamClient): new BrowserView things

* docs(SteamClient): review fixes

* move to src/globals

---------

Co-authored-by: ricewind012 <58827198+ricewind012@users.noreply.github.com>
Co-authored-by: Party Wumpus <48649272+PartyWumpus@users.noreply.github.com>
Co-authored-by: Xander <xander@isxander.dev>
2025-04-23 11:20:48 -04:00

236 lines
5.7 KiB
TypeScript

import { EUIComposition } from "./shared";
/**
* Represents functionality for managing Steam's windows.
*
* "Restore details" here refers to a string that is similiar to
* `1&x=604&y=257&w=1010&h=600`, which is usable with certain
* `window.open()` parameters and methods from here.
*
* Note that methods here have to be called from the
* window you want to use (not SharedJSContext).
*/
export interface Window {
BringToFront(forceOS?: EWindowBringToFront): void;
/**
* Closes the window.
*/
Close(): void;
/**
* @returns the window's fullscreen state.
*/
DefaultMonitorHasFullscreenWindow(): Promise<boolean>;
/**
* Flashes the window in the taskbar.
*/
FlashWindow(): void;
GetDefaultMonitorDimensions(): Promise<MonitorDimensions>;
/**
* @returns the mouse position's restore details.
*/
GetMousePositionDetails(): Promise<string>;
/**
* @returns the window's details.
*/
GetWindowDetails(): Promise<WindowDetails>;
/**
* @returns the window's dimensions.
*/
GetWindowDimensions(): Promise<WindowDimensions>;
/**
* @returns the window's restore details.
*/
GetWindowRestoreDetails(): Promise<string>;
/**
* Hides the window.
*/
HideWindow(): void;
/**
* @returns the window's maximized state.
*/
IsWindowMaximized(): Promise<boolean>;
/**
* @returns the window's minimized state.
*/
IsWindowMinimized(): Promise<boolean>;
MarkLastFocused(): void;
/**
* Minimizes the window.
*/
Minimize(): void;
/**
* Moves the window to given coordinates.
* @param x Window X position.
* @param y Window Y position.
* @param dpi Screen DPI.
*/
MoveTo(x: number, y: number, dpi?: number): void;
/**
* Moves the window to a given location.
* @param location Window location.
* @param offset X/Y offset.
*/
MoveToLocation(location: WindowLocation_t, offset?: number): void;
/**
* Moves the window relatively to given details.
* @param details Window restore details string from {@link GetWindowRestoreDetails}.
* @param x Window X position.
* @param y Window Y position.
* @param width Window width.
* @param height Window height.
*
* @example
* Move the window to bottom right by 50 pixels:
* ```
* SteamClient.Window.GetWindowRestoreDetails((e) => {
* SteamClient.Window.PositionWindowRelative(e, 50, 50, 0, 0);
* });
* ```
*/
PositionWindowRelative(details: string, x: number, y: number, width: number, height: number): void;
/**
* @returns `true` if yje naun [tpcess od about to shut down.]
*/
ProcessShuttingDown(): Promise<boolean>;
/**
* Resizes the window to given dimension.
* The window has to be created with the resizable flag.
* @param width Window width.
* @param height Window height.
* @param applyBrowserScaleOrDPIValue
*/
ResizeTo(width: number, height: number, applyBrowserScaleOrDPIValue: boolean | number): void;
/**
* Moves the window to given details.
* @param details Window details string from `Window.GetWindowRestoreDetails`.
*/
RestoreWindowSizeAndPosition(details: string): void;
SetAutoDisplayScale(value: boolean): void;
SetComposition(mode: EUIComposition, appIdCompositionQueue: number[], windowId: number): void;
/**
* Makes the window hide, but not close on pressing the close button.
* @param value Hide on close?
*/
SetHideOnClose(value: boolean): void;
SetKeyFocus(value: boolean): void;
SetManualDisplayScaleFactor(displayScaleFactor: number): void;
/**
* Sets the window's max size.
* @param width Window's max width.
* @param height Window's max height.
*/
SetMaxSize(width: number, height: number): void;
/**
* Sets the window's min size.
* @param width Window's max width.
* @param height Window's max height.
*/
SetMinSize(width: number, height: number): void;
SetModal(value: boolean): void;
/**
* Sets the window's resize grip size.
* The window has to be created with the resizable flag for this to take any effect.
* @param width Resize grip width.
* @param height Resize grip height.
*/
SetResizeGrip(width: number, height: number): void;
/**
* Set the window's icon.
* @param icon The window icon to be used.
*/
SetWindowIcon(icon: WindowIcon_t): void;
/**
* Shows the window.
*/
ShowWindow(): void;
/**
* Stops the window's taskbar flashing.
*/
StopFlashWindow(): void;
/**
* Toggles the window's fullscreen state.
*/
ToggleFullscreen(): void;
/**
* Toggles the window's maximized state.
*/
ToggleMaximize(): void;
}
export enum EWindowBringToFront {
Invalid,
AndForceOS,
WithoutForcingOS,
}
export type WindowLocation_t =
| 'upper-left'
| 'lower-left'
| 'center-top'
| 'center-bottom'
| 'upper-right'
| 'lower-right';
export type WindowIcon_t = 'steam' | 'messages' | 'voice';
/**
* "Usable" here refers to space that is not taken by the taskbar.
*/
export interface MonitorDimensions {
flHorizontalScale: number;
flVerticalScale: number;
nFullHeight: number;
nFullLeft: number;
nFullTop: number;
nFullWidth: number;
nUsableHeight: number;
nUsableLeft: number;
nUsableTop: number;
nUsableWidth: number;
}
export interface WindowDetails {
bGPUEnabled: boolean;
bUnderlaySupported: boolean;
}
export interface WindowDimensions {
x: number;
y: number;
width: number;
height: number;
}