types.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434
  1. import type { ImageAdjustments } from './imageAdjustments'
  2. export type { ImageAdjustments } from './imageAdjustments'
  3. export type WallpaperType = 'scene' | 'video' | 'web' | 'application'
  4. /** Matches linux-wallpaperengine's --scaling choices */
  5. export type ScalingMode = 'default' | 'stretch' | 'fit' | 'fill' | 'center'
  6. export type WallpaperBackend =
  7. | 'swww'
  8. | 'swaybg'
  9. | 'feh'
  10. | 'xwallpaper'
  11. | 'gsettings'
  12. | 'qdbus'
  13. | 'windows'
  14. | 'macos'
  15. | 'auto'
  16. export type WorkshopQueryType =
  17. | 'RankedByVote'
  18. | 'RankedByPublicationDate'
  19. | 'RankedByTrend'
  20. | 'RankedByTotalUniqueSubscriptions'
  21. | 'RankedByTextSearch'
  22. | 'RankedByLastUpdatedDate'
  23. export type ContentRating = 'everyone' | 'questionable' | 'mature' | 'uncategorized'
  24. /** How this process identifies itself to Steam - see config.service.ts getSteamIdentity(). */
  25. export type SteamIdentity = 'wallpaper-engine' | 'standalone'
  26. export interface WallpaperMeta {
  27. id: string
  28. title: string
  29. description?: string
  30. type: WallpaperType
  31. contentRating?: ContentRating
  32. previewUrl?: string
  33. previewLocal?: string
  34. localPath?: string
  35. file?: string
  36. fileSize?: number
  37. createdAt: number
  38. updatedAt: number
  39. subscribed: boolean
  40. appliedCount: number
  41. lastAppliedAt?: number
  42. authorSteamId?: string
  43. authorName?: string
  44. source: 'workshop' | 'local' | 'backup'
  45. tags: string[]
  46. /** Steam Workshop resolution tags ("1920 x 1080", "Ultrawide 3440 x 1440", ...), from the live item */
  47. resolutions?: string[]
  48. categories: string[]
  49. downloading?: boolean
  50. downloadFailed?: boolean
  51. fpsOverride?: number
  52. volumeOverride?: number
  53. /** Forces the "xray" scene effect's reveal spot to cover the whole masked area instead of following the mouse */
  54. xrayFullReveal?: boolean
  55. /** How the wallpaper is scaled to fit the screen, applied via linux-wallpaperengine --scaling */
  56. scalingMode?: ScalingMode
  57. /** Manual zoom layered on top of scalingMode via linux-wallpaperengine --zoom (1 = no extra zoom) */
  58. zoom?: number
  59. /** Re-centers the crop window, each axis in [-1, 1] (0 = centered), via linux-wallpaperengine --offset */
  60. offsetX?: number
  61. offsetY?: number
  62. /** Force-disables the scene's mouse parallax effect via linux-wallpaperengine --disable-parallax */
  63. disableParallax?: boolean
  64. /**
  65. * Grows the scene's render canvas so layers that stick out past the camera (a tall picture only
  66. * meant to be revealed by parallax) show in full, via linux-wallpaperengine --expand-canvas
  67. */
  68. expandCanvas?: boolean
  69. /**
  70. * Color shown outside the wallpaper's bounds (Center/Fit letterboxing, zoomed-out scaling) as a
  71. * "RRGGBB"/"RRGGBBAA" hex string, applied via linux-wallpaperengine --corner-color. Default: black.
  72. */
  73. cornerColor?: string
  74. /** Wallpaper Engine's image filter, color options and flip (scene and video only), applied live */
  75. imageAdjustments?: ImageAdjustments
  76. /**
  77. * Global playback speed multiplier for animations/particles/effects, applied via
  78. * linux-wallpaperengine --speed (1 = normal speed, less than 1 = slower)
  79. */
  80. playbackSpeed?: number
  81. backedUp?: boolean
  82. backupDir?: string
  83. /** The workshop copy no longer matches the backup (file list or sizes), e.g. the author published an update */
  84. backupOutdated?: boolean
  85. /** Set by a "check unavailable" scan: true if the item has been removed from the Steam Workshop */
  86. unavailable?: boolean
  87. /** Object/layer ids or names to force-hide via linux-wallpaperengine --disable-object */
  88. disabledObjects?: string[]
  89. /** Object/layer ids or names to force-show via linux-wallpaperengine --enable-object */
  90. enabledObjects?: string[]
  91. /** Effect ids or editor names to force-hide via linux-wallpaperengine --disable-effect */
  92. disabledEffects?: string[]
  93. /** Effect ids or editor names to force-show via linux-wallpaperengine --enable-effect */
  94. enabledEffects?: string[]
  95. /** Property name -> override value, applied via linux-wallpaperengine --set-property name=value */
  96. propertyOverrides?: Record<string, string>
  97. /**
  98. * Object id -> audio-reactive pulse sensitivity multiplier, applied via linux-wallpaperengine
  99. * --audio-sensitivity id=multiplier. 0 locks the object (no pulse), 1 is the wallpaper's
  100. * original authored behavior, >1 exaggerates it. Objects with no entry here use
  101. * defaultAudioSensitivity from the global config instead.
  102. */
  103. audioSensitivity?: Record<string, number>
  104. /**
  105. * Sound object id -> volume (0-1), applied live via linux-wallpaperengine's sound-volume
  106. * hotswap. Independent of the global volume - lets a wallpaper with several alternate music
  107. * tracks (each its own Sound object) play only one.
  108. */
  109. soundVolume?: Record<string, number>
  110. /**
  111. * Extra linux-wallpaperengine arguments appended verbatim to the launch, e.g. `--render-debug skip-effect=726`.
  112. * Launch-time only, so changing this always restarts the process.
  113. */
  114. customArgs?: string
  115. /** Launch-only engine flags, each one unset here falls back to the global setting */
  116. engineFlags?: EngineFlags
  117. compat?: WallpaperCompat
  118. /** Scene with general.hdr on, or a PQ/HLG video. Unset until the background HDR pass has looked at it */
  119. hdr?: boolean
  120. /** Thumbnail made by the app (a screenshot of the running wallpaper, or an image the user picked) */
  121. customPreview?: string
  122. /** Show the Workshop/project preview even though a custom one exists */
  123. useOriginalPreview?: boolean
  124. }
  125. export type FullscreenPauseMode = 'default' | 'off' | 'active-only'
  126. /** Wallpaper Engine's post processing setting, "ultra" turns on HDR rendering for scenes that ask for it */
  127. export type PostProcessingQuality = 'enabled' | 'ultra'
  128. /** Wallpaper Engine's volumetrics/shadow quality settings */
  129. export type LightingQuality = 'disabled' | 'low' | 'medium' | 'high' | 'ultra'
  130. /** linux-wallpaperengine flags that only take effect on a fresh launch */
  131. export interface EngineFlags {
  132. disableParticles?: boolean
  133. disableMouse?: boolean
  134. disableAnimations?: boolean
  135. noAudioProcessing?: boolean
  136. fullscreenPause?: FullscreenPauseMode
  137. automute?: boolean
  138. silent?: boolean
  139. hdr?: boolean
  140. postProcessing?: PostProcessingQuality
  141. volumetrics?: LightingQuality
  142. shadows?: LightingQuality
  143. }
  144. export interface EngineFlagPreset {
  145. id: string
  146. name: string
  147. flags: EngineFlags
  148. /** Applied as the default FPS (globally) or the FPS override (per wallpaper); undefined leaves it alone */
  149. fps?: number | null
  150. builtIn?: boolean
  151. }
  152. export type CrashPhase = 'launch' | 'hotswap' | 'runtime'
  153. export interface WallpaperCrash {
  154. at: number
  155. phase: CrashPhase
  156. screen: string
  157. log: string[]
  158. }
  159. export interface WallpaperCompat {
  160. /** The engine died right after this wallpaper was hot-swapped in */
  161. hotswapCrash?: boolean
  162. /** Outcome of the last fresh launch that was watched for a crash */
  163. freshLaunch?: 'ok' | 'crash'
  164. runtimeCrashes?: number
  165. lastCrash?: WallpaperCrash
  166. note?: string
  167. }
  168. export type CompatStatus = 'ok' | 'crashes' | 'hotswap-only' | 'hotswap-untested' | 'unstable'
  169. export interface CrashEvent {
  170. wallpaperId: string
  171. title: string
  172. screen: string
  173. phase: CrashPhase
  174. /** What the app did about it, for the toast */
  175. outcome: string
  176. }
  177. /** '*' is the one engine process covering every screen */
  178. export type ScreenTarget = string
  179. export type DisplayMode = 'shared' | 'per-screen'
  180. export interface ScreenAssignment {
  181. screen: ScreenTarget
  182. wallpaperId: string
  183. }
  184. export type ScheduleAction =
  185. | { type: 'wallpaper'; wallpaperId: string }
  186. | { type: 'playlist'; playlistId: string }
  187. | { type: 'stop' }
  188. export type ScheduleTrigger =
  189. | { type: 'time'; time: string; days: number[] }
  190. | { type: 'theme'; theme: 'dark' | 'light' }
  191. export interface ScheduleRule {
  192. id: string
  193. name: string
  194. enabled: boolean
  195. trigger: ScheduleTrigger
  196. action: ScheduleAction
  197. /** Screen name in per-screen mode, '*' for every screen */
  198. screen: ScreenTarget
  199. }
  200. export interface LweSceneObject {
  201. id: string
  202. name: string
  203. type: 'image' | 'particle' | 'text' | 'sound' | 'unknown'
  204. }
  205. /** One effect (bloom, blur, glow, etc) attached to an object, as reported by --list-effects */
  206. export interface LweSceneEffect {
  207. id: string
  208. /** Effect's name for the editor, e.g. "Bloom" - not necessarily unique across objects */
  209. name: string
  210. objectId: string
  211. objectName: string
  212. /** The effect asset's own category, e.g. "Blur/Sharpen" - empty if the wallpaper doesn't set one */
  213. group: string
  214. }
  215. /** One audio-reactive script property on a scene object, as reported by --list-audio-objects */
  216. export interface LweAudioObject {
  217. objectId: string
  218. objectName: string
  219. /** The scripted property driving the pulse, e.g. "scale" or "alpha" */
  220. property: string
  221. minvalue: number
  222. maxvalue: number
  223. frequency: number
  224. smoothing: number
  225. }
  226. export interface LweProperty {
  227. name: string
  228. type:
  229. | 'slider'
  230. | 'boolean'
  231. | 'color'
  232. | 'combo'
  233. | 'text'
  234. | 'scene-texture'
  235. | 'file'
  236. | 'textinput'
  237. | 'usershortcut'
  238. | 'unknown'
  239. text?: string
  240. value: string
  241. min?: number
  242. max?: number
  243. step?: number
  244. options?: { value: string; label: string }[]
  245. }
  246. export interface DesktopApplication {
  247. name: string
  248. file: string
  249. }
  250. export interface WorkshopAuthorInfo {
  251. steamId: string
  252. name: string
  253. avatarUrl: string
  254. }
  255. export interface WorkshopItem {
  256. publishedFileId: string
  257. title: string
  258. description: string
  259. previewUrl: string
  260. creatorSteamId: string
  261. tags: string[]
  262. timeCreated: number
  263. timeUpdated: number
  264. subscriptions: number
  265. upvotes: number
  266. downvotes: number
  267. isSubscribed: boolean
  268. /** Size in bytes as reported by the Steam Workshop (same figure shown on the item's Steam page); undefined if unavailable. */
  269. fileSize?: number
  270. }
  271. export interface WorkshopQueryParams {
  272. appId?: number
  273. searchText?: string
  274. tags?: string[]
  275. excludedTags?: string[]
  276. queryType?: WorkshopQueryType
  277. page?: number
  278. }
  279. export interface WorkshopQueryResult {
  280. items: WorkshopItem[]
  281. page: number
  282. totalResults: number
  283. }
  284. export interface CreatorWorkshopQueryParams {
  285. searchText?: string
  286. tags?: string[]
  287. excludedTags?: string[]
  288. queryType?: WorkshopQueryType
  289. page?: number
  290. }
  291. export interface ApplyWallpaperOptions {
  292. wallpaperId: string
  293. /** Per-screen mode only: a screen name, or '*' for every screen */
  294. screen?: ScreenTarget
  295. backend?: WallpaperBackend
  296. }
  297. export interface DownloadProgressEvent {
  298. itemId: string
  299. bytesDownloaded: number
  300. bytesTotal: number
  301. percentage: number
  302. status: 'downloading' | 'completed' | 'error'
  303. }
  304. export interface LibraryFilters {
  305. tags?: string[]
  306. categories?: string[]
  307. type?: WallpaperType
  308. contentRating?: ContentRating
  309. searchText?: string
  310. sortBy?: 'title' | 'createdAt' | 'updatedAt' | 'lastApplied' | 'appliedCount' | 'fileSize'
  311. sortDir?: 'asc' | 'desc'
  312. }
  313. export interface WallpaperFolder {
  314. id: string
  315. title: string
  316. items: string[] // workshop IDs
  317. }
  318. export interface WallpaperEnvironment {
  319. displayServer: 'wayland' | 'x11' | 'unknown'
  320. desktopEnv: 'gnome' | 'kde' | 'hyprland' | 'sway' | 'other'
  321. availableBackends: WallpaperBackend[]
  322. recommendedBackend: WallpaperBackend
  323. linuxWallpaperEngine: LweStatus
  324. }
  325. export interface LweStatus {
  326. installed: boolean
  327. path?: string
  328. version?: string
  329. }
  330. export type LinuxDistro = 'fedora' | 'arch' | 'debian' | 'unknown'
  331. /** Which prebuilt release archive fits this machine, or why none does */
  332. export interface LwePrebuiltTarget {
  333. supported: boolean
  334. /** Release asset name, e.g. linux-wallpaperengine-kde-fedora-44-x86_64.tar.gz */
  335. asset?: string
  336. label?: string
  337. reason?: string
  338. }
  339. export interface LweInstallProgress {
  340. stage: 'installing-deps' | 'downloading' | 'cloning' | 'building' | 'installing' | 'done' | 'error'
  341. message: string
  342. percentage: number
  343. }
  344. export interface BackupProgressEvent {
  345. itemId: string
  346. bytesCopied: number
  347. bytesTotal: number
  348. percentage: number
  349. status: 'copying' | 'verifying' | 'completed' | 'error'
  350. message?: string
  351. }
  352. export interface PlaylistItem {
  353. wallpaperId: string
  354. /** 0-100, overrides the playlist's defaultVolume when set */
  355. volume?: number
  356. /** Overrides the playlist's defaultDurationSec when set */
  357. durationSec?: number
  358. }
  359. export interface PlaylistSettings {
  360. /** Shuffle playback order; reshuffled every time the playlist loops back to the start */
  361. randomize: boolean
  362. /** Base ordering when randomize is off; 'manual' respects PlaylistItem[] order */
  363. sortBy: 'manual' | 'title' | 'createdAt'
  364. /** How long each wallpaper plays before advancing, in seconds */
  365. defaultDurationSec: number
  366. /** Video wallpapers longer than their duration play to the end once before advancing */
  367. finishVideos?: boolean
  368. /** 0-100, used for items without a per-item volume override */
  369. defaultVolume: number
  370. }
  371. export interface Playlist {
  372. id: string
  373. title: string
  374. items: PlaylistItem[]
  375. settings: PlaylistSettings
  376. createdAt: number
  377. updatedAt: number
  378. }
  379. export interface PlaylistPlaybackState {
  380. screen: ScreenTarget
  381. playlistId: string | null
  382. currentItemId: string | null
  383. currentIndex: number
  384. isPlaying: boolean
  385. order: string[]
  386. }