types.ts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. import type { ImageAdjustments } from './imageAdjustments'
  2. import type { VideoSegment } from './videoTrim'
  3. import type { DesktopEnvironment } from './desktop'
  4. export type { ImageAdjustments } from './imageAdjustments'
  5. export type WallpaperType = 'scene' | 'video' | 'web' | 'application'
  6. export type XrayMode = 'normal' | 'full' | 'disabled'
  7. /** Matches linux-wallpaperengine's --scaling choices */
  8. export type ScalingMode = 'default' | 'stretch' | 'fit' | 'fill' | 'center'
  9. export type WallpaperBackend =
  10. | 'swww'
  11. | 'hyprpaper'
  12. | 'swaybg'
  13. | 'feh'
  14. | 'xwallpaper'
  15. | 'gsettings'
  16. | 'qdbus'
  17. | 'windows'
  18. | 'macos'
  19. | 'auto'
  20. export type WorkshopQueryType =
  21. | 'RankedByVote'
  22. | 'RankedByPublicationDate'
  23. | 'RankedByTrend'
  24. | 'RankedByTotalUniqueSubscriptions'
  25. | 'RankedByTextSearch'
  26. | 'RankedByLastUpdatedDate'
  27. export type ContentRating = 'everyone' | 'questionable' | 'mature' | 'uncategorized'
  28. /** See getSteamIdentity() */
  29. export type SteamIdentity = 'wallpaper-engine' | 'standalone'
  30. export interface ExtraLibrary {
  31. path: string
  32. name: string
  33. }
  34. export type VerifyProblem =
  35. | 'notInstalled'
  36. | 'needsUpdate'
  37. | 'missingFolder'
  38. | 'brokenProject'
  39. | 'missingMainFile'
  40. | 'missingData'
  41. | 'missingDependency'
  42. export interface VerifyProgressEvent {
  43. done: number
  44. total: number
  45. }
  46. export interface VerifyResult {
  47. checked: number
  48. skipped: number
  49. damaged: string[]
  50. }
  51. export interface RepairResult {
  52. /** rechecked in the background once finished */
  53. started: number
  54. failed: number
  55. }
  56. export interface WallpaperMeta {
  57. id: string
  58. title: string
  59. description?: string
  60. type: WallpaperType
  61. contentRating?: ContentRating
  62. previewUrl?: string
  63. previewLocal?: string
  64. localPath?: string
  65. file?: string
  66. fileSize?: number
  67. createdAt: number
  68. updatedAt: number
  69. subscribed: boolean
  70. appliedCount: number
  71. lastAppliedAt?: number
  72. authorSteamId?: string
  73. authorName?: string
  74. source: 'workshop' | 'local' | 'backup'
  75. tags: string[]
  76. /** Workshop resolution tags, e.g. "Ultrawide 3440 x 1440" */
  77. resolutions?: string[]
  78. categories: string[]
  79. downloading?: boolean
  80. downloadFailed?: boolean
  81. fpsOverride?: number
  82. volumeOverride?: number
  83. /** xray reveal covers the whole mask instead of following the mouse */
  84. xrayFullReveal?: boolean
  85. xrayDisabled?: boolean
  86. /** --scaling */
  87. scalingMode?: ScalingMode
  88. /** --zoom on top of scalingMode, 1 = none */
  89. zoom?: number
  90. /** --offset, each axis in [-1, 1] */
  91. offsetX?: number
  92. offsetY?: number
  93. /** --disable-parallax */
  94. disableParallax?: boolean
  95. /** --expand-canvas: shows layers that stick out past the camera */
  96. expandCanvas?: boolean
  97. /** --repair-assets: loads what broken wallpapers meant, e.g. a texture named "" */
  98. repairAssets?: boolean
  99. /** --corner-color, "RRGGBB"/"RRGGBBAA" outside the wallpaper's bounds */
  100. cornerColor?: string
  101. /** WE's image filter, color options and flip (scene and video) */
  102. imageAdjustments?: ImageAdjustments
  103. /** --speed, 1 = normal */
  104. playbackSpeed?: number
  105. /** --video-segments parts, empty plays the whole video */
  106. videoSegments?: VideoSegment[]
  107. /** Old single loop range, read through videoSegmentsOf */
  108. videoStart?: number
  109. videoEnd?: number
  110. backedUp?: boolean
  111. backupDir?: string
  112. /** The workshop copy no longer matches the backup */
  113. backupOutdated?: boolean
  114. /** Removed from the Workshop, set by the unavailable check */
  115. unavailable?: boolean
  116. /** Set by "Verify files", cleared once it checks out */
  117. verifyProblem?: VerifyProblem
  118. /** --disable-object ids or names */
  119. disabledObjects?: string[]
  120. /** --enable-object ids or names */
  121. enabledObjects?: string[]
  122. /** --disable-effect ids or names */
  123. disabledEffects?: string[]
  124. /** --enable-effect ids or names */
  125. enabledEffects?: string[]
  126. /** --set-property name=value */
  127. propertyOverrides?: Record<string, string>
  128. /** --audio-sensitivity id=multiplier, 0 = no pulse, 1 = as authored */
  129. audioSensitivity?: Record<string, number>
  130. /** Sound object id -> volume (0-1), independent of the global volume */
  131. soundVolume?: Record<string, number>
  132. /** Extra launch arguments, changing them always restarts the engine */
  133. customArgs?: string
  134. /** Unset flags fall back to the global setting */
  135. engineFlags?: EngineFlags
  136. compat?: WallpaperCompat
  137. /** Scene with general.hdr on, or a PQ/HLG video. Unset until detected */
  138. hdr?: boolean
  139. /** Scene with a spatialized sound object. Unset until detected */
  140. hrtf?: boolean
  141. customPreview?: string
  142. useOriginalPreview?: boolean
  143. }
  144. export type FullscreenPauseMode = 'default' | 'off' | 'active-only'
  145. /** "ultra" turns on HDR for scenes that ask for it */
  146. export type PostProcessingQuality = 'enabled' | 'ultra'
  147. export type LightingQuality = 'disabled' | 'low' | 'medium' | 'high' | 'ultra'
  148. /** Only scenes with 3D models use it */
  149. export type MsaaQuality = 'none' | 'x2' | 'x4' | 'x8'
  150. /** Per axis */
  151. export type SsaaQuality = 'none' | 'x2' | 'x3' | 'x4'
  152. export type HwdecBackend = 'auto' | 'no' | 'vaapi' | 'vaapi-copy' | 'nvdec' | 'nvdec-copy' | 'vulkan'
  153. /** How web wallpapers hand their frames to the engine: shared GPU buffers or a copy through memory */
  154. export type WebFramesMode = 'auto' | 'shm' | 'dmabuf'
  155. /** auto = while the default output is headphones */
  156. export type HrtfMode = 'auto' | 'on' | 'off'
  157. /** FPS limit on battery, off = same as plugged in */
  158. export type BatteryFps = 'off' | 'pause' | '10' | '15' | '20' | '30'
  159. /** Minutes without input before wallpapers pause */
  160. export type IdlePause = 'off' | '1' | '5' | '10' | '15' | '30'
  161. export interface EngineFlags {
  162. disableParticles?: boolean
  163. disableMouse?: boolean
  164. disableAnimations?: boolean
  165. noAudioProcessing?: boolean
  166. fullscreenPause?: FullscreenPauseMode
  167. /** --pause-on-focus, WE's "Other application focused: Pause" */
  168. pauseOnFocus?: boolean
  169. /** --pause-on-maximized, wlroots only (KDE and GNOME always pause) */
  170. pauseOnMaximized?: boolean
  171. automute?: boolean
  172. silent?: boolean
  173. hdr?: boolean
  174. postProcessing?: PostProcessingQuality
  175. volumetrics?: LightingQuality
  176. shadows?: LightingQuality
  177. msaa?: MsaaQuality
  178. ssaa?: SsaaQuality
  179. hwdec?: HwdecBackend
  180. /** --web-frames, applies when the web wallpaper starts */
  181. webFrames?: WebFramesMode
  182. hrtf?: HrtfMode
  183. /** --fps-battery / --pause-on-battery */
  184. batteryFps?: BatteryFps
  185. /** --idle-pause */
  186. idlePause?: IdlePause
  187. /** --window sized like the first screen instead of --screen-root, global only */
  188. windowed?: boolean
  189. /** --window --window-background: that window acts as the desktop background, global only */
  190. windowBackground?: boolean
  191. /** --layer background; key kept for stored configs */
  192. kdeBackgroundLayer?: boolean
  193. }
  194. export interface EngineFlagPreset {
  195. id: string
  196. name: string
  197. flags: EngineFlags
  198. /** undefined leaves the FPS alone */
  199. fps?: number | null
  200. builtIn?: boolean
  201. }
  202. export type CrashPhase = 'launch' | 'hotswap' | 'runtime'
  203. export interface WallpaperCrash {
  204. at: number
  205. phase: CrashPhase
  206. screen: string
  207. log: string[]
  208. }
  209. export interface WallpaperCompat {
  210. hotswapCrash?: boolean
  211. freshLaunch?: 'ok' | 'crash'
  212. runtimeCrashes?: number
  213. lastCrash?: WallpaperCrash
  214. note?: string
  215. }
  216. export type CompatStatus = 'ok' | 'crashes' | 'hotswap-only' | 'hotswap-untested' | 'unstable'
  217. export interface CrashEvent {
  218. wallpaperId: string
  219. title: string
  220. screen: string
  221. phase: CrashPhase
  222. outcome: string
  223. }
  224. /** '*' = one engine for every screen */
  225. export type ScreenTarget = string
  226. export type DisplayMode = 'shared' | 'per-screen'
  227. export interface ScreenAssignment {
  228. screen: ScreenTarget
  229. wallpaperId: string
  230. }
  231. /** How the slots of a split screen share it, see the engine's --split-layout */
  232. export type SplitLayout = 'aspect' | 'equal' | 'center'
  233. export interface SplitSlot {
  234. wallpaperId: string
  235. /** this slot's --scaling, the wallpaper's own when unset */
  236. scalingMode?: ScalingMode
  237. }
  238. /** --screen-slot, per-screen display mode only */
  239. export interface SplitScreen {
  240. layout: SplitLayout
  241. slots: SplitSlot[]
  242. }
  243. export type ScheduleAction =
  244. | { type: 'wallpaper'; wallpaperId: string }
  245. | { type: 'playlist'; playlistId: string }
  246. | { type: 'stop' }
  247. export type ScheduleTrigger =
  248. | { type: 'time'; time: string; days: number[] }
  249. | { type: 'theme'; theme: 'dark' | 'light' }
  250. export interface ScheduleRule {
  251. id: string
  252. name: string
  253. enabled: boolean
  254. trigger: ScheduleTrigger
  255. action: ScheduleAction
  256. screen: ScreenTarget
  257. }
  258. export interface LweSceneObject {
  259. id: string
  260. name: string
  261. type: 'image' | 'particle' | 'text' | 'sound' | 'unknown'
  262. }
  263. /** From --list-effects */
  264. export interface LweSceneEffect {
  265. id: string
  266. /** Not unique across objects */
  267. name: string
  268. objectId: string
  269. objectName: string
  270. /** e.g. "Blur/Sharpen", may be empty */
  271. group: string
  272. }
  273. /** From --list-audio-objects */
  274. export interface LweAudioObject {
  275. objectId: string
  276. objectName: string
  277. /** e.g. "scale" or "alpha" */
  278. property: string
  279. minvalue: number
  280. maxvalue: number
  281. frequency: number
  282. smoothing: number
  283. }
  284. export interface LweProperty {
  285. name: string
  286. type:
  287. | 'slider'
  288. | 'boolean'
  289. | 'color'
  290. | 'combo'
  291. | 'text'
  292. | 'scene-texture'
  293. | 'file'
  294. | 'textinput'
  295. | 'usershortcut'
  296. | 'unknown'
  297. text?: string
  298. value: string
  299. min?: number
  300. max?: number
  301. step?: number
  302. options?: { value: string; label: string }[]
  303. }
  304. export interface DesktopApplication {
  305. name: string
  306. file: string
  307. }
  308. export interface WorkshopAuthorInfo {
  309. steamId: string
  310. name: string
  311. avatarUrl: string
  312. }
  313. export interface WorkshopItem {
  314. publishedFileId: string
  315. title: string
  316. description: string
  317. previewUrl: string
  318. creatorSteamId: string
  319. tags: string[]
  320. timeCreated: number
  321. timeUpdated: number
  322. subscriptions: number
  323. upvotes: number
  324. downvotes: number
  325. isSubscribed: boolean
  326. /** Bytes, as on the item's Steam page */
  327. fileSize?: number
  328. }
  329. export interface WorkshopQueryParams {
  330. appId?: number
  331. searchText?: string
  332. tags?: string[]
  333. excludedTags?: string[]
  334. queryType?: WorkshopQueryType
  335. page?: number
  336. }
  337. export interface WorkshopQueryResult {
  338. items: WorkshopItem[]
  339. page: number
  340. totalResults: number
  341. }
  342. export interface CreatorWorkshopQueryParams {
  343. searchText?: string
  344. tags?: string[]
  345. excludedTags?: string[]
  346. queryType?: WorkshopQueryType
  347. page?: number
  348. }
  349. export interface ApplyWallpaperOptions {
  350. wallpaperId: string
  351. screen?: ScreenTarget
  352. backend?: WallpaperBackend
  353. }
  354. // write failed, or Steam's favorites list never showed it
  355. export interface FavoriteFailure {
  356. add: boolean
  357. message: string
  358. readBack: boolean
  359. }
  360. export interface FavoriteStatus {
  361. failed: Record<string, FavoriteFailure>
  362. // written, not yet in the favorites list
  363. checking: string[]
  364. }
  365. export interface DownloadProgressEvent {
  366. itemId: string
  367. bytesDownloaded: number
  368. bytesTotal: number
  369. percentage: number
  370. status: 'downloading' | 'completed' | 'error'
  371. }
  372. export interface LibraryFilters {
  373. tags?: string[]
  374. categories?: string[]
  375. type?: WallpaperType
  376. contentRating?: ContentRating
  377. searchText?: string
  378. sortBy?: 'title' | 'createdAt' | 'updatedAt' | 'lastApplied' | 'appliedCount' | 'fileSize'
  379. sortDir?: 'asc' | 'desc'
  380. }
  381. export interface WallpaperFolder {
  382. id: string
  383. title: string
  384. items: string[]
  385. }
  386. export interface WallpaperEnvironment {
  387. displayServer: 'wayland' | 'x11' | 'unknown'
  388. desktopEnv: DesktopEnvironment
  389. availableBackends: WallpaperBackend[]
  390. recommendedBackend: WallpaperBackend
  391. linuxWallpaperEngine: LweStatus
  392. }
  393. /** The engine's GNOME Shell extension (GNOME Wayland only) */
  394. export interface GnomeExtensionStatus {
  395. needed: boolean
  396. state: 'not-needed' | 'active' | 'outdated' | 'needs-relogin' | 'disabled' | 'not-installed' | 'error'
  397. bundled?: boolean
  398. bundledVersion?: string
  399. installedVersion?: string
  400. detail?: string
  401. /** Flatpak: manual host commands if the button fails */
  402. flatpakCommands?: string[]
  403. }
  404. export interface LweStatus {
  405. installed: boolean
  406. path?: string
  407. version?: string
  408. /** A package manager owns the binary, it can't be uninstalled here */
  409. managedBy?: string
  410. }
  411. export type LinuxDistro = 'fedora' | 'arch' | 'debian' | 'suse' | 'unknown'
  412. /** Which prebuilt release archive fits this machine, or why none does */
  413. export interface LwePrebuiltTarget {
  414. supported: boolean
  415. /** Release asset name */
  416. asset?: string
  417. label?: string
  418. reason?: string
  419. /** The engine comes with the app (Flatpak) */
  420. managed?: boolean
  421. }
  422. export interface LweInstallProgress {
  423. stage: 'installing-deps' | 'downloading' | 'cloning' | 'building' | 'installing' | 'done' | 'error'
  424. message: string
  425. percentage: number
  426. }
  427. export interface UpdateChecks {
  428. app: boolean
  429. engine: boolean
  430. }
  431. export type UpdateTarget = keyof UpdateChecks
  432. export type AppInstallKind = 'appimage' | 'deb' | 'flatpak' | 'pacman' | 'rpm' | 'source' | 'unknown'
  433. /** package: package manager or Nix, build: source or unknown, bundled: the Flatpak's */
  434. export type EngineInstallKind = 'prebuilt' | 'package' | 'build' | 'bundled'
  435. export interface AvailableUpdate {
  436. version: string
  437. /** null when unknown */
  438. current: string | null
  439. notes: string
  440. url: string
  441. publishedAt: string
  442. }
  443. export interface AppUpdateProgress {
  444. stage: 'downloading' | 'installing' | 'ready' | 'error'
  445. percentage: number
  446. message?: string
  447. }
  448. export interface UpdateStatus {
  449. checks: UpdateChecks | null
  450. checking: boolean
  451. checkedAt: number | null
  452. error: string | null
  453. appVersion: string
  454. appInstall: AppInstallKind
  455. app: AvailableUpdate | null
  456. appProgress: AppUpdateProgress | null
  457. engineInstall: EngineInstallKind | null
  458. engineManagedBy?: string
  459. engine: AvailableUpdate | null
  460. dismissed: Partial<Record<UpdateTarget, string>>
  461. }
  462. export interface BackupProgressEvent {
  463. itemId: string
  464. bytesCopied: number
  465. bytesTotal: number
  466. percentage: number
  467. status: 'copying' | 'verifying' | 'completed' | 'error'
  468. message?: string
  469. /** Plain backup when unset */
  470. action?: 'backup' | 'copy' | 'move'
  471. }
  472. export interface PlaylistItem {
  473. wallpaperId: string
  474. /** 0-100, overrides the playlist's defaultVolume when set */
  475. volume?: number
  476. /** Overrides the playlist's defaultDurationSec when set */
  477. durationSec?: number
  478. }
  479. export interface PlaylistSettings {
  480. /** Reshuffled on every loop */
  481. randomize: boolean
  482. /** Used when randomize is off */
  483. sortBy: 'manual' | 'title' | 'createdAt'
  484. /** Seconds per wallpaper */
  485. defaultDurationSec: number
  486. /** Longer videos play to the end before advancing */
  487. finishVideos?: boolean
  488. /** Only Steam favorites, everything when none is */
  489. favoritesOnly?: boolean
  490. /** 0-100 */
  491. defaultVolume: number
  492. }
  493. export interface Playlist {
  494. id: string
  495. title: string
  496. items: PlaylistItem[]
  497. settings: PlaylistSettings
  498. createdAt: number
  499. updatedAt: number
  500. }
  501. export interface PlaylistPlaybackState {
  502. screen: ScreenTarget
  503. playlistId: string | null
  504. currentItemId: string | null
  505. currentIndex: number
  506. isPlaying: boolean
  507. order: string[]
  508. }
  509. /** Why wallpapers would be drawn on the CPU, shown as a notice */
  510. export interface GraphicsWarning {
  511. kind: 'software' | 'flatpak-nvidia'
  512. /** the renderer the engine reported */
  513. renderer?: string
  514. /** flatpak-nvidia: the NVIDIA GL extension for the host's driver, when the version could be read */
  515. extension?: string
  516. }