types.ts 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  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. export type FrameLimiter = 'budget' | 'fixed'
  156. /** auto = while the default output is headphones */
  157. export type HrtfMode = 'auto' | 'on' | 'off'
  158. /** FPS limit on battery, off = same as plugged in */
  159. export type BatteryFps = 'off' | 'pause' | '10' | '15' | '20' | '30'
  160. /** Minutes without input before wallpapers pause */
  161. export type IdlePause = 'off' | '1' | '5' | '10' | '15' | '30'
  162. export interface EngineFlags {
  163. disableParticles?: boolean
  164. disableMouse?: boolean
  165. disableAnimations?: boolean
  166. noAudioProcessing?: boolean
  167. fullscreenPause?: FullscreenPauseMode
  168. /** --pause-on-focus, WE's "Other application focused: Pause" */
  169. pauseOnFocus?: boolean
  170. /** --pause-on-maximized, wlroots only (KDE and GNOME always pause) */
  171. pauseOnMaximized?: boolean
  172. automute?: boolean
  173. silent?: boolean
  174. hdr?: boolean
  175. postProcessing?: PostProcessingQuality
  176. volumetrics?: LightingQuality
  177. shadows?: LightingQuality
  178. msaa?: MsaaQuality
  179. ssaa?: SsaaQuality
  180. hwdec?: HwdecBackend
  181. /** --web-frames, applies when the web wallpaper starts */
  182. webFrames?: WebFramesMode
  183. frameLimiter?: FrameLimiter
  184. hrtf?: HrtfMode
  185. /** --fps-battery / --pause-on-battery */
  186. batteryFps?: BatteryFps
  187. /** --idle-pause */
  188. idlePause?: IdlePause
  189. /** --window sized like the first screen instead of --screen-root, global only */
  190. windowed?: boolean
  191. /** --window --window-background: that window acts as the desktop background, global only */
  192. windowBackground?: boolean
  193. /** --layer background; key kept for stored configs */
  194. kdeBackgroundLayer?: boolean
  195. }
  196. export interface EngineFlagPreset {
  197. id: string
  198. name: string
  199. flags: EngineFlags
  200. /** undefined leaves the FPS alone */
  201. fps?: number | null
  202. builtIn?: boolean
  203. }
  204. export type CrashPhase = 'launch' | 'hotswap' | 'runtime'
  205. export interface WallpaperCrash {
  206. at: number
  207. phase: CrashPhase
  208. screen: string
  209. log: string[]
  210. }
  211. export interface WallpaperCompat {
  212. hotswapCrash?: boolean
  213. freshLaunch?: 'ok' | 'crash'
  214. runtimeCrashes?: number
  215. lastCrash?: WallpaperCrash
  216. note?: string
  217. }
  218. export type CompatStatus = 'ok' | 'crashes' | 'hotswap-only' | 'hotswap-untested' | 'unstable'
  219. export interface CrashEvent {
  220. wallpaperId: string
  221. title: string
  222. screen: string
  223. phase: CrashPhase
  224. outcome: string
  225. }
  226. /** '*' = one engine for every screen */
  227. export type ScreenTarget = string
  228. export type DisplayMode = 'shared' | 'per-screen'
  229. export interface ScreenAssignment {
  230. screen: ScreenTarget
  231. wallpaperId: string
  232. }
  233. /** How the slots of a split screen share it, see the engine's --split-layout */
  234. export type SplitLayout = 'aspect' | 'equal' | 'center'
  235. export interface SplitSlot {
  236. wallpaperId: string
  237. /** this slot's --scaling, the wallpaper's own when unset */
  238. scalingMode?: ScalingMode
  239. }
  240. /** --screen-slot, per-screen display mode only */
  241. export interface SplitScreen {
  242. layout: SplitLayout
  243. slots: SplitSlot[]
  244. }
  245. export type ScheduleAction =
  246. | { type: 'wallpaper'; wallpaperId: string }
  247. | { type: 'playlist'; playlistId: string }
  248. | { type: 'stop' }
  249. export type ScheduleTrigger =
  250. | { type: 'time'; time: string; days: number[] }
  251. | { type: 'theme'; theme: 'dark' | 'light' }
  252. export interface ScheduleRule {
  253. id: string
  254. name: string
  255. enabled: boolean
  256. trigger: ScheduleTrigger
  257. action: ScheduleAction
  258. screen: ScreenTarget
  259. }
  260. export interface LweSceneObject {
  261. id: string
  262. name: string
  263. type: 'image' | 'particle' | 'text' | 'sound' | 'unknown'
  264. }
  265. /** From --list-effects */
  266. export interface LweSceneEffect {
  267. id: string
  268. /** Not unique across objects */
  269. name: string
  270. objectId: string
  271. objectName: string
  272. /** e.g. "Blur/Sharpen", may be empty */
  273. group: string
  274. }
  275. /** From --list-audio-objects */
  276. export interface LweAudioObject {
  277. objectId: string
  278. objectName: string
  279. /** e.g. "scale" or "alpha" */
  280. property: string
  281. minvalue: number
  282. maxvalue: number
  283. frequency: number
  284. smoothing: number
  285. }
  286. export interface LweProperty {
  287. name: string
  288. type:
  289. | 'slider'
  290. | 'boolean'
  291. | 'color'
  292. | 'combo'
  293. | 'text'
  294. | 'scene-texture'
  295. | 'file'
  296. | 'textinput'
  297. | 'usershortcut'
  298. | 'unknown'
  299. text?: string
  300. value: string
  301. min?: number
  302. max?: number
  303. step?: number
  304. options?: { value: string; label: string }[]
  305. }
  306. export interface DesktopApplication {
  307. name: string
  308. file: string
  309. }
  310. export interface WorkshopAuthorInfo {
  311. steamId: string
  312. name: string
  313. avatarUrl: string
  314. }
  315. export interface WorkshopItem {
  316. publishedFileId: string
  317. title: string
  318. description: string
  319. previewUrl: string
  320. creatorSteamId: string
  321. tags: string[]
  322. timeCreated: number
  323. timeUpdated: number
  324. subscriptions: number
  325. upvotes: number
  326. downvotes: number
  327. isSubscribed: boolean
  328. /** Bytes, as on the item's Steam page */
  329. fileSize?: number
  330. }
  331. export interface WorkshopQueryParams {
  332. appId?: number
  333. searchText?: string
  334. tags?: string[]
  335. excludedTags?: string[]
  336. queryType?: WorkshopQueryType
  337. page?: number
  338. }
  339. export interface WorkshopQueryResult {
  340. items: WorkshopItem[]
  341. page: number
  342. totalResults: number
  343. }
  344. export interface CreatorWorkshopQueryParams {
  345. searchText?: string
  346. tags?: string[]
  347. excludedTags?: string[]
  348. queryType?: WorkshopQueryType
  349. page?: number
  350. }
  351. export interface ApplyWallpaperOptions {
  352. wallpaperId: string
  353. screen?: ScreenTarget
  354. backend?: WallpaperBackend
  355. }
  356. // write failed, or Steam's favorites list never showed it
  357. export interface FavoriteFailure {
  358. add: boolean
  359. message: string
  360. readBack: boolean
  361. }
  362. export interface FavoriteStatus {
  363. failed: Record<string, FavoriteFailure>
  364. // written, not yet in the favorites list
  365. checking: string[]
  366. }
  367. export interface DownloadProgressEvent {
  368. itemId: string
  369. bytesDownloaded: number
  370. bytesTotal: number
  371. percentage: number
  372. status: 'downloading' | 'completed' | 'error'
  373. }
  374. export interface LibraryFilters {
  375. tags?: string[]
  376. categories?: string[]
  377. type?: WallpaperType
  378. contentRating?: ContentRating
  379. searchText?: string
  380. sortBy?: 'title' | 'createdAt' | 'updatedAt' | 'lastApplied' | 'appliedCount' | 'fileSize'
  381. sortDir?: 'asc' | 'desc'
  382. }
  383. export interface WallpaperFolder {
  384. id: string
  385. title: string
  386. items: string[]
  387. }
  388. export interface WallpaperEnvironment {
  389. displayServer: 'wayland' | 'x11' | 'unknown'
  390. desktopEnv: DesktopEnvironment
  391. availableBackends: WallpaperBackend[]
  392. recommendedBackend: WallpaperBackend
  393. linuxWallpaperEngine: LweStatus
  394. }
  395. /** The engine's GNOME Shell extension (GNOME Wayland only) */
  396. export interface GnomeExtensionStatus {
  397. needed: boolean
  398. state: 'not-needed' | 'active' | 'outdated' | 'needs-relogin' | 'disabled' | 'not-installed' | 'error'
  399. bundled?: boolean
  400. bundledVersion?: string
  401. installedVersion?: string
  402. detail?: string
  403. /** Flatpak: manual host commands if the button fails */
  404. flatpakCommands?: string[]
  405. }
  406. export interface LweStatus {
  407. installed: boolean
  408. path?: string
  409. version?: string
  410. /** A package manager owns the binary, it can't be uninstalled here */
  411. managedBy?: string
  412. }
  413. export interface DesktopIconsStatus {
  414. enabled: boolean
  415. problem?: 'not-kde' | 'not-wayland' | 'missing-lib' | 'missing-modules' | 'failed'
  416. detail?: string
  417. command?: string
  418. }
  419. export type LinuxDistro = 'fedora' | 'arch' | 'debian' | 'suse' | 'unknown'
  420. /** Which prebuilt release archive fits this machine, or why none does */
  421. export interface LwePrebuiltTarget {
  422. supported: boolean
  423. /** Release asset name */
  424. asset?: string
  425. label?: string
  426. reason?: string
  427. /** The engine comes with the app (Flatpak) */
  428. managed?: boolean
  429. }
  430. export interface LweInstallProgress {
  431. stage: 'installing-deps' | 'downloading' | 'cloning' | 'building' | 'installing' | 'done' | 'error'
  432. message: string
  433. percentage: number
  434. }
  435. export interface UpdateChecks {
  436. app: boolean
  437. engine: boolean
  438. }
  439. export type UpdateTarget = keyof UpdateChecks
  440. export type AppInstallKind = 'appimage' | 'deb' | 'flatpak' | 'pacman' | 'rpm' | 'source' | 'unknown'
  441. /** package: package manager or Nix, build: source or unknown, bundled: the Flatpak's */
  442. export type EngineInstallKind = 'prebuilt' | 'package' | 'build' | 'bundled'
  443. export interface AvailableUpdate {
  444. version: string
  445. /** null when unknown */
  446. current: string | null
  447. notes: string
  448. url: string
  449. publishedAt: string
  450. }
  451. export interface AppUpdateProgress {
  452. stage: 'downloading' | 'installing' | 'ready' | 'error'
  453. percentage: number
  454. message?: string
  455. }
  456. export interface UpdateStatus {
  457. checks: UpdateChecks | null
  458. checking: boolean
  459. checkedAt: number | null
  460. error: string | null
  461. appVersion: string
  462. appInstall: AppInstallKind
  463. app: AvailableUpdate | null
  464. appProgress: AppUpdateProgress | null
  465. engineInstall: EngineInstallKind | null
  466. engineManagedBy?: string
  467. engine: AvailableUpdate | null
  468. dismissed: Partial<Record<UpdateTarget, string>>
  469. }
  470. export interface BackupProgressEvent {
  471. itemId: string
  472. bytesCopied: number
  473. bytesTotal: number
  474. percentage: number
  475. status: 'copying' | 'verifying' | 'completed' | 'error'
  476. message?: string
  477. /** Plain backup when unset */
  478. action?: 'backup' | 'copy' | 'move'
  479. }
  480. export interface PlaylistItem {
  481. wallpaperId: string
  482. /** 0-100, overrides the playlist's defaultVolume when set */
  483. volume?: number
  484. /** Overrides the playlist's defaultDurationSec when set */
  485. durationSec?: number
  486. }
  487. export interface PlaylistSettings {
  488. /** Reshuffled on every loop */
  489. randomize: boolean
  490. /** Used when randomize is off */
  491. sortBy: 'manual' | 'title' | 'createdAt'
  492. /** Seconds per wallpaper */
  493. defaultDurationSec: number
  494. /** Longer videos play to the end before advancing */
  495. finishVideos?: boolean
  496. /** Only Steam favorites, everything when none is */
  497. favoritesOnly?: boolean
  498. /** 0-100 */
  499. defaultVolume: number
  500. }
  501. export interface Playlist {
  502. id: string
  503. title: string
  504. items: PlaylistItem[]
  505. settings: PlaylistSettings
  506. createdAt: number
  507. updatedAt: number
  508. }
  509. export interface PlaylistPlaybackState {
  510. screen: ScreenTarget
  511. playlistId: string | null
  512. currentItemId: string | null
  513. currentIndex: number
  514. isPlaying: boolean
  515. order: string[]
  516. }
  517. /** Why wallpapers would be drawn on the CPU, shown as a notice */
  518. export interface GraphicsWarning {
  519. kind: 'software' | 'flatpak-nvidia'
  520. /** the renderer the engine reported */
  521. renderer?: string
  522. /** flatpak-nvidia: the NVIDIA GL extension for the host's driver, when the version could be read */
  523. extension?: string
  524. }