types.ts 12 KB

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