types.ts 15 KB

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