浏览代码

Loader settings, deb and rpm packaging metadata, shared settings components, more tests

Settings: new loader section (shared/loader.ts, LoaderSettings), shared SettingsCard, Reorderable, ResizableWidth and picker parts reused across library, workshop, playlist and settings views. Engine handling: lwe.service and steam.service reworked, config service and handlers extended, GitHub release lookup helpers for the version picker. Packaging: deb metadata (synopsis, description, depends, copyright) and rpm files under packaging/. Tests: vitest 374 -> 523 (collections, flatpak host, hdr features, packages, paths, platform session, video, loader, github, relaunch). CI: build workflow updated, dependabot, SECURITY.md. All 20 locales get the new strings.
UwU 4 周之前
父节点
当前提交
cad55ba25a
共有 100 个文件被更改,包括 3193 次插入 和 1154 次删除
  1. 16 0
      .github/dependabot.yml
  2. 36 2
      .github/workflows/build.yml
  3. 15 0
      SECURITY.md
  4. 26 1
      package.json
  5. 27 0
      packaging/deb/copyright
  6. 3 0
      packaging/rpm/we-manager.rpmlintrc
  7. 81 0
      packaging/rpm/we-manager.spec
  8. 28 8
      src/main/index.ts
  9. 8 10
      src/main/ipc/backup.handlers.ts
  10. 40 7
      src/main/ipc/config.handlers.ts
  11. 1 1
      src/main/ipc/shell.handlers.ts
  12. 3 3
      src/main/ipc/steam.handlers.ts
  13. 2 2
      src/main/ipc/update.handlers.ts
  14. 2 2
      src/main/services/appearance.service.ts
  15. 0 4
      src/main/services/autostart.service.ts
  16. 2 2
      src/main/services/backup.service.test.ts
  17. 6 7
      src/main/services/backup.service.ts
  18. 74 2
      src/main/services/config.service.ts
  19. 3 5
      src/main/services/dependency.service.ts
  20. 11 0
      src/main/services/desktop-icons-overlay.py
  21. 5 5
      src/main/services/desktop-icons.service.ts
  22. 3 5
      src/main/services/display.service.ts
  23. 1 1
      src/main/services/fonts.service.ts
  24. 8 7
      src/main/services/gnome-extension.service.ts
  25. 1 1
      src/main/services/library-transfer.service.test.ts
  26. 24 25
      src/main/services/library.service.ts
  27. 20 1
      src/main/services/lwe.service.test.ts
  28. 61 115
      src/main/services/lwe.service.ts
  29. 2 6
      src/main/services/playlist-player.service.ts
  30. 1 1
      src/main/services/schedule.service.ts
  31. 4 4
      src/main/services/static-wallpaper.service.ts
  32. 1 1
      src/main/services/steam-list-cache.test.ts
  33. 6 6
      src/main/services/steam-list-cache.ts
  34. 3 3
      src/main/services/steam.service.test.ts
  35. 80 27
      src/main/services/steam.service.ts
  36. 2 2
      src/main/services/thumbnail.service.ts
  37. 1 5
      src/main/services/tray.service.ts
  38. 2 2
      src/main/services/watcher.service.ts
  39. 2 2
      src/main/services/workshop-verify.service.test.ts
  40. 1 1
      src/main/services/workshop-verify.service.ts
  41. 2 2
      src/main/services/workshop.service.ts
  42. 2 2
      src/main/steam-host.ts
  43. 1 1
      src/main/utils/buildDir.test.ts
  44. 23 0
      src/main/utils/collections.test.ts
  45. 163 0
      src/main/utils/flatpak-host.test.ts
  46. 1 1
      src/main/utils/flatpak.ts
  47. 146 2
      src/main/utils/github.test.ts
  48. 182 0
      src/main/utils/hdr-features.test.ts
  49. 1 1
      src/main/utils/hdr.test.ts
  50. 2 2
      src/main/utils/hdr.ts
  51. 1 1
      src/main/utils/localLibrary.test.ts
  52. 2 1
      src/main/utils/localLibrary.ts
  53. 91 0
      src/main/utils/packages.test.ts
  54. 1 1
      src/main/utils/packages.ts
  55. 144 0
      src/main/utils/paths.test.ts
  56. 306 0
      src/main/utils/platform-session.test.ts
  57. 8 2
      src/main/utils/platform.ts
  58. 104 3
      src/main/utils/relaunch.test.ts
  59. 1 0
      src/main/utils/relaunch.ts
  60. 136 0
      src/main/utils/video.test.ts
  61. 38 0
      src/main/utils/wallpaperScripts.test.ts
  62. 30 91
      src/preload/index.ts
  63. 17 15
      src/renderer/src/App.tsx
  64. 56 0
      src/renderer/src/assets/index.css
  65. 6 6
      src/renderer/src/components/common/ContextMenu.tsx
  66. 2 2
      src/renderer/src/components/common/CopyField.tsx
  67. 121 111
      src/renderer/src/components/common/DetailSidebar.tsx
  68. 16 13
      src/renderer/src/components/common/FilterPanel.tsx
  69. 1 1
      src/renderer/src/components/common/FontNotice.tsx
  70. 8 6
      src/renderer/src/components/common/GridCard.tsx
  71. 3 3
      src/renderer/src/components/common/GridControls.tsx
  72. 83 0
      src/renderer/src/components/common/PickerParts.tsx
  73. 5 5
      src/renderer/src/components/common/PreviewImage.tsx
  74. 7 4
      src/renderer/src/components/common/PreviewSizeToggle.tsx
  75. 145 0
      src/renderer/src/components/common/Reorderable.tsx
  76. 68 0
      src/renderer/src/components/common/ResizableWidth.tsx
  77. 1 1
      src/renderer/src/components/common/ScreenSelect.tsx
  78. 10 10
      src/renderer/src/components/common/ShortcutRow.tsx
  79. 10 10
      src/renderer/src/components/common/WallpaperContextMenu.tsx
  80. 6 6
      src/renderer/src/components/common/sidebar/CompatSection.tsx
  81. 6 8
      src/renderer/src/components/common/sidebar/EngineFlagsSection.tsx
  82. 7 7
      src/renderer/src/components/common/sidebar/ImageAdjustmentsSection.tsx
  83. 5 5
      src/renderer/src/components/common/sidebar/ThumbnailSection.tsx
  84. 23 18
      src/renderer/src/components/common/sidebar/VideoTrimSection.tsx
  85. 2 2
      src/renderer/src/components/layout/GnomeExtensionNotice.tsx
  86. 1 1
      src/renderer/src/components/layout/GraphicsNotice.tsx
  87. 2 2
      src/renderer/src/components/layout/Sidebar.tsx
  88. 4 4
      src/renderer/src/components/layout/StatusBar.tsx
  89. 198 160
      src/renderer/src/components/library/LibraryView.tsx
  90. 181 96
      src/renderer/src/components/library/WallpaperCard.tsx
  91. 4 4
      src/renderer/src/components/playlist/PlaylistItemRow.tsx
  92. 58 41
      src/renderer/src/components/playlist/PlaylistsView.tsx
  93. 32 78
      src/renderer/src/components/playlist/WallpaperPickerModal.tsx
  94. 12 12
      src/renderer/src/components/settings/AppearanceSettings.tsx
  95. 2 2
      src/renderer/src/components/settings/AutomuteIgnoreSettings.tsx
  96. 2 2
      src/renderer/src/components/settings/CardBadgeSettings.tsx
  97. 8 7
      src/renderer/src/components/settings/CardBorderSettings.tsx
  98. 27 25
      src/renderer/src/components/settings/DiagnosticsSettings.tsx
  99. 53 97
      src/renderer/src/components/settings/DiagnosticsTargetModal.tsx
  100. 4 4
      src/renderer/src/components/settings/DisplaySettings.tsx

+ 16 - 0
.github/dependabot.yml

@@ -0,0 +1,16 @@
+version: 2
+updates:
+  - package-ecosystem: github-actions
+    directory: /
+    schedule:
+      interval: weekly
+    groups:
+      actions:
+        patterns: ['*']
+  - package-ecosystem: npm
+    directory: /
+    schedule:
+      interval: weekly
+    groups:
+      minor-and-patch:
+        update-types: [minor, patch]

+ 36 - 2
.github/workflows/build.yml

@@ -174,8 +174,42 @@ jobs:
           path: we-manager.flatpak
           if-no-files-found: error
 
+  rpm:
+    needs: we-manager
+    runs-on: ubuntu-latest
+    container: fedora:44
+    steps:
+      - name: Install the rpm tools
+        run: dnf install -y rpm-build rpmlint binutils tar xz desktop-file-utils
+
+      - uses: actions/checkout@v7
+
+      - uses: actions/download-artifact@v8
+        with:
+          name: we-manager
+          path: ${{ runner.temp }}/we-manager
+
+      - name: Build the rpm from the release .deb
+        run: |
+          version=$(sed -n 's/^  "version": "\(.*\)",/\1/p' package.json)
+          sed -i "s/^Version:.*/Version:        ${version//-/\~}/; s/^%global upstream_version .*/%global upstream_version $version/" packaging/rpm/we-manager.spec
+          mkdir -p "$RUNNER_TEMP/rpm/SOURCES"
+          cp "$RUNNER_TEMP"/we-manager/*.deb "$RUNNER_TEMP/rpm/SOURCES/"
+          rpmbuild -bb --define "_topdir $RUNNER_TEMP/rpm" --define "_build_id_links none" packaging/rpm/we-manager.spec
+          mkdir -p dist-rpm
+          cp "$RUNNER_TEMP"/rpm/RPMS/x86_64/*.rpm dist-rpm/
+
+      - name: rpmlint
+        run: rpmlint -r packaging/rpm/we-manager.rpmlintrc dist-rpm/*.rpm packaging/rpm/we-manager.spec || true
+
+      - uses: actions/upload-artifact@v7
+        with:
+          name: we-manager-rpm
+          path: dist-rpm/*.rpm
+          if-no-files-found: error
+
   release:
-    needs: [steamworks-vote, we-manager, flatpak]
+    needs: [steamworks-vote, we-manager, flatpak, rpm]
     if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/v') && needs.we-manager.result == 'success' }}
     runs-on: ubuntu-latest
     permissions:
@@ -207,7 +241,7 @@ jobs:
             notes=(--notes "> **Built without the patched steamworks.js** (its build ended with \`$STEAMWORKS_RESULT\`): likes, dislikes and favorites are not confirmed by Steam in this release.")
           fi
           gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes "${notes[@]}" \
-            release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz release/*.flatpak 2>/dev/null)
+            release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz release/*.flatpak release/*.rpm 2>/dev/null)
 
   aur:
     needs: release

+ 15 - 0
SECURITY.md

@@ -0,0 +1,15 @@
+# Security policy
+
+## Supported versions
+
+Only the latest release of linux-wallpaperengine-kde (engine) and WE Manager gets security fixes.
+
+## Reporting a vulnerability
+
+Please do not open a public issue. Use GitHub's private reporting instead:
+https://github.com/WallpaperEngineLover/linux-wallpaperengine-kde/security/advisories/new
+(for WE Manager: https://github.com/WallpaperEngineLover/we_manager/security/advisories/new).
+
+Say which version you ran, what you did and what happened. Wallpapers are untrusted input, so a crafted wallpaper
+that crashes the engine, reads files outside its folder or runs a command is in scope. Reports are answered as
+soon as possible, fixes ship with the next release and the report is credited unless you prefer otherwise.

+ 26 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "we-manager",
-  "version": "0.9.8",
+  "version": "0.9.9",
   "type": "module",
   "description": "Wallpaper Engine workshop manager",
   "desktopName": "we-manager.desktop",
@@ -68,6 +68,31 @@
       "icon": "resources/icons/linux",
       "syncDesktopName": true
     },
+    "deb": {
+      "synopsis": "Wallpaper Engine workshop manager",
+      "description": "Browse, organise and apply Wallpaper Engine workshop wallpapers on Linux\nwith the linux-wallpaperengine engine. Handles playlists, per-wallpaper\nsettings, backups and engine updates.",
+      "packageCategory": "utils",
+      "fpm": [
+        "packaging/deb/copyright=/usr/share/doc/we-manager/copyright"
+      ],
+      "depends": [
+        "libc6",
+        "libstdc++6",
+        "python3",
+        "libgtk-3-0",
+        "libnotify4",
+        "libnss3",
+        "libxss1",
+        "libxtst6",
+        "xdg-utils",
+        "libatspi2.0-0",
+        "libuuid1",
+        "libsecret-1-0"
+      ],
+      "recommends": [
+        "libappindicator3-1"
+      ]
+    },
     "appImage": {
       "artifactName": "WE-Manager-${version}.${ext}"
     },

+ 27 - 0
packaging/deb/copyright

@@ -0,0 +1,27 @@
+Format: https://www.debian.org/doc/packaging-guide/...copyright-format/1.0/
+Upstream-Name: we-manager
+Source: https://github.com/WallpaperEngineLover/we_manager
+
+Files: *
+Copyright: 2026 WallpaperEngineLover
+License: MIT
+
+Files: opt/*
+Copyright: Electron contributors, The Chromium Authors and others
+License: MIT and others
+ The Electron and Chromium runtime shipped in /opt/WE Manager carries many licenses. The full texts are in
+ /opt/WE Manager/LICENSE.electron.txt and /opt/WE Manager/LICENSES.chromium.html.
+
+License: MIT
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
+ documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
+ rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
+ persons to whom the Software is furnished to do so, subject to the following conditions:
+ .
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
+ Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+ WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+ COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

+ 3 - 0
packaging/rpm/we-manager.rpmlintrc

@@ -0,0 +1,3 @@
+addFilter(r"spelling-error .*(wallpaperengine|kde)")
+# Chromium's own setuid helper, not ours
+addFilter(r"missing-call-to-setgroups-before-setuid .*/chrome-sandbox")

+ 81 - 0
packaging/rpm/we-manager.spec

@@ -0,0 +1,81 @@
+%global debug_package %{nil}
+%global __strip /bin/true
+%global __brp_mangle_shebangs %{nil}
+%global upstream_version 0.9.8
+%global appdir %{_libdir}/%{name}
+%global __provides_exclude_from ^%{appdir}/.*$
+%global __requires_exclude ^(lib(ffmpeg|vk_swiftshader|vulkan|EGL|GLESv2|steam_api)\\.so.*)$
+
+Name:           we-manager
+Version:        0.9.8
+Release:        1%{?dist}
+Summary:        Wallpaper Engine workshop manager
+License:        MIT AND BSD-3-Clause AND Apache-2.0 AND MPL-2.0 AND LGPL-2.1-or-later
+URL:            https://github.com/WallpaperEngineLover/we_manager
+Source0:        %{url}/releases/download/v%{upstream_version}/%{name}_%{upstream_version}_amd64.deb
+
+ExclusiveArch:  x86_64
+BuildRequires:  binutils
+BuildRequires:  tar
+BuildRequires:  xz
+BuildRequires:  desktop-file-utils
+
+Requires:       gtk3
+Requires:       nss
+Requires:       xdg-utils
+Requires:       at-spi2-core
+Requires:       python3
+Recommends:     libappindicator-gtk3
+Suggests:       linux-wallpaperengine-kde
+
+%description
+Browse, organize and apply Wallpaper Engine workshop wallpapers on Linux with
+the engine from linux-wallpaperengine-kde. Handles playlists, per-wallpaper
+settings, backups and engine updates.
+
+The Electron and Chromium runtime is bundled in %{appdir}.
+
+%prep
+%setup -q -c -T
+ar x %{SOURCE0}
+tar -xf data.tar.*
+
+%build
+
+%install
+install -d %{buildroot}%{_libdir}
+mv "opt/WE Manager" %{buildroot}%{appdir}
+cp -a usr %{buildroot}/
+rm -f %{buildroot}%{_docdir}/%{name}/changelog.gz
+install -d %{buildroot}%{_bindir}
+ln -s ../%{_lib}/%{name}/we-manager %{buildroot}%{_bindir}/we-manager
+sed -i 's|^Exec=.*|Exec=we-manager %U|' %{buildroot}%{_datadir}/applications/we-manager.desktop
+sed -i '1s|^#!/usr/bin/env python3|#!/usr/bin/python3|' %{buildroot}%{appdir}/resources/desktop-icons-overlay.py
+
+(
+    cd %{buildroot}
+    find .%{appdir} -mindepth 0 -type d | sed 's|^\.|%%dir |'
+    find .%{appdir} ! -type d | sed 's|^\.||' \
+        | sed -e 's|^\(%{appdir}/LICENSE.electron.txt\)$|%%license \1|' \
+              -e 's|^\(%{appdir}/LICENSES.chromium.html\)$|%%license \1|' \
+              -e 's|^\(%{appdir}/chrome-sandbox\)$|%%verify(not mode) \1|'
+) > %{_builddir}/app-files.list
+
+%check
+desktop-file-validate %{buildroot}%{_datadir}/applications/we-manager.desktop
+
+%post
+# the .deb's postinst: the setuid sandbox helper only where the kernel has no user namespaces
+if ! { [ -L /proc/self/ns/user ] && unshare --user true; } 2>/dev/null; then
+    chmod 4755 %{appdir}/chrome-sandbox || :
+fi
+
+%files -f %{_builddir}/app-files.list
+%license %{_docdir}/%{name}/copyright
+%{_bindir}/we-manager
+%{_datadir}/applications/we-manager.desktop
+%{_datadir}/icons/hicolor/*/apps/we-manager.png
+
+%changelog
+* Thu Oct 29 2026 WallpaperEngineLover <260361707+WallpaperEngineLover@users.noreply.github.com> - 0.9.8-1
+- Repackage the 0.9.8 release as an rpm

+ 28 - 8
src/main/index.ts

@@ -1,4 +1,4 @@
-import { app, BrowserWindow, dialog, net, protocol, shell } from 'electron'
+import { app, BrowserWindow, dialog, net, protocol, session, shell } from 'electron'
 import path from 'path'
 import { pathToFileURL } from 'url'
 import { IpcChannels } from '@shared/ipc-channels'
@@ -36,6 +36,17 @@ protocol.registerSchemesAsPrivileged([{ scheme: 'wallpaper', privileges: { suppo
 let isQuitting = false
 let hasKilledLweOnQuit = false
 
+const gotInstanceLock = app.requestSingleInstanceLock()
+if (!gotInstanceLock) app.quit()
+
+app.on('second-instance', (_event, argv) => {
+  const win = BrowserWindow.getAllWindows()[0]
+  if (!win || argv.includes('--minimized')) return
+  if (win.isMinimized()) win.restore()
+  win.show()
+  win.focus()
+})
+
 const BACKGROUND_SYNC_INTERVAL_MS = 3 * 60 * 1000
 const TRAY_HOST_WAIT_MS = 10_000
 
@@ -154,9 +165,9 @@ function createWindow(): BrowserWindow {
     if (openLinks && isSafeExternalUrl(event.url)) void shell.openExternal(event.url)
   }
   // will-frame-navigate comes first, for the main frame as well, and will-navigate is skipped once that one prevents it
-  win.webContents.on('will-frame-navigate', (event) => keepOnApp(event, event.isMainFrame))
-  win.webContents.on('will-navigate', (event) => keepOnApp(event, true))
-  win.webContents.on('will-redirect', (event) => keepOnApp(event, false))
+  win.webContents.on('will-frame-navigate', (event) => { keepOnApp(event, event.isMainFrame) })
+  win.webContents.on('will-navigate', (event) => { keepOnApp(event, true) })
+  win.webContents.on('will-redirect', (event) => { keepOnApp(event, false) })
 
   // closing hides to the tray, or quits without a StatusNotifier host
   win.on('close', (event) => {
@@ -167,9 +178,9 @@ function createWindow(): BrowserWindow {
   })
 
   if (devUrl) {
-    win.loadURL(devUrl)
+    win.loadURL(devUrl).catch((err: unknown) => { console.error('[Main] loadURL failed:', err) })
   } else {
-    win.loadFile(path.join(__dirname, '../renderer/index.html'))
+    win.loadFile(path.join(__dirname, '../renderer/index.html')).catch((err: unknown) => { console.error('[Main] loadFile failed:', err) })
   }
 
   if (startHidden && !hasStatusNotifierHost()) showWindowUnlessTrayAppears(win)
@@ -188,6 +199,11 @@ function announceResetStores(): void {
 }
 
 app.whenReady().then(async () => {
+  if (!gotInstanceLock) return
+  const allowedPermission = (permission: string): boolean => permission === 'clipboard-sanitized-write'
+  session.defaultSession.setPermissionRequestHandler((_webContents, permission, callback) => { callback(allowedPermission(permission)) })
+  session.defaultSession.setPermissionCheckHandler((_webContents, permission) => allowedPermission(permission))
+
   protocol.handle('wallpaper', async (request) => {
     let filePath: string
     try {
@@ -243,7 +259,7 @@ app.whenReady().then(async () => {
   }
   initSchedule(win)
   initUpdates(win)
-})
+}).catch((err: unknown) => { console.error('[Main] startup failed:', err) })
 
 app.on('before-quit', (event) => {
   isQuitting = true
@@ -251,10 +267,14 @@ app.on('before-quit', (event) => {
   if (getKillLweOnQuit() && !hasKilledLweOnQuit) {
     event.preventDefault()
     hasKilledLweOnQuit = true
-    killAllLweProcesses().finally(() => app.quit())
+    killAllLweProcesses().catch((err: unknown) => { console.error('[Main] killing engines on quit failed:', err) }).finally(() => { app.quit() })
   }
 })
 
+app.on('will-quit', () => {
+  cleanupDesktopIcons()
+})
+
 app.on('window-all-closed', () => {
   cleanupDesktopIcons()
   if (process.platform !== 'darwin') app.quit()

+ 8 - 10
src/main/ipc/backup.handlers.ts

@@ -7,7 +7,7 @@ import * as library from '../services/library.service'
 import * as steam from '../services/steam.service'
 import { getAutoUnsubscribeAfterBackup } from '../services/config.service'
 
-export interface BackupItemResult {
+interface BackupItemResult {
   ok: boolean
   alreadyBackedUp: boolean
   unsubscribed: boolean
@@ -28,13 +28,11 @@ async function backupOne(id: string, win: BrowserWindow): Promise<BackupItemResu
     }
     const sourcePath = wallpaper.localPath
 
-    let backupDir = backup.resolveBackupDir(wallpaper)
+    const existingDir = backup.resolveBackupDir(wallpaper)
     const alreadyBackedUp =
-      !!backupDir && (await backup.hasBackupFiles(backupDir)) && (await backup.backupMatchesSource(sourcePath, backupDir))
-    if (!alreadyBackedUp) {
-      backupDir = await backup.backupWallpaper(id, sourcePath, win)
-    }
-    library.updateWallpaper(id, { backedUp: true, backupDir: backupDir!, backupOutdated: false })
+      !!existingDir && (await backup.hasBackupFiles(existingDir)) && (await backup.backupMatchesSource(sourcePath, existingDir))
+    const backupDir = alreadyBackedUp ? existingDir : await backup.backupWallpaper(id, sourcePath, win)
+    library.updateWallpaper(id, { backedUp: true, backupDir, backupOutdated: false })
 
     let unsubscribed = false
     if (getAutoUnsubscribeAfterBackup()) {
@@ -44,13 +42,13 @@ async function backupOne(id: string, win: BrowserWindow): Promise<BackupItemResu
       await steam.unsubscribeFromItem(BigInt(id))
       library.updateWallpaper(id, {
         source: 'backup',
-        localPath: backupDir!,
-        previewLocal: await backup.previewInBackup(wallpaper, backupDir!),
+        localPath: backupDir,
+        previewLocal: await backup.previewInBackup(wallpaper, backupDir),
         subscribed: false,
         downloading: false,
         downloadFailed: false
       })
-      if (path.resolve(sourcePath) !== path.resolve(backupDir!)) {
+      if (path.resolve(sourcePath) !== path.resolve(backupDir)) {
         try {
           await fs.promises.rm(sourcePath, { recursive: true, force: true })
         } catch {

+ 40 - 7
src/main/ipc/config.handlers.ts

@@ -1,7 +1,7 @@
 import { ipcMain, dialog, BrowserWindow } from 'electron'
 import { IpcChannels } from '@shared/ipc-channels'
 import * as path from 'path'
-import type { DisplayMode, EngineFlagPreset, EngineFlags, ExtraLibrary, LedSettings, SteamIdentity } from '@shared/types'
+import type { DisplayMode, EngineFlagPreset, EngineFlags, ExtraLibrary, LedSettings, LoaderSettings, SteamIdentity } from '@shared/types'
 import { BUILT_IN_PRESETS } from '@shared/engineFlags'
 import { isTranslucent, type Appearance } from '@shared/appearance'
 import type { CardBorders } from '@shared/cardBorders'
@@ -40,6 +40,8 @@ import {
   setAutostartPlaylistId,
   getKillLweOnQuit,
   setKillLweOnQuit,
+  getSkipPlaylistResume,
+  setSkipPlaylistResume,
   getCardBorders,
   getCardBadges,
   getAppearance,
@@ -60,6 +62,8 @@ import {
   setScriptLimits,
   getLeds,
   setLeds,
+  getLoader,
+  setLoader,
   getDisableAnimations,
   getSteamIdentity,
   setSteamIdentity,
@@ -74,9 +78,12 @@ import {
   getDisabledScreens,
   setDisabledScreens,
   getSplitScreens,
-  setDisplayMode
+  setDisplayMode,
+  resetEngineSettings,
+  DEFAULT_DISPLAY_MODE
 } from '../services/config.service'
 import { pushGlobalEngineFlags, resetDisplays } from '../services/display.service'
+import { hotswapLweSettings } from '../services/lwe.service'
 import { stopPlaylist } from '../services/playlist-player.service'
 import { getDefaultWorkshopPath } from '../utils/paths'
 import { detectDesktopEnv } from '../utils/platform'
@@ -88,6 +95,13 @@ import { t, uiLanguage } from '../i18n'
 import type { LanguagePreference } from '@shared/i18n'
 import { getCompositorAutostartLine, isAutostartSupported, setAutostartEnabled } from '../services/autostart.service'
 
+async function switchDisplayMode(mode: DisplayMode): Promise<void> {
+  if (mode === getDisplayMode()) return
+  stopPlaylist()
+  await resetDisplays()
+  setDisplayMode(mode)
+}
+
 export function registerConfigHandlers(): void {
   ipcMain.handle(IpcChannels.CONFIG_GET, () => ({
     workshopPath: getConfiguredWorkshopPath(),
@@ -111,6 +125,7 @@ export function registerConfigHandlers(): void {
     autostartMinimized: getAutostartMinimized(),
     autostartPlaylistId: getAutostartPlaylistId(),
     killLweOnQuit: getKillLweOnQuit(),
+    skipPlaylistResume: getSkipPlaylistResume(),
     cardBorders: getCardBorders(),
     cardBadges: getCardBadges(),
     audioScreen: getAudioScreen(),
@@ -119,6 +134,7 @@ export function registerConfigHandlers(): void {
     disablePuppetAnimation: getDisablePuppetAnimation(),
     scriptLimits: getScriptLimits(),
     leds: getLeds(),
+    loader: getLoader(),
     disableAnimations: getDisableAnimations(),
     steamIdentity: getSteamIdentity(),
     ignoredCreators: getIgnoredCreators(),
@@ -163,6 +179,11 @@ export function registerConfigHandlers(): void {
     return { ok: true }
   })
 
+  ipcMain.handle(IpcChannels.CONFIG_SET_SKIP_PLAYLIST_RESUME, (_e, enabled: boolean) => {
+    setSkipPlaylistResume(enabled)
+    return { ok: true }
+  })
+
   ipcMain.handle(IpcChannels.CONFIG_SET_CARD_BORDERS, (_e, borders: CardBorders) => {
     return setCardBorders(borders)
   })
@@ -248,6 +269,11 @@ export function registerConfigHandlers(): void {
     return { ok: true }
   })
 
+  ipcMain.handle(IpcChannels.CONFIG_SET_LOADER, (_e, loader: LoaderSettings) => {
+    setLoader(loader)
+    return { ok: true }
+  })
+
   ipcMain.handle(IpcChannels.CONFIG_SET_LEDS, (_e, leds: LedSettings) => {
     setLeds(leds)
     return { ok: true }
@@ -267,10 +293,17 @@ export function registerConfigHandlers(): void {
 
   // what was on which screen means nothing in the other mode, so everything starts over
   ipcMain.handle(IpcChannels.CONFIG_SET_DISPLAY_MODE, async (_e, mode: DisplayMode) => {
-    if (mode === getDisplayMode()) return { ok: true }
-    stopPlaylist()
-    await resetDisplays()
-    setDisplayMode(mode)
+    await switchDisplayMode(mode)
+    return { ok: true }
+  })
+
+  ipcMain.handle(IpcChannels.CONFIG_RESET_ENGINE_SETTINGS, async () => {
+    const flagsBefore = getGlobalEngineFlags()
+    await switchDisplayMode(DEFAULT_DISPLAY_MODE)
+    resetEngineSettings()
+    await pushGlobalEngineFlags(flagsBefore, getGlobalEngineFlags())
+    // ambient volume has no "unset" to send, it applies on the next start
+    await hotswapLweSettings({ audioScreen: '', audioSensitivity: { '*': getDefaultAudioSensitivity() } })
     return { ok: true }
   })
 
@@ -316,7 +349,7 @@ export function registerConfigHandlers(): void {
     return result.filePaths[0]
   })
 
-  ipcMain.handle(IpcChannels.CONFIG_PICK_FILE, async (_e) => {
+  ipcMain.handle(IpcChannels.CONFIG_PICK_FILE, async () => {
     const win = BrowserWindow.getFocusedWindow()
     const result = await dialog.showOpenDialog(win!, {
       properties: ['openFile'],

+ 1 - 1
src/main/ipc/shell.handlers.ts

@@ -14,7 +14,7 @@ export function registerShellHandlers(): void {
     return { ok: !result, error: result || undefined }
   })
 
-  ipcMain.handle(IpcChannels.SHELL_OPEN_IN_FILE_MANAGER, async (_e, folderPath: string) => {
+  ipcMain.handle(IpcChannels.SHELL_OPEN_IN_FILE_MANAGER, (_e, folderPath: string) => {
     const resolved = path.resolve(folderPath)
     if (!fs.existsSync(resolved)) return { ok: false, error: 'Path not found' }
     shell.showItemInFolder(resolved)

+ 3 - 3
src/main/ipc/steam.handlers.ts

@@ -68,7 +68,7 @@ function startDownloadPoll(win: BrowserWindow, itemId: string, intervalMs = 1000
 
       clearInterval(pollInterval)
       activePolls--
-      library.importWallpaperById(itemId).catch((err) => {
+      library.importWallpaperById(itemId).catch((err: unknown) => {
         console.error(`[Steam] Import of ${itemId} failed:`, err)
         return null
       }).then((meta) => {
@@ -82,7 +82,7 @@ function startDownloadPoll(win: BrowserWindow, itemId: string, intervalMs = 1000
           percentage: success ? 100 : 0,
           status: success ? 'completed' : 'error'
         })
-      })
+      }).catch((err: unknown) => { console.error(`[Steam] Finishing import of ${itemId} failed:`, err) })
     }, intervalMs)
   })
 }
@@ -205,7 +205,7 @@ async function startRepair(win: BrowserWindow, itemId: string): Promise<{ done:
       library.updateWallpaper(itemId, { verifyProblem: check.problem ?? undefined })
       notifyLibrary()
     })
-    .catch((err) => console.error(`[Steam] Repair of ${itemId} failed:`, err))
+    .catch((err: unknown) => { console.error(`[Steam] Repair of ${itemId} failed:`, err) })
   return { done }
 }
 

+ 2 - 2
src/main/ipc/update.handlers.ts

@@ -17,11 +17,11 @@ export function registerUpdateHandlers(): void {
   ipcMain.handle(IpcChannels.UPDATES_SET_CHECKS, (_e, checks: UpdateChecks) => setUpdateChecksAndCheck(checks))
   ipcMain.handle(IpcChannels.UPDATES_CHECK, () => checkNow())
   ipcMain.handle(IpcChannels.UPDATES_DISMISS, (_e, target: UpdateTarget, version: string, forever: boolean) =>
-    dismissUpdate(target, version, forever === true))
+    dismissUpdate(target, version, forever))
   ipcMain.handle(IpcChannels.UPDATES_INSTALL_APP, (_e, tag?: string) => installAppUpdate(tag))
   ipcMain.handle(IpcChannels.UPDATES_VERSIONS, (_e, target: UpdateTarget) => {
     if (target !== 'app' && target !== 'engine') throw new Error(`Unknown update target ${String(target)}.`)
     return listVersions(target, target === 'engine' ? hasPrebuiltAsset : undefined)
   })
-  ipcMain.handle(IpcChannels.UPDATES_RESTART, () => restartApp())
+  ipcMain.handle(IpcChannels.UPDATES_RESTART, () => { restartApp() })
 }

+ 2 - 2
src/main/services/appearance.service.ts

@@ -58,8 +58,8 @@ export function windowAppearanceOptions(): Pick<BrowserWindowConstructorOptions,
 
 export function attachAppearance(win: BrowserWindow): void {
   mainWindow = win
-  win.once('ready-to-show', () => updateBlur(getAppearance()))
-  win.on('show', () => updateBlur(getAppearance()))
+  win.once('ready-to-show', () => { updateBlur(getAppearance()) })
+  win.on('show', () => { updateBlur(getAppearance()) })
 }
 
 export function applyLiveAppearance(appearance: Appearance): void {

+ 0 - 4
src/main/services/autostart.service.ts

@@ -84,10 +84,6 @@ export function getCompositorAutostartLine(): string | null {
   return compositorAutostartLine(detectDesktopEnv(), launchCommand())
 }
 
-export function isAutostartFileEnabled(): boolean {
-  return fs.existsSync(getAutostartDesktopPath())
-}
-
 /** Rewrites the entry when the app moved since autostart was saved */
 export function refreshAutostartExec(minimized: boolean): void {
   if (!isAutostartSupported()) return

+ 2 - 2
src/main/services/backup.service.test.ts

@@ -57,7 +57,7 @@ beforeEach(() => {
   wallpapers.clear()
 })
 
-afterEach(() => fs.rmSync(tmp, { recursive: true, force: true }))
+afterEach(() => { fs.rmSync(tmp, { recursive: true, force: true }) })
 
 describe('backupWallpaper', () => {
   it('copies, verifies and leaves no staging folder behind', async () => {
@@ -166,7 +166,7 @@ describe('interrupted copies', () => {
       return copyFile(...args)
     })
     const running = backup.backupWallpaper('123', source, win)
-    await vi.waitFor(() => expect(fs.existsSync(partial())).toBe(true))
+    await vi.waitFor(() => { expect(fs.existsSync(partial())).toBe(true) })
     await backup.scanBackupFolder()
     expect(fs.existsSync(partial())).toBe(true)
     await expect(backup.backupWallpaper('123', source, win)).rejects.toThrow(/already being written/)

+ 6 - 7
src/main/services/backup.service.ts

@@ -10,7 +10,7 @@ import * as library from './library.service'
 import { containedPath } from '../utils/contained'
 import { normalizeType, normalizeRating, type ProjectJson } from './library.service'
 
-export function getBackupDir(id: string): string {
+function getBackupDir(id: string): string {
   const backupPath = getConfiguredBackupPath()
   if (!backupPath) throw new Error('Backup path must be configured before backing up')
   return path.join(backupPath, id)
@@ -102,7 +102,7 @@ export async function findFolderProblem(dir: string): Promise<{ code: FolderProb
   return { code: 'missingMainFile', detail: `${pj.file} is missing` }
 }
 
-export async function findBackupProblem(dir: string): Promise<string | null> {
+async function findBackupProblem(dir: string): Promise<string | null> {
   return (await findFolderProblem(dir))?.detail ?? null
 }
 
@@ -118,7 +118,7 @@ function hashFile(filePath: string): Promise<string> {
     const stream = fs.createReadStream(filePath)
     stream.on('error', reject)
     stream.on('data', (chunk) => hash.update(chunk))
-    stream.on('end', () => resolve(hash.digest('hex')))
+    stream.on('end', () => { resolve(hash.digest('hex')) })
   })
 }
 
@@ -174,8 +174,8 @@ function dropPageCache(dir: string): Promise<void> {
         'for f do dd if="$f" iflag=nocache count=0 status=none; done', 'sh', '{}', '+'],
       { stdio: 'ignore' }
     )
-    child.on('error', () => resolve())
-    child.on('close', () => resolve())
+    child.on('error', () => { resolve() })
+    child.on('close', () => { resolve() })
   })
 }
 
@@ -276,8 +276,7 @@ export async function recoverInterruptedCopies(root: string): Promise<void> {
     return
   }
   for (const name of names) {
-    await recoverInterruptedCopy(path.join(root, name)).catch((err) =>
-      console.error(`[Backup] Could not recover ${name} in ${root}:`, err)
+    await recoverInterruptedCopy(path.join(root, name)).catch((err: unknown) => { console.error(`[Backup] Could not recover ${name} in ${root}:`, err) }
     )
   }
 }

+ 74 - 2
src/main/services/config.service.ts

@@ -8,6 +8,7 @@ import { normalizeCardBorders, type CardBorders } from '@shared/cardBorders'
 import { normalizeCardBadges, type CardBadges } from '@shared/cardBadges'
 import { normalizeLanguagePreference, type LanguagePreference } from '@shared/i18n'
 import { normalizeUpdateChecks } from '@shared/updates'
+import { DEFAULT_LOADER, normalizeLoader } from '@shared/loader'
 import type {
   DisplayMode,
   EngineFlagPreset,
@@ -16,6 +17,7 @@ import type {
   SplitScreen,
   SteamIdentity,
   LedSettings,
+  LoaderSettings,
   UpdateChecks,
   UpdateTarget
 } from '@shared/types'
@@ -35,6 +37,7 @@ interface AppConfig {
   autostartMinimized: boolean
   autostartPlaylistId: string | null
   killLweOnQuit: boolean
+  skipPlaylistResume: boolean
   /** Legacy, only read to migrate into cardBorders */
   voteBorders: boolean
   cardBorders: CardBorders | null
@@ -48,6 +51,7 @@ interface AppConfig {
   disablePuppetAnimation: boolean
   scriptLimits: boolean
   leds: LedSettings
+  loader: LoaderSettings
   disableAnimations: boolean
   steamIdentity: SteamIdentity
   /** steamId64s hidden from browsing */
@@ -66,6 +70,8 @@ interface AppConfig {
   dismissedUpdates: Partial<Record<UpdateTarget, string>>
 }
 
+export const DEFAULT_DISPLAY_MODE: DisplayMode = 'shared'
+
 const store = openStore<AppConfig>({
   name: 'config',
   defaults: {
@@ -84,6 +90,7 @@ const store = openStore<AppConfig>({
     autostartMinimized: false,
     autostartPlaylistId: null,
     killLweOnQuit: false,
+    skipPlaylistResume: false,
     voteBorders: true,
     cardBorders: null,
     cardBadges: null,
@@ -93,12 +100,13 @@ const store = openStore<AppConfig>({
     disablePuppetAnimation: false,
     scriptLimits: false,
     leds: { enabled: false, server: '127.0.0.1:6742', brightness: 100, boost: true, reduceFps: false },
+    loader: DEFAULT_LOADER,
     disableAnimations: false,
     steamIdentity: 'wallpaper-engine',
     ignoredCreators: [],
     engineFlags: {},
     engineFlagPresets: [],
-    displayMode: 'shared',
+    displayMode: DEFAULT_DISPLAY_MODE,
     disabledScreens: [],
     splitScreens: {},
     appearance: normalizeAppearance(undefined),
@@ -187,6 +195,14 @@ export function setKillLweOnQuit(enabled: boolean): void {
   store.set('killLweOnQuit', enabled)
 }
 
+export function getSkipPlaylistResume(): boolean {
+  return store.get('skipPlaylistResume')
+}
+
+export function setSkipPlaylistResume(enabled: boolean): void {
+  store.set('skipPlaylistResume', enabled)
+}
+
 export function getAppearance(): Appearance {
   return normalizeAppearance(store.get('appearance'))
 }
@@ -330,6 +346,14 @@ export function setLeds(leds: LedSettings): void {
   store.set('leds', leds)
 }
 
+export function getLoader(): LoaderSettings {
+  return normalizeLoader(store.get('loader'))
+}
+
+export function setLoader(loader: LoaderSettings): void {
+  store.set('loader', normalizeLoader(loader))
+}
+
 export function getDisableAnimations(): boolean {
   return store.get('disableAnimations')
 }
@@ -352,6 +376,54 @@ export function setEngineFlagPresets(presets: EngineFlagPreset[]): void {
   store.set('engineFlagPresets', presets.filter((p) => !p.builtIn))
 }
 
+const RESETS_WITH_ENGINE_SETTINGS: Record<keyof AppConfig, boolean> = {
+  workshopPath: false,
+  extraLibraryPaths: false,
+  defaultFps: true,
+  lweRepoUrl: false,
+  lweRepoBranch: false,
+  lweCmakeArgs: false,
+  backupPath: false,
+  autoUnsubscribeAfterBackup: false,
+  trayEnabled: false,
+  autostartEnabled: false,
+  autostartMinimized: false,
+  autostartPlaylistId: false,
+  killLweOnQuit: false,
+  skipPlaylistResume: false,
+  voteBorders: false,
+  cardBorders: false,
+  cardBadges: false,
+  recommendedFpsEnabled: true,
+  recommendedWebFpsEnabled: true,
+  audioScreen: true,
+  ambientVolume: true,
+  defaultAudioSensitivity: true,
+  disablePuppetAnimation: true,
+  scriptLimits: true,
+  leds: true,
+  loader: true,
+  disableAnimations: true,
+  steamIdentity: false,
+  ignoredCreators: false,
+  engineFlags: true,
+  engineFlagPresets: false,
+  displayMode: true,
+  disabledScreens: true,
+  splitScreens: true,
+  appearance: false,
+  language: false,
+  updateChecks: false,
+  dismissedUpdates: false
+}
+
+export function resetEngineSettings(): void {
+  const keys = (Object.keys(RESETS_WITH_ENGINE_SETTINGS) as (keyof AppConfig)[]).filter(
+    (key) => RESETS_WITH_ENGINE_SETTINGS[key]
+  )
+  store.reset(...keys)
+}
+
 export function getDisplayMode(): DisplayMode {
   return store.get('displayMode')
 }
@@ -411,7 +483,7 @@ export function setLweCmakeArgs(args: string | null): void {
   store.set('lweCmakeArgs', args?.trim() || null)
 }
 
-export function getWeConfigPath(): string {
+function getWeConfigPath(): string {
   return path.join(app.getPath('userData'), 'we-config.json')
 }
 

+ 3 - 5
src/main/services/dependency.service.ts

@@ -14,15 +14,13 @@ export function setDependencyInstaller(fn: DependencyInstaller): void {
   installer = fn
 }
 
-export function getMissingDependency(wallpaper: WallpaperMeta): string | null {
+function getMissingDependency(wallpaper: WallpaperMeta): string | null {
   if (!wallpaper.localPath) return null
 
   try {
-    const project = JSON.parse(fs.readFileSync(path.join(wallpaper.localPath, 'project.json'), 'utf8'))
+    const project = JSON.parse(fs.readFileSync(path.join(wallpaper.localPath, 'project.json'), 'utf8')) as { dependency?: unknown } | null
     const dependency = project?.dependency
-    if (dependency === undefined || dependency === null || dependency === '') return null
-
-    const dependencyId = String(dependency)
+    const dependencyId = typeof dependency === 'string' || typeof dependency === 'number' ? String(dependency) : ''
     if (!/^\d+$/.test(dependencyId)) return null
 
     const baseDir = path.join(path.dirname(path.resolve(wallpaper.localPath)), dependencyId)

+ 11 - 0
src/main/services/desktop-icons-overlay.py

@@ -9,6 +9,7 @@ wl_region), clicks go to the desktop underneath.
 Launch with: LD_PRELOAD=<libgtk4-layer-shell.so.0> GDK_BACKEND=wayland python3 this.py [CONNECTOR]
 Exit codes: 2 a Python module or typelib is missing, 3 no layer-shell, 4 no monitor, 5 monitors plugged or unplugged
 (the caller starts the overlays again, one per monitor)
+The overlay quits by itself when its parent process goes away (we_manager crashed or was killed)
 """
 
 import configparser
@@ -16,6 +17,7 @@ import json
 import locale
 import os
 import shutil
+import signal
 import subprocess
 import sys
 import urllib.parse
@@ -449,6 +451,12 @@ def main():
 
         state['rebuild'] = GLib.timeout_add(300, run)
 
+    def watch_parent():
+        if os.getppid() != parent:
+            app.quit()
+            return False
+        return True
+
     def on_monitors_changed(*_):
         if not state['leaving']:
             state['leaving'] = True
@@ -524,6 +532,9 @@ def main():
         monitors.connect('items-changed', on_monitors_changed)
 
     window = None
+    parent = os.getppid()
+    GLib.timeout_add_seconds(1, watch_parent)
+    GLib.unix_signal_add(GLib.PRIORITY_DEFAULT, signal.SIGTERM, lambda: app.quit() or False)
     app = Gtk.Application(application_id=f'com.wemanager.desktop-icons-overlay.screen{index}')
     app.connect('activate', on_activate)
     app.run(None)

+ 5 - 5
src/main/services/desktop-icons.service.ts

@@ -117,8 +117,8 @@ export function installDesktopIconsDependencies(): Promise<{ ok: boolean; error?
       if (err) {
         // 126 and 127 are pkexec's dismissed and not-authorized codes
         const code = (err as { code?: number }).code
-        if (code === 126 || code === 127) return resolve({ ok: false, error: 'cancelled' })
-        return resolve({ ok: false, error: stderr.trim().split('\n').slice(-4).join('\n') || err.message })
+        if (code === 126 || code === 127) { resolve({ ok: false, error: 'cancelled' }); return; }
+        resolve({ ok: false, error: stderr.trim().split('\n').slice(-4).join('\n') || err.message }); return;
       }
       startFailure = null
       if (getDesktopIconsEnabled()) startDesktopIconsOverlay()
@@ -229,7 +229,7 @@ export function getDesktopIconsStatus(): DesktopIconsStatus {
   return { enabled }
 }
 
-export function startDesktopIconsOverlay(): void {
+function startDesktopIconsOverlay(): void {
   stopDesktopIconsOverlay()
   startFailure = null
 
@@ -296,7 +296,7 @@ export function startDesktopIconsOverlay(): void {
   console.log(`[DesktopIcons] Started ${targets.length} overlay(s)`)
 }
 
-export function stopDesktopIconsOverlay(): void {
+function stopDesktopIconsOverlay(): void {
   for (const child of overlayProcesses) {
     try {
       child.kill('SIGTERM')
@@ -317,7 +317,7 @@ export function setDesktopIconsEnabled(enabled: boolean): void {
 }
 
 /** The engine and the overlay share the bottom layer and the later surface is drawn on top, so the overlay has to map after the wallpaper */
-export function raiseDesktopIconsOverlay(): void {
+function raiseDesktopIconsOverlay(): void {
   if (getDesktopIconsEnabled()) startDesktopIconsOverlay()
 }
 

+ 3 - 5
src/main/services/display.service.ts

@@ -251,8 +251,7 @@ async function handleExit(info: LweExitInfo): Promise<void> {
 
     if (!(await relaunchFresh(wallpaper, info.screen))) return
     notifyCrash(wallpaper, info.screen, 'hotswap', t('crash.hotswapTesting'))
-    watchLaunch(wallpaper.id, info.screen, () =>
-      notifyCrash(wallpaper, info.screen, 'hotswap', t('crash.hotswapFreshWorks'))
+    watchLaunch(wallpaper.id, info.screen, () => { notifyCrash(wallpaper, info.screen, 'hotswap', t('crash.hotswapFreshWorks')) }
     )
     return
   }
@@ -292,8 +291,7 @@ export async function testFreshLaunch(wallpaperId: string, screen?: ScreenTarget
   await applyWallpaperMeta(wallpaper, { screen: target, forceFresh: true })
   setAssignment(target, wallpaper.id)
   send(IpcChannels.EVENT_DISPLAY_CHANGED)
-  watchLaunch(wallpaper.id, target, () =>
-    notifyCrash(getWallpaper(wallpaper.id) ?? wallpaper, target, 'launch', t('crash.testPassed'))
+  watchLaunch(wallpaper.id, target, () => { notifyCrash(getWallpaper(wallpaper.id) ?? wallpaper, target, 'launch', t('crash.testPassed')) }
   )
 }
 
@@ -307,6 +305,6 @@ export async function resetDisplays(): Promise<void> {
 export function initDisplay(window: BrowserWindow): void {
   win = window
   onLweExit((info) => {
-    void handleExit(info).catch((err) => console.error('[Display] Crash handling failed:', err))
+    void handleExit(info).catch((err: unknown) => { console.error('[Display] Crash handling failed:', err) })
   })
 }

+ 1 - 1
src/main/services/fonts.service.ts

@@ -15,7 +15,7 @@ export function userFontDir(): string {
   return path.join(dataHome, 'linux-wallpaperengine', 'fonts')
 }
 
-export function isFontFile(file: string): boolean {
+function isFontFile(file: string): boolean {
   return FONT_EXTENSIONS.has(path.extname(file).toLowerCase())
 }
 

+ 8 - 7
src/main/services/gnome-extension.service.ts

@@ -12,7 +12,7 @@ import { t } from '../i18n'
 const execFileAsync = promisify(execFile)
 
 /** GNOME has no layer-shell, the engine's extension makes desktop windows. A fresh install needs a re-login */
-export const GNOME_EXTENSION_UUID = 'linux-wallpaperengine@wallpaperenginelover.github.io'
+const GNOME_EXTENSION_UUID = 'linux-wallpaperengine@wallpaperenginelover.github.io'
 const GNOME_HELPER = 'linux-wallpaperengine-gnome-helper'
 
 function userExtensionDir(): string {
@@ -21,7 +21,7 @@ function userExtensionDir(): string {
   return path.join(dataHome, 'gnome-shell', 'extensions', GNOME_EXTENSION_UUID)
 }
 
-export function bundledExtensionDir(enginePath = getLweStatus().path): string | undefined {
+function bundledExtensionDir(enginePath = getLweStatus().path): string | undefined {
   if (!enginePath) return undefined
   let real = enginePath
   try { real = fs.realpathSync(enginePath) } catch { }
@@ -31,8 +31,9 @@ export function bundledExtensionDir(enginePath = getLweStatus().path): string |
 
 function readVersion(dir: string): string | undefined {
   try {
-    const metadata = JSON.parse(fs.readFileSync(path.join(dir, 'metadata.json'), 'utf8'))
-    return metadata['version-name'] !== undefined ? String(metadata['version-name']) : undefined
+    const metadata = JSON.parse(fs.readFileSync(path.join(dir, 'metadata.json'), 'utf8')) as Record<string, unknown>
+    const version = metadata['version-name']
+    return typeof version === 'string' || typeof version === 'number' ? String(version) : undefined
   } catch {
     return undefined
   }
@@ -54,7 +55,7 @@ async function runHost(cmd: string, args: string[]): Promise<{ ok: boolean; out:
   }
 }
 
-export function isGnomeWayland(): boolean {
+function isGnomeWayland(): boolean {
   return detectDesktopEnv() === 'gnome' && isWaylandSession()
 }
 
@@ -94,9 +95,9 @@ export function flatpakInstallCommands(hostDir: string): string[] {
   ]
 }
 
-async function flatpakDetails(bundled: string | undefined): Promise<Partial<GnomeExtensionStatus>> {
+function flatpakDetails(bundled: string | undefined): Promise<Partial<GnomeExtensionStatus>> {
   const hostDir = bundled ? toHostPath(bundled) : undefined
-  return hostDir ? { flatpakCommands: flatpakInstallCommands(hostDir) } : {}
+  return Promise.resolve(hostDir ? { flatpakCommands: flatpakInstallCommands(hostDir) } : {})
 }
 
 export async function installGnomeExtension(): Promise<{ ok: boolean; message: string; status: GnomeExtensionStatus }> {

+ 1 - 1
src/main/services/library-transfer.service.test.ts

@@ -63,7 +63,7 @@ beforeEach(() => {
   unsubscribe.mockClear()
 })
 
-afterEach(() => fs.rmSync(tmp, { recursive: true, force: true }))
+afterEach(() => { fs.rmSync(tmp, { recursive: true, force: true }) })
 
 describe('transferWallpapers', () => {
   it('copies without touching the entry or the original', async () => {

+ 24 - 25
src/main/services/library.service.ts

@@ -303,7 +303,7 @@ async function safeGetWorkshopDetails(ids: string[]): Promise<Map<string, Worksh
   }
 }
 
-export function getDirSize(dirPath: string): number {
+function getDirSize(dirPath: string): number {
   let total = 0
   try {
     for (const entry of fs.readdirSync(dirPath, { withFileTypes: true })) {
@@ -784,7 +784,7 @@ export function queueHdrCheck(): void {
 }
 
 // HDR and HRTF share one scene read
-export async function backfillHdr(): Promise<boolean> {
+async function backfillHdr(): Promise<boolean> {
   if (hdrPassRunning) {
     hdrPassQueued = true
     return false
@@ -921,43 +921,42 @@ export function cleanupFolders(): number {
 }
 
 export function importWEConfig(configPath: string): { folders: number; playlists: number } {
-  const raw = fs.readFileSync(configPath, 'utf8')
-  const data = JSON.parse(raw)
+  const data: unknown = JSON.parse(fs.readFileSync(configPath, 'utf8'))
+  const asRecord = (v: unknown): Record<string, unknown> | null => (v && typeof v === 'object' && !Array.isArray(v) ? (v as Record<string, unknown>) : null)
+  const asRecords = (v: unknown): Record<string, unknown>[] => (Array.isArray(v) ? v.map(asRecord).filter((r) => r !== null) : [])
 
   const imported: WallpaperFolder[] = []
   const existingTitles = new Set(store.get('folders').map((f) => f.title))
 
   // the profile with the most folders, usually '~'
-  let bestProfile: { folders: any[]; playlists: any[] } = { folders: [], playlists: [] }
-  for (const key of Object.keys(data)) {
-    const val = data[key]
-    if (!val || typeof val !== 'object') continue
-    const general = val.general
-    if (!general || typeof general !== 'object') continue
-    const browser = general.browser
-    const folders = browser?.folders ?? []
-    const playlists = general.playlists ?? []
-    const total = folders.length + playlists.length
-    if (total > bestProfile.folders.length + bestProfile.playlists.length) {
-      bestProfile = { folders, playlists }
+  let bestFolders: Record<string, unknown>[] = []
+  let bestPlaylists: Record<string, unknown>[] = []
+  for (const profile of Object.values(asRecord(data) ?? {})) {
+    const general = asRecord(asRecord(profile)?.general)
+    if (!general) continue
+    const folders = asRecords(asRecord(general.browser)?.folders)
+    const playlists = asRecords(general.playlists)
+    if (folders.length + playlists.length > bestFolders.length + bestPlaylists.length) {
+      bestFolders = folders
+      bestPlaylists = playlists
     }
   }
 
-  for (const f of bestProfile.folders) {
-    const title = f.title ?? 'Untitled'
+  for (const f of bestFolders) {
+    const title = typeof f.title === 'string' ? f.title : 'Untitled'
     if (existingTitles.has(title)) continue
-    const items = Object.keys(f.items ?? {}).filter((k) => /^\d+$/.test(k))
+    const items = Object.keys(asRecord(f.items) ?? {}).filter((k) => /^\d+$/.test(k))
     imported.push({ id: randomUUID(), title, items })
     existingTitles.add(title)
   }
 
   // playlist items are full file paths
-  for (const p of bestProfile.playlists) {
-    const title = p.name ?? 'Untitled Playlist'
+  for (const p of bestPlaylists) {
+    const title = typeof p.name === 'string' ? p.name : 'Untitled Playlist'
     if (existingTitles.has(title)) continue
     const items: string[] = []
-    for (const filePath of p.items ?? []) {
-      const match = filePath.match(/\/431960\/(\d+)\//)
+    for (const filePath of Array.isArray(p.items) ? p.items : []) {
+      const match = typeof filePath === 'string' ? /\/431960\/(\d+)\//.exec(filePath) : null
       if (match) items.push(match[1])
     }
     if (items.length > 0) {
@@ -972,8 +971,8 @@ export function importWEConfig(configPath: string): { folders: number; playlists
     store.set('folders', folders)
   }
 
-  const fCount = bestProfile.folders.length
-  const pCount = bestProfile.playlists.length
+  const fCount = bestFolders.length
+  const pCount = bestPlaylists.length
   console.log(`[Library] WE config imported: ${imported.length} folders/playlists from ${fCount} folders + ${pCount} playlists`)
   return { folders: fCount, playlists: pCount }
 }

+ 20 - 1
src/main/services/lwe.service.test.ts

@@ -6,6 +6,8 @@ vi.mock('../utils/platform', async (importOriginal) => ({
   getScreenGeometry: () => '1920x0x2560x1440',
   getConnectedScreens: () => ['DP-1']
 }))
+const loaderSettings = { textures: true, shaders: true, threads: 0 }
+
 vi.mock('./config.service', () => ({
   getConfiguredWorkshopPath: () => null,
   getLweRepoUrl: () => null,
@@ -15,11 +17,14 @@ vi.mock('./config.service', () => ({
   getAmbientVolume: () => null,
   getLeds: () => ({ enabled: false, server: '127.0.0.1:6742', brightness: 100, boost: true, reduceFps: false }),
   getDefaultAudioSensitivity: () => 1,
-  getDisablePuppetAnimation: () => false
+  getDisablePuppetAnimation: () => false,
+  getScriptLimits: () => false,
+  getLoader: () => loaderSettings
 }))
 
 const {
   buildCleanBuildEnv,
+  buildLweEnvVars,
   buildHotswapLines,
   buildLweArgs,
   lwePackageOwner,
@@ -29,6 +34,20 @@ const {
   parseOsReleaseIds
 } = await import('./lwe.service')
 
+const loaderVars = () => buildLweEnvVars().filter((v) => /^LWE_(NO_|PREFETCH)/.test(v))
+
+describe('buildLweEnvVars loader settings', () => {
+  it('sets nothing by default', () => {
+    Object.assign(loaderSettings, { textures: true, shaders: true, threads: 0 })
+    expect(loaderVars()).toEqual([])
+  })
+
+  it('turns the prefetches off and passes the thread count', () => {
+    Object.assign(loaderSettings, { textures: false, shaders: false, threads: 4 })
+    expect(loaderVars()).toEqual(['LWE_NO_TEXTURE_PREFETCH=1', 'LWE_NO_SHADER_WARM=1', 'LWE_PREFETCH_THREADS=4'])
+  })
+})
+
 describe('parseCustomArgs', () => {
   it('splits on whitespace and keeps quoted values together', () => {
     expect(parseCustomArgs(`--render-debug skip-effect=726  --set-property foo="bar baz" --x 'a b'`)).toEqual([

+ 61 - 115
src/main/services/lwe.service.ts

@@ -10,6 +10,7 @@ import type {
   LweStatus,
   LweInstallProgress,
   LinuxDistro,
+  HotswapSettings,
   LweSceneObject,
   LweProperty,
   LweAudioObject,
@@ -58,6 +59,7 @@ import {
   getAudioScreen,
   getAmbientVolume,
   getLeds,
+  getLoader,
   getDefaultAudioSensitivity,
   getDisablePuppetAnimation,
   getScriptLimits,
@@ -78,6 +80,13 @@ const APPIMAGE_MOUNT = /^\/tmp\/\.mount_[^/]+(\/|$)/
 
 const DEFAULT_LED_SERVER = '127.0.0.1:6742'
 
+const LOCAL_SOURCE_EXCLUDES = [
+  '/.git', '/build', '/build-*', '/cmake-build-*', '/.cache', '/result', '/result-*', '/.idea', '/.vscode', '/.zed',
+  '__pycache__'
+]
+const tarExclude = (pattern: string): string =>
+  `--exclude=${pattern.startsWith('/') ? `.${pattern}` : pattern}`
+
 function validLedServer(value: string): string {
   const server = value.trim()
   const match = /^([^\s:]+)(?::(\d{1,5}))?$/.exec(server)
@@ -185,7 +194,7 @@ function findLweBinary(): string | undefined {
 
 export function readPrebuiltRelease(): { tag: string; asset: string } | undefined {
   try {
-    return JSON.parse(fs.readFileSync(path.join(getLwePrebuiltDir(), '.release'), 'utf8'))
+    return JSON.parse(fs.readFileSync(path.join(getLwePrebuiltDir(), '.release'), 'utf8')) as { tag: string; asset: string }
   } catch {
     return undefined
   }
@@ -339,7 +348,7 @@ const DEPS_SUSE = [
  * Tumbleweed carries several FFmpeg versions side by side. The engine has to link the one libmpv uses, two FFmpeg
  * ABIs in one process resolve each other's symbols. Needs mpv-devel installed (it pulls libmpv2); null if unreadable.
  */
-export function suseFfmpegDevel(): string[] | null {
+function suseFfmpegDevel(): string[] | null {
   try {
     const requires = execFileSync('rpm', ['-q', '--requires', 'libmpv2'], { encoding: 'utf8', timeout: 10_000 })
     const soname = /libavcodec\.so\.\d+/.exec(requires)?.[0]
@@ -546,16 +555,19 @@ export async function installLwe(win: BrowserWindow): Promise<void> {
       // copy the working tree so uncommitted edits are built
       send({ stage: 'cloning', message: t('lwe.copyingSource', { repo }), percentage: 5 })
       if (isCommandAvailable('rsync')) {
-        // --no-times: old source mtimes could make make skip a changed file in a reused dir
+        // --no-times: old source mtimes could make make skip a changed file in a reused dir. --checksum: without it
+        // every file differs in mtime from its copy and is transferred again, which made every file newer than its
+        // object. Now only the files whose content changed are written (and get a fresh mtime), the rest stays old
         await execFileAsync('rsync', [
-          '-a', '--no-times', '--delete', '--exclude=/.git', '--exclude=/build',
+          '-a', '--no-times', '--checksum', '--delete', ...LOCAL_SOURCE_EXCLUDES.map((e) => `--exclude=${e}`),
           `${repo}/`, `${BUILD_DIR}/`
         ], { timeout: 120_000, maxBuffer: 10 * 1024 * 1024 })
       } else {
         // -m, same reason as --no-times
         await execFileAsync('bash', [
           '-c',
-          `tar -C ${JSON.stringify(repo)} --exclude=.git --exclude=build -cf - . | tar -C ${JSON.stringify(BUILD_DIR)} -xmf -`
+          'tar -C "$1" "${@:3}" -cf - . | tar -C "$2" -xmf -',
+          'bash', repo, BUILD_DIR, ...LOCAL_SOURCE_EXCLUDES.map(tarExclude)
         ], { timeout: 120_000, maxBuffer: 10 * 1024 * 1024 })
       }
       fs.writeFileSync(sourceMarker, repo, 'utf8')
@@ -602,8 +614,15 @@ export async function installLwe(win: BrowserWindow): Promise<void> {
       encoding: 'utf8'
     })
 
-    // make's mtime check shipped a stale binary once; keeps the CEF SDK
-    if (canReuseBuildCache) {
+    // the copy above only touches files whose content changed, so make's mtime check is right for them. Everything
+    // else a reused build dir depends on (the cmake options, the compiler) is tied to a signature: when it changes
+    // the objects are thrown away (the CEF SDK stays)
+    const buildSignature = JSON.stringify([getLweCmakeArgs() ?? '', buildEnv.CC ?? '', buildEnv.CXX ?? '', process.arch])
+    const signatureFile = path.join(cmakeBuild, '.lwe-build-signature')
+    const previousSignature = (() => {
+      try { return fs.readFileSync(signatureFile, 'utf8') } catch { return null }
+    })()
+    if (canReuseBuildCache && previousSignature !== buildSignature) {
       await execFileAsync('make', ['clean'], {
         cwd: cmakeBuild,
         env: buildEnv,
@@ -612,6 +631,7 @@ export async function installLwe(win: BrowserWindow): Promise<void> {
         encoding: 'utf8'
       }).catch(() => { })
     }
+    fs.writeFileSync(signatureFile, buildSignature, 'utf8')
 
     send({ stage: 'building', message: t('lwe.compiling'), percentage: 40 })
     const cores = Math.max(1, os.cpus().length - 1)
@@ -840,7 +860,7 @@ function getLweBinaryPath(): string {
   }
 }
 
-function buildLweEnvVars(): string[] {
+export function buildLweEnvVars(): string[] {
   const vars: string[] = []
   // a Nix build brings its own libraries
   const fromNix = getLweBinaryPath().startsWith('/nix/store/')
@@ -874,6 +894,11 @@ function buildLweEnvVars(): string[] {
 
   if (getScriptLimits()) vars.push('LWE_SCRIPT_TIMEOUT_MS=5000', 'LWE_SCRIPT_HEAP_MB=512', 'LWE_SCRIPT_BUFFER_MB=512')
 
+  const loader = getLoader()
+  if (!loader.textures) vars.push('LWE_NO_TEXTURE_PREFETCH=1')
+  if (!loader.shaders) vars.push('LWE_NO_SHADER_WARM=1')
+  if (loader.threads > 0) vars.push(`LWE_PREFETCH_THREADS=${loader.threads}`)
+
   return vars
 }
 
@@ -1540,6 +1565,11 @@ function launchKey(options: LweLaunchOptions): string {
     disabledEffects: supportsEffectHotswap() ? [] : (options.disabledEffects ?? []),
     enabledEffects: supportsEffectHotswap() ? [] : (options.enabledEffects ?? []),
     disableAnimations: supportsAnimationHotswap() ? false : !!flags.disableAnimations,
+    // read when the process starts, a hotswap can't change them
+    scriptLimits: getScriptLimits(),
+    loader: getLoader(),
+    leds: getLeds(),
+    disablePuppetAnimation: getDisablePuppetAnimation(),
     flags: engineFlagArgs({
       ...flags,
       ...(supportsHwdecHotswap() ? { hwdec: undefined } : {}),
@@ -1550,34 +1580,9 @@ function launchKey(options: LweLaunchOptions): string {
   })
 }
 
-export interface HotswapOptions {
+export interface HotswapOptions extends HotswapSettings {
   path?: string
-  disabledObjects?: string[]
-  enabledObjects?: string[]
-  volume?: number
   fps?: number
-  xray?: XrayMode
-  scaling?: string
-  zoom?: number
-  offsetX?: number
-  offsetY?: number
-  disableParallax?: boolean
-  expandCanvas?: boolean
-  repairAssets?: boolean
-  cornerColor?: string
-  imageAdjustments?: ImageAdjustments
-  speed?: number
-  videoSegments?: VideoSegment[]
-  /** Video seek in seconds */
-  videoSeek?: number
-  propertyOverrides?: Record<string, string>
-  /** Empty string = every screen can produce audio */
-  audioScreen?: string
-  ambientVolume?: number
-  /** Object id or "*" -> multiplier */
-  audioSensitivity?: Record<string, number>
-  /** Sound object id -> volume (0-1) */
-  soundVolume?: Record<string, number>
   /** Either being present replaces the engine's effect lists */
   disabledEffects?: string[]
   enabledEffects?: string[]
@@ -1907,33 +1912,41 @@ function parseLweObjectList(output: string): LweSceneObject[] {
   return objects
 }
 
-export async function listLweObjects(wallpaperPath: string): Promise<LweSceneObject[]> {
+async function runLweList<T>(
+  wallpaperPath: string,
+  flag: string,
+  supported: (() => boolean) | null,
+  parse: (output: string) => T[],
+  label: string
+): Promise<T[]> {
   const status = getLweStatus()
   if (!status.installed) throw new Error('linux-wallpaperengine is not installed.')
   // older builds ignore unknown flags and render instead of exiting
-  if (!supportsObjectFlags()) return []
+  if (supported && !supported()) return []
 
-  const binaryPath = getLweBinaryPath()
-  const args = ['--list-objects']
+  const args = [flag]
   const assetsDir = findWeAssetsDir()
   if (assetsDir) args.push('--assets-dir', assetsDir)
   args.push(wallpaperPath)
 
-  const envVars = buildLweEnvVars()
   try {
-    const { stdout } = await execFileAsync('env', [...envVars, binaryPath, ...args], {
+    const { stdout } = await execFileAsync('env', [...buildLweEnvVars(), getLweBinaryPath(), ...args], {
       timeout: 15_000,
       maxBuffer: 5 * 1024 * 1024,
       encoding: 'utf8'
     })
-    return parseLweObjectList(stdout)
+    return parse(stdout)
   } catch (err) {
     const e = err as Error & { stdout?: string; stderr?: string }
     const msg = (e.stderr || e.stdout || e.message || String(err)).trim().split('\n').slice(0, 3).join('\n')
-    throw new Error(`Failed to list wallpaper objects: ${msg}`, { cause: err })
+    throw new Error(`Failed to list ${label}: ${msg}`, { cause: err })
   }
 }
 
+export function listLweObjects(wallpaperPath: string): Promise<LweSceneObject[]> {
+  return runLweList(wallpaperPath, '--list-objects', () => supportsObjectFlags(), parseLweObjectList, 'wallpaper objects')
+}
+
 export async function listLweFonts(wallpaperPath: string): Promise<LweFontNeed[]> {
   const status = getLweStatus()
   if (!status.installed) return []
@@ -1965,31 +1978,8 @@ function parseLweEffectList(output: string): LweSceneEffect[] {
   return effects
 }
 
-export async function listLweEffects(wallpaperPath: string): Promise<LweSceneEffect[]> {
-  const status = getLweStatus()
-  if (!status.installed) throw new Error('linux-wallpaperengine is not installed.')
-  // older builds ignore unknown flags and render the wallpaper instead of exiting
-  if (!supportsEffectFlags()) return []
-
-  const binaryPath = getLweBinaryPath()
-  const args = ['--list-effects']
-  const assetsDir = findWeAssetsDir()
-  if (assetsDir) args.push('--assets-dir', assetsDir)
-  args.push(wallpaperPath)
-
-  const envVars = buildLweEnvVars()
-  try {
-    const { stdout } = await execFileAsync('env', [...envVars, binaryPath, ...args], {
-      timeout: 15_000,
-      maxBuffer: 5 * 1024 * 1024,
-      encoding: 'utf8'
-    })
-    return parseLweEffectList(stdout)
-  } catch (err) {
-    const e = err as Error & { stdout?: string; stderr?: string }
-    const msg = (e.stderr || e.stdout || e.message || String(err)).trim().split('\n').slice(0, 3).join('\n')
-    throw new Error(`Failed to list wallpaper effects: ${msg}`, { cause: err })
-  }
+export function listLweEffects(wallpaperPath: string): Promise<LweSceneEffect[]> {
+  return runLweList(wallpaperPath, '--list-effects', () => supportsEffectFlags(), parseLweEffectList, 'wallpaper effects')
 }
 
 // "  24 - transbig (scale): minvalue=0.9 maxvalue=1.1 frequency=0 smoothing=10"
@@ -2015,31 +2005,8 @@ function parseLweAudioObjectList(output: string): LweAudioObject[] {
   return objects
 }
 
-export async function listLweAudioObjects(wallpaperPath: string): Promise<LweAudioObject[]> {
-  const status = getLweStatus()
-  if (!status.installed) throw new Error('linux-wallpaperengine is not installed.')
-  // older builds ignore unknown flags and render instead of exiting
-  if (!supportsAudioSensitivity()) return []
-
-  const binaryPath = getLweBinaryPath()
-  const args = ['--list-audio-objects']
-  const assetsDir = findWeAssetsDir()
-  if (assetsDir) args.push('--assets-dir', assetsDir)
-  args.push(wallpaperPath)
-
-  const envVars = buildLweEnvVars()
-  try {
-    const { stdout } = await execFileAsync('env', [...envVars, binaryPath, ...args], {
-      timeout: 15_000,
-      maxBuffer: 5 * 1024 * 1024,
-      encoding: 'utf8'
-    })
-    return parseLweAudioObjectList(stdout)
-  } catch (err) {
-    const e = err as Error & { stdout?: string; stderr?: string }
-    const msg = (e.stderr || e.stdout || e.message || String(err)).trim().split('\n').slice(0, 3).join('\n')
-    throw new Error(`Failed to list audio-reactive objects: ${msg}`, { cause: err })
-  }
+export function listLweAudioObjects(wallpaperPath: string): Promise<LweAudioObject[]> {
+  return runLweList(wallpaperPath, '--list-audio-objects', () => supportsAudioSensitivity(), parseLweAudioObjectList, 'audio-reactive objects')
 }
 
 // --list-properties output:
@@ -2090,29 +2057,8 @@ function parseLweProperties(output: string): LweProperty[] {
   return properties
 }
 
-export async function listLweProperties(wallpaperPath: string): Promise<LweProperty[]> {
-  const status = getLweStatus()
-  if (!status.installed) throw new Error('linux-wallpaperengine is not installed.')
-
-  const binaryPath = getLweBinaryPath()
-  const args = ['--list-properties']
-  const assetsDir = findWeAssetsDir()
-  if (assetsDir) args.push('--assets-dir', assetsDir)
-  args.push(wallpaperPath)
-
-  const envVars = buildLweEnvVars()
-  try {
-    const { stdout } = await execFileAsync('env', [...envVars, binaryPath, ...args], {
-      timeout: 15_000,
-      maxBuffer: 5 * 1024 * 1024,
-      encoding: 'utf8'
-    })
-    return parseLweProperties(stdout)
-  } catch (err) {
-    const e = err as Error & { stdout?: string; stderr?: string }
-    const msg = (e.stderr || e.stdout || e.message || String(err)).trim().split('\n').slice(0, 3).join('\n')
-    throw new Error(`Failed to list wallpaper properties: ${msg}`, { cause: err })
-  }
+export function listLweProperties(wallpaperPath: string): Promise<LweProperty[]> {
+  return runLweList(wallpaperPath, '--list-properties', null, parseLweProperties, 'wallpaper properties')
 }
 
 type EngineProcess = Pick<LweInstance, 'pid' | 'sandbox' | 'hostPid'>

+ 2 - 6
src/main/services/playlist-player.service.ts

@@ -7,7 +7,7 @@ import { trimmedVideoLength, videoSegmentsOf } from '@shared/videoTrim'
 import { getPlaylist } from './playlist.service'
 import { getWallpaper, updateWallpaper } from './library.service'
 import { getLweStatus, ALL_SCREENS } from './lwe.service'
-import { getAutostartPlaylistId } from './config.service'
+import { getAutostartPlaylistId, getSkipPlaylistResume } from './config.service'
 import { getFavoriteItemIds } from './steam.service'
 import { expandScreen, getDisplayTargets, setBusyWallpaperSource, setPlaylistRecovery, showWallpaper } from './display.service'
 import { findWallpaperVideoFile, getVideoDurationSec } from '../utils/video'
@@ -375,10 +375,6 @@ export function getPlaybackState(): PlaylistPlaybackState {
   return states.find((s) => s.isPlaying) ?? states[0] ?? idleState(ALL_SCREENS)
 }
 
-export function isPlayingOn(screen: ScreenTarget): boolean {
-  return selectPlayers(screen).some((p) => p.state.isPlaying)
-}
-
 function savedPlayers(): Record<ScreenTarget, SavedPlayer> {
   const saved = store.get('players')
   if (saved) return saved
@@ -404,7 +400,7 @@ export function initPlaylistPlayer(window: BrowserWindow): boolean {
 
   let resumed = false
   const targets = getDisplayTargets()
-  for (const [screen, saved] of Object.entries(savedPlayers())) {
+  for (const [screen, saved] of Object.entries(getSkipPlaylistResume() ? {} : savedPlayers())) {
     const playlist = getPlaylist(saved.playlistId)
     if (!playlist || playlist.items.length === 0 || !targets.includes(screen)) continue
 

+ 1 - 1
src/main/services/schedule.service.ts

@@ -78,7 +78,7 @@ export async function runRule(rule: ScheduleRule): Promise<void> {
 // one after another, a later rule for a single screen has to land after an earlier one for all of them
 async function runAll(rules: ScheduleRule[]): Promise<void> {
   for (const rule of rules) {
-    await runRule(rule).catch((err) => console.error(`[Schedule] "${rule.name}" failed:`, err.message))
+    await runRule(rule).catch((err: unknown) => { console.error(`[Schedule] "${rule.name}" failed:`, err) })
   }
 }
 

+ 4 - 4
src/main/services/static-wallpaper.service.ts

@@ -14,7 +14,7 @@ export type CommandRunner = (cmd: string, args: string[]) => Promise<CommandResu
 export type DaemonStarter = (cmd: string, args: string[]) => ChildProcess | void
 
 /** never throws */
-export const runHostCommand: CommandRunner = async (cmd, args) => {
+const runHostCommand: CommandRunner = async (cmd, args) => {
   try {
     const { stdout, stderr } = await execFileAsync(...hostCommand(cmd, args), { timeout: 10000 })
     return { ok: true, output: `${stdout}${stderr}`.trim() }
@@ -24,7 +24,7 @@ export const runHostCommand: CommandRunner = async (cmd, args) => {
   }
 }
 
-export const startHostDaemon: DaemonStarter = (cmd, args) => {
+const startHostDaemon: DaemonStarter = (cmd, args) => {
   const [file, fileArgs] = hostCommand(cmd, args)
   const child = spawn(file, fileArgs, { detached: true, stdio: 'ignore' })
   child.on('error', () => {})
@@ -99,7 +99,7 @@ export async function applySwaybg(imagePath: string, start: DaemonStarter = star
   if (!child) return
 
   const exitCode = await new Promise<number | null | undefined>((resolve) => {
-    const timer = setTimeout(() => resolve(undefined), 700)
+    const timer = setTimeout(() => { resolve(undefined) }, 700)
     child.once('exit', (code) => {
       clearTimeout(timer)
       resolve(code)
@@ -127,7 +127,7 @@ export function hasHyprpaper(has: (cmd: string) => boolean = isHostCommandAvaila
   return has('hyprpaper') && has('hyprctl')
 }
 
-export function isHostProcessRunning(name: string): boolean {
+function isHostProcessRunning(name: string): boolean {
   try {
     execFileSync(...hostCommand('pgrep', ['-x', name]), { stdio: 'ignore', timeout: 5000 })
     return true

+ 1 - 1
src/main/services/steam-list-cache.test.ts

@@ -36,7 +36,7 @@ function source(lists: string[][], accountIds: number[] = [1]): ListSource & { s
 async function sync(cache: SteamListCache): Promise<void> {
   ;(cache as unknown as { store: { set: (k: string, v: number) => void } }).store.set('lastFullSync', 0)
   cache.maybeSync()
-  await vi.waitFor(() => expect((cache as unknown as { syncInFlight: boolean }).syncInFlight).toBe(false))
+  await vi.waitFor(() => { expect((cache as unknown as { syncInFlight: boolean }).syncInFlight).toBe(false) })
 }
 
 describe('SteamListCache', () => {

+ 6 - 6
src/main/services/steam-list-cache.ts

@@ -67,7 +67,7 @@ export class SteamListCache {
     this.pending = new Map(
       Object.entries(this.store.get('pending')).filter(([, v]) => Date.now() - v.at <= PENDING_TTL_MS)
     )
-    app.on('will-quit', () => this.flush())
+    app.on('will-quit', () => { this.flush() })
   }
 
   has(id: string): boolean {
@@ -141,7 +141,7 @@ export class SteamListCache {
   private persist(): void {
     this.persistDirty = true
     if (this.persistTimer) return
-    this.persistTimer = setTimeout(() => this.flush(), PERSIST_DELAY_MS)
+    this.persistTimer = setTimeout(() => { this.flush() }, PERSIST_DELAY_MS)
   }
 
   private flush(): void {
@@ -214,9 +214,9 @@ export class SteamListCache {
     this.syncInFlight = true
     this.lastCrawlStart = Date.now()
     this.runFullSync()
-      .catch((err) => {
+      .catch((err: unknown) => {
         this.lastSyncFailure = Date.now()
-        console.warn(`[Steam] ${this.label} sync failed, will retry later:`, err?.message ?? err)
+        console.warn(`[Steam] ${this.label} sync failed, will retry later:`, err instanceof Error ? err.message : err)
       })
       .finally(() => {
         this.syncInFlight = false
@@ -235,14 +235,14 @@ export class SteamListCache {
       const step = VERIFY_STEPS_MS.find((s) => at + s > this.lastCrawlStart)
       due = Math.min(due, step === undefined ? this.lastCrawlStart + VERIFY_RETRY_MS : at + step)
     }
-    this.verifyTimer = setTimeout(() => this.verifyNow(), Math.max(0, due - Date.now()))
+    this.verifyTimer = setTimeout(() => { this.verifyNow() }, Math.max(0, due - Date.now()))
   }
 
   private verifyNow(): void {
     this.verifyTimer = null
     if (this.syncInFlight) return
     if (!this.source.canSync()) {
-      this.verifyTimer = setTimeout(() => this.verifyNow(), VERIFY_RETRY_MS)
+      this.verifyTimer = setTimeout(() => { this.verifyNow() }, VERIFY_RETRY_MS)
       return
     }
     this.startSync()

+ 3 - 3
src/main/services/steam.service.test.ts

@@ -64,7 +64,7 @@ const window = {
 } as never
 
 async function untilRequest(host: FakeHost, method: string): Promise<{ id: number }> {
-  await vi.waitFor(() => expect(host.requests.some((r) => r.method === method)).toBe(true))
+  await vi.waitFor(() => { expect(host.requests.some((r) => r.method === method)).toBe(true) })
   return host.requests.find((r) => r.method === method)!
 }
 
@@ -79,7 +79,7 @@ describe('a Steam request that never answers', () => {
 
   it('drops the host that did not answer and starts a new one for the next request', async () => {
     const first = steam.getLocalAccountId()
-    await vi.waitFor(() => expect(hosts).toHaveLength(1))
+    await vi.waitFor(() => { expect(hosts).toHaveLength(1) })
     hosts[0].answer((await untilRequest(hosts[0], 'init')).id, null)
     await untilRequest(hosts[0], 'workshop.getSubscribedItems').catch(() => undefined)
     await untilRequest(hosts[0], 'localplayer.getSteamId')
@@ -90,7 +90,7 @@ describe('a Steam request that never answers', () => {
     expect(hosts[0].kill).toHaveBeenCalledTimes(1)
 
     const second = steam.getLocalAccountId()
-    await vi.waitFor(() => expect(hosts).toHaveLength(2))
+    await vi.waitFor(() => { expect(hosts).toHaveLength(2) })
     hosts[1].answer((await untilRequest(hosts[1], 'init')).id, null)
     const request = await untilRequest(hosts[1], 'localplayer.getSteamId')
     hosts[1].answer(request.id, { accountId: 7 })

+ 80 - 27
src/main/services/steam.service.ts

@@ -10,6 +10,7 @@ import { getSteamIdentity } from './config.service'
 import { encodeBigInts, decodeBigInts, type SteamHostResponse } from '../steam-host-protocol'
 import { hostCommand, isFlatpak } from '../utils/flatpak'
 import { SteamListCache } from './steam-list-cache'
+import { openStore } from '../utils/safeStore'
 
 // Steam counts a connected process as a running game, so like WE's ui32.exe connect only while shown
 let windowActive = false
@@ -170,7 +171,7 @@ function startHost(): Promise<void> {
       lastInitFailure = Date.now()
       if (!hasWarnedThisOutage) {
         hasWarnedThisOutage = true
-        console.warn('[Steam] Init failed (Steam may not be running):', err?.message ?? err)
+        console.warn('[Steam] Init failed (Steam may not be running):', err instanceof Error ? err.message : err)
       }
       throw err
     }
@@ -215,7 +216,7 @@ export async function getLocalAccountId(): Promise<number> {
   return id.accountId
 }
 
-export function getSubscribedIds(): Promise<bigint[]> {
+function getSubscribedIds(): Promise<bigint[]> {
   return steamCall<bigint[]>('workshop.getSubscribedItems')
 }
 
@@ -246,15 +247,15 @@ function isSteamOnline(): Promise<boolean> {
 
 function withTimeout<T>(promise: Promise<T>, ms: number, label: string): Promise<T> {
   return new Promise((resolve, reject) => {
-    const timer = setTimeout(() => reject(new Error(`${label} timed out after ${ms}ms`)), ms)
+    const timer = setTimeout(() => { reject(new Error(`${label} timed out after ${ms}ms`)); }, ms)
     promise.then(
       (value) => {
         clearTimeout(timer)
         resolve(value)
       },
-      (err) => {
+      (err: unknown) => {
         clearTimeout(timer)
-        reject(err)
+        reject(err instanceof Error ? err : new Error(String(err)))
       }
     )
   })
@@ -274,7 +275,7 @@ async function patchedVoteApiAvailable(): Promise<boolean> {
   return hasPatchedVoteApi
 }
 
-export async function checkUserVote(
+async function checkUserVote(
   itemId: bigint
 ): Promise<{ votedUp: boolean; votedDown: boolean } | null> {
   if (!(await patchedVoteApiAvailable())) return null
@@ -282,7 +283,7 @@ export async function checkUserVote(
   return { votedUp: result.votedUp, votedDown: result.votedDown }
 }
 
-export function voteOnItem(itemId: bigint, voteUp: boolean): Promise<bigint> {
+function voteOnItem(itemId: bigint, voteUp: boolean): Promise<bigint> {
   return steamCall<bigint>('voteRaw', itemId, voteUp)
 }
 
@@ -466,8 +467,8 @@ async function voteOnce(itemId: bigint, voteUp: boolean): Promise<void> {
   }
 }
 
-export async function getVotedUpItemIds(): Promise<string[]> {
-  return likedList.list()
+export function getVotedUpItemIds(): Promise<string[]> {
+  return Promise.resolve(likedList.list())
 }
 
 export function getVotedDownItemIds(): string[] {
@@ -476,8 +477,8 @@ export function getVotedDownItemIds(): string[] {
 
 export async function refreshItemVote(itemId: bigint): Promise<boolean | null> {
   if (!isSteamRunning() || !(await isSteamOnline().catch(() => false))) return null
-  const result = await withTimeout(checkUserVote(itemId), PAGE_FETCH_TIMEOUT_MS, 'getUserVote').catch((err) => {
-    console.warn('[Steam] Per-item vote check failed:', err?.message ?? err)
+  const result = await withTimeout(checkUserVote(itemId), PAGE_FETCH_TIMEOUT_MS, 'getUserVote').catch((err: unknown) => {
+    console.warn('[Steam] Per-item vote check failed:', err instanceof Error ? err.message : err)
     return null
   })
   if (!result) return null
@@ -628,25 +629,77 @@ export async function getInstallInfo(itemId: bigint): Promise<{ folder: string;
 }
 
 // steamworks.js only knows the player and friends, read the public profile XML
-const authorInfoCache = new Map<string, WorkshopAuthorInfo | null>()
+type CachedAuthor = WorkshopAuthorInfo & { fetchedAt?: number }
+
+const AUTHOR_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000
+let authorStore: ReturnType<typeof openStore<{ authors: Record<string, CachedAuthor> }>> | null = null
+
+function authorInfoCache(): ReturnType<typeof openStore<{ authors: Record<string, CachedAuthor> }>> {
+  authorStore ??= openStore<{ authors: Record<string, CachedAuthor> }>({ name: 'author-cache', defaults: { authors: {} } })
+  return authorStore
+}
 const PROFILE_FETCH_TIMEOUT_MS = 15_000
 
-export async function getAuthorInfo(steamId: string): Promise<WorkshopAuthorInfo | null> {
-  if (authorInfoCache.has(steamId)) return authorInfoCache.get(steamId) ?? null
-  try {
-    const res = await fetch(`https://steamcommunity.com/profiles/${steamId}?xml=1`, {
-      signal: AbortSignal.timeout(PROFILE_FETCH_TIMEOUT_MS)
-    })
-    if (!res.ok) return null
-    const xml = await res.text()
-    const name = xml.match(/<steamID><!\[CDATA\[([\s\S]*?)\]\]><\/steamID>/)?.[1]
-    const avatarUrl = xml.match(/<avatarFull><!\[CDATA\[([\s\S]*?)\]\]><\/avatarFull>/)?.[1]
-    const info = name && avatarUrl ? { steamId, name, avatarUrl } : null
-    authorInfoCache.set(steamId, info)
-    return info
-  } catch {
-    return null
+const authorInfoInflight = new Map<string, Promise<WorkshopAuthorInfo>>()
+
+// throws on any failure (429 when Steam rate limits, timeouts, private profile without avatar),
+// so the renderer retries instead of caching a null forever
+export function getAuthorInfo(steamId: string): Promise<WorkshopAuthorInfo> {
+  const cached = authorInfoCache().get('authors')[steamId]
+  if (cached?.fetchedAt && Date.now() - cached.fetchedAt < AUTHOR_CACHE_TTL_MS) return Promise.resolve(cached)
+  let pending = authorInfoInflight.get(steamId)
+  if (!pending) {
+    pending = queueProfileFetch(steamId)
+      .catch((err: unknown) => {
+        if (cached) return cached
+        throw err
+      })
+      .finally(() => authorInfoInflight.delete(steamId))
+    authorInfoInflight.set(steamId, pending)
+  }
+  return pending
+}
+
+const PROFILE_GAP_MS = 1000
+const PROFILE_MAX_RETRY_WAIT_MS = 10_000
+let profileQueue: Promise<unknown> = Promise.resolve()
+
+function queueProfileFetch(steamId: string): Promise<WorkshopAuthorInfo> {
+  const run = profileQueue.then(async () => {
+    try {
+      return await fetchAuthorInfo(steamId)
+    } finally {
+      await new Promise((resolve) => setTimeout(resolve, PROFILE_GAP_MS))
+    }
+  })
+  profileQueue = run.catch(() => undefined)
+  return run
+}
+
+async function fetchProfileXml(steamId: string): Promise<Response> {
+  const url = `https://steamcommunity.com/profiles/${steamId}?xml=1`
+  let res = await fetch(url, { signal: AbortSignal.timeout(PROFILE_FETCH_TIMEOUT_MS) })
+  if (res.status === 429) {
+    const retryAfter = Number(res.headers.get('retry-after'))
+    const waitMs = retryAfter > 0 ? retryAfter * 1000 : 3000
+    if (waitMs <= PROFILE_MAX_RETRY_WAIT_MS) {
+      await new Promise((resolve) => setTimeout(resolve, waitMs))
+      res = await fetch(url, { signal: AbortSignal.timeout(PROFILE_FETCH_TIMEOUT_MS) })
+    }
   }
+  return res
+}
+
+async function fetchAuthorInfo(steamId: string): Promise<WorkshopAuthorInfo> {
+  const res = await fetchProfileXml(steamId)
+  if (!res.ok) throw new Error(`Steam profile ${steamId}: HTTP ${res.status}`)
+  const xml = await res.text()
+  const name = xml.match(/<steamID><!\[CDATA\[([\s\S]*?)\]\]><\/steamID>/)?.[1]
+  const avatarUrl = xml.match(/<avatarFull><!\[CDATA\[([\s\S]*?)\]\]><\/avatarFull>/)?.[1]
+  if (!name || !avatarUrl) throw new Error(`Steam profile ${steamId}: no ${name ? 'avatar' : 'name'} in response`)
+  const info = { steamId, name, avatarUrl }
+  authorInfoCache().set(`authors.${steamId}`, { ...info, fetchedAt: Date.now() })
+  return info
 }
 
 /** EItemState, throws when Steam can't be asked */

+ 2 - 2
src/main/services/thumbnail.service.ts

@@ -33,7 +33,7 @@ function requireWallpaper(id: string): WallpaperMeta {
 function setThumbnail(wallpaper: WallpaperMeta, file: string): WallpaperMeta {
   removeOwnThumbnail(wallpaper)
   updateWallpaper(wallpaper.id, { customPreview: file, useOriginalPreview: false })
-  return getWallpaper(wallpaper.id)!
+  return requireWallpaper(wallpaper.id)
 }
 
 export async function generateThumbnail(id: string): Promise<WallpaperMeta> {
@@ -60,5 +60,5 @@ export function deleteThumbnail(id: string): WallpaperMeta {
   const wallpaper = requireWallpaper(id)
   removeOwnThumbnail(wallpaper)
   updateWallpaper(id, { customPreview: undefined, useOriginalPreview: false })
-  return getWallpaper(id)!
+  return requireWallpaper(id)
 }

+ 1 - 5
src/main/services/tray.service.ts

@@ -54,7 +54,7 @@ function buildMenu(): Menu {
     { type: 'separator' },
     {
       label: t('tray.quit'),
-      click: () => app.quit()
+      click: () => { app.quit() }
     }
   ])
 }
@@ -88,7 +88,3 @@ export function destroyTray(): void {
   unsubscribePlayback?.()
   unsubscribePlayback = null
 }
-
-export function isTrayActive(): boolean {
-  return tray !== null
-}

+ 2 - 2
src/main/services/watcher.service.ts

@@ -39,10 +39,10 @@ function watchNewFolders(
         if (meta && watcherWin && !watcherWin.isDestroyed()) {
           watcherWin.webContents.send(IpcChannels.EVENT_WALLPAPER_IMPORTED, meta)
         }
-      })
+      }).catch((err: unknown) => { console.error(`[Watcher] Import of ${filename} failed:`, err) })
     }, 1000)
   })
-  watcher.on('error', (err) => console.warn(`[Watcher] ${watchPath}: ${err.message}`))
+  watcher.on('error', (err) => { console.warn(`[Watcher] ${watchPath}: ${err.message}`) })
   activeWatchers.push(watcher)
 }
 

+ 2 - 2
src/main/services/workshop-verify.service.test.ts

@@ -86,7 +86,7 @@ beforeEach(() => {
   subscribed = []
 })
 
-afterEach(() => fs.rmSync(dir, { recursive: true, force: true }))
+afterEach(() => { fs.rmSync(dir, { recursive: true, force: true }) })
 
 describe('checkItem', () => {
   it('passes an intact install, extra files included', async () => {
@@ -254,7 +254,7 @@ describe('settleRepairStash', () => {
       hostRequested = false
 
       const settled = verify.settleRepairStash(item, stash)
-      await vi.waitFor(() => expect(hostRequested).toBe(true))
+      await vi.waitFor(() => { expect(hostRequested).toBe(true) })
       await vi.advanceTimersByTimeAsync(5000)
 
       expect(await settled).toBe(false)

+ 1 - 1
src/main/services/workshop-verify.service.ts

@@ -69,7 +69,7 @@ async function within<T>(promise: Promise<T>, ms: number): Promise<T> {
     return await Promise.race([
       promise,
       new Promise<never>((_, reject) => {
-        timer = setTimeout(() => reject(new Error('Steam did not answer')), ms)
+        timer = setTimeout(() => { reject(new Error('Steam did not answer')) }, ms)
       })
     ])
   } finally {

+ 2 - 2
src/main/services/workshop.service.ts

@@ -161,14 +161,14 @@ const FILE_SIZE_TIMEOUT_MS = 15_000
 async function fetchFileSizesBatch(ids: string[]): Promise<void> {
   if (ids.length === 0) return
   const body = new URLSearchParams({ itemcount: String(ids.length) })
-  ids.forEach((id, i) => body.set(`publishedfileids[${i}]`, id))
+  ids.forEach((id, i) => { body.set(`publishedfileids[${i}]`, id) })
 
   const res = await fetch('https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/v1/', {
     method: 'POST',
     body,
     signal: AbortSignal.timeout(FILE_SIZE_TIMEOUT_MS)
   })
-  const data = await res.json()
+  const data = (await res.json()) as { response?: { publishedfiledetails?: ({ publishedfileid?: string; file_size?: string | number | null } | null)[] } } | null
   const details = data?.response?.publishedfiledetails ?? []
   for (const d of details) {
     if (d?.publishedfileid && d.file_size != null) {

+ 2 - 2
src/main/steam-host.ts

@@ -103,7 +103,7 @@ async function call(method: string, args: unknown[]): Promise<unknown> {
 process.parentPort.on('message', (e) => {
   const req = decodeBigInts(e.data) as SteamHostRequest
   call(req.method, req.args).then(
-    (result) => process.parentPort.postMessage(encodeBigInts({ id: req.id, result } satisfies SteamHostResponse)),
-    (err) => process.parentPort.postMessage({ id: req.id, error: (err as Error)?.message ?? String(err) } satisfies SteamHostResponse)
+    (result) => { process.parentPort.postMessage(encodeBigInts({ id: req.id, result } satisfies SteamHostResponse)) },
+    (err: unknown) => { process.parentPort.postMessage({ id: req.id, error: err instanceof Error ? err.message : String(err) } satisfies SteamHostResponse) }
   )
 })

+ 1 - 1
src/main/utils/buildDir.test.ts

@@ -18,7 +18,7 @@ describe('lweBuildDir', () => {
 
 describe('isOwnDirectory', () => {
   const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'wem-builddir-'))
-  afterAll(() => fs.rmSync(tmp, { recursive: true, force: true }))
+  afterAll(() => { fs.rmSync(tmp, { recursive: true, force: true }) })
 
   it('accepts a directory of the user', () => {
     const dir = path.join(tmp, 'mine')

+ 23 - 0
src/main/utils/collections.test.ts

@@ -0,0 +1,23 @@
+import { describe, expect, it } from 'vitest'
+import { findAndMutate } from './collections'
+
+describe('findAndMutate', () => {
+  it('mutates and returns the matching item', () => {
+    const items = [{ id: 'a', n: 1 }, { id: 'b', n: 2 }]
+    const found = findAndMutate(items, 'b', (item) => { item.n = 5 })
+    expect(found).toBe(items[1])
+    expect(items[1].n).toBe(5)
+  })
+
+  it('returns null for an unknown id without calling mutate', () => {
+    let called = false
+    expect(findAndMutate([{ id: 'a' }], 'x', () => { called = true })).toBeNull()
+    expect(called).toBe(false)
+  })
+
+  it('returns null when mutate returns false, keeping the change it made', () => {
+    const items = [{ id: 'a', n: 1 }]
+    expect(findAndMutate(items, 'a', (item) => { item.n = 2; return false })).toBeNull()
+    expect(items[0].n).toBe(2)
+  })
+})

+ 163 - 0
src/main/utils/flatpak-host.test.ts

@@ -0,0 +1,163 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+const execFile = vi.fn<(cmd: string, args: string[], opts: { timeout: number }, done: (e: Error | null, out: string) => void) => void>()
+const execFileSync = vi.fn<(cmd: string, args: string[], opts: { encoding: string; timeout: number }) => string>()
+vi.mock('child_process', () => ({ execFile, execFileSync }))
+
+const savedId = process.env.FLATPAK_ID
+const savedWayland = process.env.WAYLAND_DISPLAY
+
+async function load(inFlatpak: boolean): Promise<typeof import('./flatpak')> {
+  vi.resetModules()
+  if (inFlatpak) process.env.FLATPAK_ID = 'io.example.app'
+  else delete process.env.FLATPAK_ID
+  return import('./flatpak')
+}
+
+beforeEach(() => {
+  execFile.mockReset()
+  execFileSync.mockReset()
+})
+
+afterEach(() => {
+  if (savedId) process.env.FLATPAK_ID = savedId
+  else delete process.env.FLATPAK_ID
+  if (savedWayland === undefined) delete process.env.WAYLAND_DISPLAY
+  else process.env.WAYLAND_DISPLAY = savedWayland
+})
+
+describe('isHostCommandAvailable', () => {
+  it('asks the shell and remembers the answer per command', async () => {
+    const { isHostCommandAvailable } = await load(false)
+    execFileSync.mockReturnValue('')
+    expect(isHostCommandAvailable('git')).toBe(true)
+    expect(isHostCommandAvailable('git')).toBe(true)
+    expect(execFileSync).toHaveBeenCalledTimes(1)
+    expect(execFileSync).toHaveBeenCalledWith('sh', ['-c', 'command -v "git"'], { stdio: 'ignore', timeout: 5000 })
+  })
+
+  it('is false when the shell fails and does not ask again', async () => {
+    const { isHostCommandAvailable } = await load(false)
+    execFileSync.mockImplementation(() => {
+      throw new Error('exit 1')
+    })
+    expect(isHostCommandAvailable('nothing')).toBe(false)
+    expect(isHostCommandAvailable('nothing')).toBe(false)
+    expect(execFileSync).toHaveBeenCalledTimes(1)
+  })
+
+  it('asks the host inside a Flatpak', async () => {
+    const { isHostCommandAvailable } = await load(true)
+    execFileSync.mockReturnValue('')
+    isHostCommandAvailable('rpm')
+    const [cmd, args] = execFileSync.mock.calls[0]
+    expect(cmd).toBe('flatpak-spawn')
+    expect(args[0]).toBe('--host')
+    expect(args.slice(-3)).toEqual(['sh', '-c', 'command -v "rpm"'])
+  })
+})
+
+describe('hostShell quoting', () => {
+  it('escapes single quotes in the passed session variables', async () => {
+    process.env.WAYLAND_DISPLAY = "a'b"
+    const { hostShell } = await load(true)
+    expect(hostShell('true')).toContain(`'--env=WAYLAND_DISPLAY=a'\\''b'`)
+  })
+})
+
+describe('sandbox info', () => {
+  const info = '[Application]\nname=io.example.app\n\n[Instance]\ninstance-id=1234567\napp-path=/home/u/.local/share/flatpak/app/io.example.app/x86_64/stable/abc/files\n'
+
+  it('reads the app path and the instance id', async () => {
+    const { hostAppPath, flatpakInstanceId } = await load(true)
+    expect(hostAppPath(info)).toBe('/home/u/.local/share/flatpak/app/io.example.app/x86_64/stable/abc/files')
+    expect(flatpakInstanceId(info)).toBe('1234567')
+    expect(hostAppPath('[Application]\n')).toBeUndefined()
+    expect(flatpakInstanceId('instance-id=\n')).toBeUndefined()
+    expect(hostAppPath('xapp-path=/nope\n')).toBeUndefined()
+  })
+
+  it('maps /app paths to the host and nothing else', async () => {
+    const { toHostPath } = await load(true)
+    expect(toHostPath('/app/bin/we', '/host/files')).toBe('/host/files/bin/we')
+    expect(toHostPath('/app', '/host/files')).toBeUndefined()
+    expect(toHostPath('/usr/bin/we', '/host/files')).toBeUndefined()
+    expect(toHostPath('/app/bin/we', undefined)).toBeUndefined()
+    expect(toHostPath('/app/bin/we', '')).toBeUndefined()
+  })
+})
+
+describe('hostPidOf', () => {
+  it('passes the pid namespace and pid to the host script', async () => {
+    const { hostPidOf } = await load(true)
+    execFile.mockImplementation((_cmd: string, _args: string[], _opts: unknown, done: (e: Error | null, out: string) => void) => {
+      done(null, '4321\n')
+    })
+    expect(await hostPidOf(77)).toBe(4321)
+    const [cmd, args, opts] = execFile.mock.calls[0]
+    expect(cmd).toBe('flatpak-spawn')
+    expect(args.slice(0, 4)).toEqual(['--host', 'sh', '-c', expect.stringContaining('NSpid')])
+    expect(args.slice(4, 5)).toEqual(['sh'])
+    expect(args[5]).toMatch(/^pid:\[\d+\]$/)
+    expect(args[6]).toBe('77')
+    expect(opts.timeout).toBe(10_000)
+  })
+
+  it('is undefined when the host fails or prints nothing usable', async () => {
+    const { hostPidOf } = await load(true)
+    const reply = (err: Error | null, out: string) =>
+      execFile.mockImplementationOnce((_c: string, _a: string[], _o: unknown, done: (e: Error | null, o: string) => void) => { done(err, out) })
+    reply(new Error('gone'), '12')
+    expect(await hostPidOf(1)).toBeUndefined()
+    reply(null, '')
+    expect(await hostPidOf(1)).toBeUndefined()
+    reply(null, '0\n')
+    expect(await hostPidOf(1)).toBeUndefined()
+    reply(null, '-5\n')
+    expect(await hostPidOf(1)).toBeUndefined()
+  })
+})
+
+describe('host process command line', () => {
+  it('tells gone, alive and unknown apart', async () => {
+    const { hostProcessCommandLine } = await load(true)
+    execFileSync.mockReturnValueOnce('gone\n')
+    expect(hostProcessCommandLine(5)).toBeNull()
+    execFileSync.mockReturnValueOnce('alive /usr/bin/engine --window ')
+    expect(hostProcessCommandLine(5)).toBe('/usr/bin/engine --window ')
+    execFileSync.mockReturnValueOnce('something else')
+    expect(hostProcessCommandLine(5)).toBeUndefined()
+    execFileSync.mockImplementationOnce(() => {
+      throw new Error('no flatpak-spawn')
+    })
+    expect(hostProcessCommandLine(5)).toBeUndefined()
+    const [cmd, args, opts] = execFileSync.mock.calls[0]
+    expect(cmd).toBe('flatpak-spawn')
+    expect(args.slice(0, 3)).toEqual(['--host', 'sh', '-c'])
+    expect(args.slice(4)).toEqual(['sh', '5'])
+    expect(opts.encoding).toBe('utf8')
+    expect(opts.timeout).toBe(5000)
+  })
+
+  it('does the same asynchronously', async () => {
+    const { hostProcessCommandLineAsync } = await load(true)
+    const reply = (err: Error | null, out: string) =>
+      execFile.mockImplementationOnce((_c: string, _a: string[], _o: unknown, done: (e: Error | null, o: string) => void) => { done(err, out) })
+    reply(null, 'gone')
+    expect(await hostProcessCommandLineAsync(9)).toBeNull()
+    reply(null, 'alive engine ')
+    expect(await hostProcessCommandLineAsync(9)).toBe('engine ')
+    reply(new Error('failed'), 'alive engine ')
+    expect(await hostProcessCommandLineAsync(9)).toBeUndefined()
+  })
+})
+
+describe('killHostProcess', () => {
+  it('sends the signal without its SIG prefix through the host', async () => {
+    const { killHostProcess } = await load(true)
+    killHostProcess(42, 'SIGTERM')
+    killHostProcess(43, 'SIGKILL')
+    expect(execFileSync).toHaveBeenNthCalledWith(1, 'flatpak-spawn', ['--host', 'kill', '-s', 'TERM', '42'], { timeout: 5000, stdio: 'ignore' })
+    expect(execFileSync).toHaveBeenNthCalledWith(2, 'flatpak-spawn', ['--host', 'kill', '-s', 'KILL', '43'], { timeout: 5000, stdio: 'ignore' })
+  })
+})

+ 1 - 1
src/main/utils/flatpak.ts

@@ -119,7 +119,7 @@ export function hostProcessCommandLine(hostPid: number): string | null | undefin
 export function hostProcessCommandLineAsync(hostPid: number): Promise<string | null | undefined> {
   return new Promise((resolve) => {
     execFile('flatpak-spawn', ['--host', 'sh', '-c', HOST_CMDLINE_SCRIPT, 'sh', String(hostPid)], { timeout: 5000 },
-      (err, stdout) => resolve(err ? undefined : parseHostCommandLine(stdout)))
+      (err, stdout) => { resolve(err ? undefined : parseHostCommandLine(stdout)) })
   })
 }
 

+ 146 - 2
src/main/utils/github.test.ts

@@ -4,8 +4,19 @@ import * as http from 'http'
 import type { AddressInfo } from 'net'
 import * as os from 'os'
 import * as path from 'path'
-import { afterAll, beforeAll, describe, expect, it } from 'vitest'
-import { downloadVerified, selectableReleases, type GithubAsset, type GithubRelease } from './github'
+import { afterAll, afterEach, beforeAll, describe, expect, it, vi } from 'vitest'
+import {
+  download,
+  downloadVerified,
+  fetchLatestRelease,
+  fetchReleaseByTag,
+  fetchReleases,
+  isVersionTag,
+  selectableReleases,
+  verifyAsset,
+  type GithubAsset,
+  type GithubRelease
+} from './github'
 
 const body = Buffer.from('engine archive bytes '.repeat(500))
 const sha256 = crypto.createHash('sha256').update(body).digest('hex')
@@ -71,3 +82,136 @@ describe('selectableReleases', () => {
     expect(selectableReleases(list).map(r => r.tag_name)).toEqual(['v0.9.8', 'v0.9.7-rc1'])
   })
 })
+
+describe('isVersionTag', () => {
+  it('wants a v followed by a digit', () => {
+    expect(isVersionTag('v0.9.8')).toBe(true)
+    expect(isVersionTag('v1')).toBe(true)
+    expect(isVersionTag('v')).toBe(false)
+    expect(isVersionTag('vim')).toBe(false)
+    expect(isVersionTag('0.9.8')).toBe(false)
+    expect(isVersionTag('xv1')).toBe(false)
+  })
+})
+
+describe('release lookups', () => {
+  const answer = (status: number, json: unknown = {}, statusText = '') =>
+    vi.fn<() => Promise<Response>>(() => Promise.resolve(new Response(JSON.stringify(json), { status, statusText })))
+
+  afterEach(() => vi.unstubAllGlobals())
+
+  it('asks GitHub for the latest release of the repo and sends the usual headers', async () => {
+    const fetchMock = answer(200, release('v1.0'))
+    vi.stubGlobal('fetch', fetchMock)
+    expect((await fetchLatestRelease('owner/repo'))?.tag_name).toBe('v1.0')
+    const [url, init] = fetchMock.mock.calls[0] as unknown as [string, RequestInit]
+    expect(url).toBe('https://api.github.com/repos/owner/repo/releases/latest')
+    expect(init.headers).toEqual({ Accept: 'application/vnd.github+json', 'User-Agent': 'we-manager' })
+    expect(init.signal).toBeInstanceOf(AbortSignal)
+  })
+
+  it('answers null for a repo without releases and throws on other failures', async () => {
+    vi.stubGlobal('fetch', answer(404))
+    expect(await fetchLatestRelease('owner/repo')).toBeNull()
+    vi.stubGlobal('fetch', answer(500, {}, 'Server Error'))
+    await expect(fetchLatestRelease('owner/repo')).rejects.toThrow('GitHub answered 500 Server Error for the latest release of owner/repo.')
+  })
+
+  it('lists up to 100 releases without drafts and helper releases', async () => {
+    const fetchMock = answer(200, [release('v2'), release('libnode'), release('v1', true)])
+    vi.stubGlobal('fetch', fetchMock)
+    expect((await fetchReleases('owner/repo')).map(r => r.tag_name)).toEqual(['v2'])
+    expect((fetchMock.mock.calls[0] as unknown as [string])[0]).toBe('https://api.github.com/repos/owner/repo/releases?per_page=100')
+  })
+
+  it('throws when the list cannot be read, a 404 is no empty list', async () => {
+    vi.stubGlobal('fetch', answer(404, {}, 'Not Found'))
+    await expect(fetchReleases('owner/repo')).rejects.toThrow('GitHub answered 404 Not Found for the releases of owner/repo.')
+  })
+
+  it('finds a release by its tag, escaping the tag', async () => {
+    const fetchMock = answer(200, release('v1 beta'))
+    vi.stubGlobal('fetch', fetchMock)
+    expect((await fetchReleaseByTag('owner/repo', 'v1 beta'))?.tag_name).toBe('v1 beta')
+    expect((fetchMock.mock.calls[0] as unknown as [string])[0]).toBe('https://api.github.com/repos/owner/repo/releases/tags/v1%20beta')
+  })
+
+  it('answers null for an unknown tag and throws on other failures', async () => {
+    vi.stubGlobal('fetch', answer(404))
+    expect(await fetchReleaseByTag('owner/repo', 'v9')).toBeNull()
+    vi.stubGlobal('fetch', answer(403, {}, 'Forbidden'))
+    await expect(fetchReleaseByTag('owner/repo', 'v9')).rejects.toThrow('GitHub answered 403 Forbidden for the v9 release of owner/repo.')
+  })
+})
+
+describe('download', () => {
+  it('reports the fraction received and writes the file', async () => {
+    const dest = path.join(tmp, 'progress')
+    const seen: number[] = []
+    await download(url, dest, 0, (f) => seen.push(f))
+    expect(fs.readFileSync(dest).equals(body)).toBe(true)
+    expect(seen.length).toBeGreaterThan(0)
+    expect(seen.at(-1)).toBeLessThanOrEqual(1)
+    expect(seen.every((f) => f > 0)).toBe(true)
+  })
+
+  it('reports nothing when neither the server nor the caller knows the size', async () => {
+    const noLength = http.createServer((_req, res) => {
+      res.writeHead(200)
+      res.end(body)
+    })
+    await new Promise<void>((resolve) => noLength.listen(0, '127.0.0.1', resolve))
+    const seen: number[] = []
+    await download(`http://127.0.0.1:${(noLength.address() as AddressInfo).port}/x`, path.join(tmp, 'nolength'), 0, (f) => seen.push(f))
+    noLength.close()
+    expect(seen).toEqual([])
+  })
+
+  it('falls back to the size from the release when the server sends no length', async () => {
+    const noLength = http.createServer((_req, res) => {
+      res.writeHead(200)
+      res.end(body)
+    })
+    await new Promise<void>((resolve) => noLength.listen(0, '127.0.0.1', resolve))
+    const seen: number[] = []
+    await download(`http://127.0.0.1:${(noLength.address() as AddressInfo).port}/x`, path.join(tmp, 'releasesize'), body.length, (f) => seen.push(f))
+    noLength.close()
+    expect(seen.at(-1)).toBe(1)
+  })
+
+  it('throws on an error status', async () => {
+    const failing = http.createServer((_req, res) => {
+      res.writeHead(404, 'Gone')
+      res.end()
+    })
+    await new Promise<void>((resolve) => failing.listen(0, '127.0.0.1', resolve))
+    const dest = path.join(tmp, 'failed')
+    await expect(download(`http://127.0.0.1:${(failing.address() as AddressInfo).port}/x`, dest, 0, () => {})).rejects.toThrow('Download failed: 404 Gone')
+    failing.close()
+  })
+})
+
+describe('verifyAsset', () => {
+  const file = () => {
+    const f = path.join(tmp, 'verify')
+    fs.writeFileSync(f, body)
+    return f
+  }
+
+  it('names the asset and both sizes when the size is off', async () => {
+    await expect(verifyAsset(file(), asset({ size: 3 }))).rejects.toThrow(`engine.tar.gz is ${body.length} bytes, the release says 3.`)
+  })
+
+  it('compares the digest case-insensitively', async () => {
+    await expect(verifyAsset(file(), asset({ digest: `SHA256:${sha256.toUpperCase()}` }))).resolves.toBeUndefined()
+  })
+
+  it('ignores a digest that is not a sha256 of 64 hex digits', async () => {
+    await expect(verifyAsset(file(), asset({ digest: 'sha1:abc' }))).resolves.toBeUndefined()
+    await expect(verifyAsset(file(), asset({ digest: `sha256:${sha256}00` }))).resolves.toBeUndefined()
+  })
+
+  it('names the asset when the checksum differs', async () => {
+    await expect(verifyAsset(file(), asset({ digest: `sha256:${'a'.repeat(64)}` }))).rejects.toThrow("engine.tar.gz does not match the release's checksum.")
+  })
+})

+ 182 - 0
src/main/utils/hdr-features.test.ts

@@ -0,0 +1,182 @@
+import * as fs from 'fs'
+import * as os from 'os'
+import * as path from 'path'
+import type { WallpaperMeta } from '@shared/types'
+import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'
+
+const { execFile, isCommandAvailable } = vi.hoisted(() => ({
+  execFile: vi.fn<(cmd: string, args: string[], opts: { timeout: number; encoding: string }, done: (e: Error | null, r?: { stdout: string }) => void) => void>(),
+  isCommandAvailable: vi.fn<(cmd: string) => boolean>()
+}))
+vi.mock('child_process', () => ({ execFile }))
+vi.mock('./platform', () => ({ isCommandAvailable }))
+
+import { detectFeatures } from './hdr'
+
+const root = fs.mkdtempSync(path.join(os.tmpdir(), 'hdr-features-'))
+afterAll(() => { fs.rmSync(root, { recursive: true, force: true }) })
+
+let counter = 0
+function wallpaperDir(files: Record<string, string>, name = `w${++counter}`): string {
+  const dir = path.join(root, name)
+  fs.mkdirSync(dir, { recursive: true })
+  for (const [file, content] of Object.entries(files)) fs.writeFileSync(path.join(dir, file), content)
+  return dir
+}
+
+const meta = (localPath: string | undefined, extra: Partial<WallpaperMeta> = {}): WallpaperMeta =>
+  ({ id: '1', type: 'scene', localPath, ...extra }) as WallpaperMeta
+
+const project = (extra: Record<string, unknown> = {}): string => JSON.stringify({ type: 'scene', file: 'scene.json', ...extra })
+
+function u32(v: number): Buffer {
+  const b = Buffer.alloc(4)
+  b.writeUInt32LE(v)
+  return b
+}
+const str = (s: string): Buffer => Buffer.concat([u32(Buffer.byteLength(s)), Buffer.from(s)])
+function pkgWith(name: string, content: string): Buffer {
+  return Buffer.concat([str('PKGV0023'), u32(1), str(name), u32(0), u32(Buffer.byteLength(content)), Buffer.from(content)])
+}
+
+beforeEach(() => {
+  execFile.mockReset()
+  isCommandAvailable.mockReset()
+})
+
+describe('detectFeatures for scenes', () => {
+  it('has nothing to say without a folder or a project.json', async () => {
+    expect(await detectFeatures(meta(undefined))).toEqual({})
+    expect(await detectFeatures(meta(wallpaperDir({})))).toEqual({})
+    expect(await detectFeatures(meta(wallpaperDir({ 'project.json': '{nope' })))).toEqual({})
+  })
+
+  it('reads a loose scene.json with a BOM and trailing commas', async () => {
+    const scene = '{"general":{"bloom":true,"hdr":true,},"objects":[{"sound":["a.wav"],"spatialization":true,},],}'
+    const dir = wallpaperDir({ 'project.json': project(), 'scene.json': scene })
+    expect(await detectFeatures(meta(dir))).toEqual({ hdr: true, hrtf: true })
+  })
+
+  it('reports false features for a plain scene', async () => {
+    const dir = wallpaperDir({ 'project.json': project(), 'scene.json': '{"general":{},"objects":[]}' })
+    expect(await detectFeatures(meta(dir))).toEqual({ hdr: false, hrtf: false })
+  })
+
+  it('reads the scene out of scene.pkg when there is no loose file', async () => {
+    const dir = wallpaperDir({ 'project.json': project() })
+    fs.writeFileSync(path.join(dir, 'scene.pkg'), pkgWith('scene.json', '{"general":{"bloom":true,"hdr":true}}'))
+    expect(await detectFeatures(meta(dir))).toEqual({ hdr: true, hrtf: false })
+  })
+
+  it('prefers a package named after the scene file', async () => {
+    const dir = wallpaperDir({ 'project.json': project({ file: 'gifscene.json' }) })
+    fs.writeFileSync(path.join(dir, 'gifscene.pkg'), pkgWith('gifscene.json', '{"general":{"bloom":true,"hdr":true}}'))
+    fs.writeFileSync(path.join(dir, 'scene.pkg'), pkgWith('gifscene.json', '{"general":{}}'))
+    expect(await detectFeatures(meta(dir))).toEqual({ hdr: true, hrtf: false })
+  })
+
+  it('falls back to scene.pkg when the named package is missing', async () => {
+    const dir = wallpaperDir({ 'project.json': project({ file: 'other.json' }) })
+    fs.writeFileSync(path.join(dir, 'scene.pkg'), pkgWith('other.json', '{"general":{"bloom":true,"hdr":true}}'))
+    expect(await detectFeatures(meta(dir))).toEqual({ hdr: true, hrtf: false })
+  })
+
+  it('has nothing to say when the scene cannot be read or parsed', async () => {
+    expect(await detectFeatures(meta(wallpaperDir({ 'project.json': project() })))).toEqual({})
+    expect(await detectFeatures(meta(wallpaperDir({ 'project.json': project(), 'scene.json': '{broken' })))).toEqual({})
+  })
+
+  it('goes by project.json over the library type, ignoring case', async () => {
+    const dir = wallpaperDir({ 'project.json': project({ type: 'Scene' }), 'scene.json': '{"general":{"bloom":true,"hdr":true}}' })
+    expect(await detectFeatures(meta(dir, { type: 'web' }))).toEqual({ hdr: true, hrtf: false })
+  })
+
+  it('uses the library type when project.json has none', async () => {
+    const dir = wallpaperDir({ 'project.json': JSON.stringify({ file: 'scene.json' }), 'scene.json': '{"general":{"bloom":true,"hdr":true}}' })
+    expect(await detectFeatures(meta(dir, { type: 'scene' }))).toEqual({ hdr: true, hrtf: false })
+    expect(await detectFeatures(meta(dir, { type: 'web' }))).toEqual({ hdr: false, hrtf: false })
+  })
+
+  it('resolves property bindings of the project', async () => {
+    const scene = '{"general":{"bloom":true,"hdr":{"user":"hdr","value":true}}}'
+    const on = wallpaperDir({ 'project.json': project({ general: { properties: { hdr: { value: true } } } }), 'scene.json': scene })
+    const off = wallpaperDir({ 'project.json': project({ general: { properties: { hdr: { value: false } } } }), 'scene.json': scene })
+    expect((await detectFeatures(meta(on))).hdr).toBe(true)
+    expect((await detectFeatures(meta(off))).hdr).toBe(false)
+  })
+})
+
+describe('detectFeatures for presets', () => {
+  it('reads the scene of the dependency next to the preset and lets the preset win on properties', async () => {
+    const scene = '{"general":{"bloom":true,"hdr":{"user":"hdr","value":false}}}'
+    wallpaperDir({ 'project.json': project({ general: { properties: { hdr: { value: false } } } }), 'scene.json': scene }, 'base-1')
+    const preset = wallpaperDir({ 'project.json': JSON.stringify({ dependency: 'base-1', general: { properties: { hdr: { value: true } } } }) }, 'preset-1')
+    expect(await detectFeatures(meta(preset))).toEqual({ hdr: true, hrtf: false })
+  })
+
+  it('has nothing to say when the dependency is missing', async () => {
+    const preset = wallpaperDir({ 'project.json': JSON.stringify({ dependency: 'not-there' }) })
+    expect(await detectFeatures(meta(preset))).toEqual({})
+  })
+
+  it('does not treat a project with its own file as a preset', async () => {
+    const dir = wallpaperDir({ 'project.json': project({ dependency: 'missing' }), 'scene.json': '{"general":{"bloom":true,"hdr":true}}' })
+    expect(await detectFeatures(meta(dir))).toEqual({ hdr: true, hrtf: false })
+  })
+})
+
+describe('detectFeatures for videos and the rest', () => {
+  const video = () => wallpaperDir({ 'project.json': JSON.stringify({ type: 'video', file: 'clip.mp4' }), 'clip.mp4': 'x' })
+  const probe = (stdout: string) =>
+    execFile.mockImplementation((_cmd: string, _args: string[], _opts: unknown, done: (e: Error | null, r: { stdout: string }) => void) => { done(null, { stdout }) })
+
+  it('trusts what the library already knows', async () => {
+    expect(await detectFeatures(meta(video(), { type: 'video', hdr: true }))).toEqual({ hdr: true, hrtf: false })
+    expect(await detectFeatures(meta(video(), { type: 'video', hdr: false }))).toEqual({ hdr: false, hrtf: false })
+    expect(execFile).not.toHaveBeenCalled()
+  })
+
+  it('asks ffprobe about the first video stream', async () => {
+    isCommandAvailable.mockReturnValue(true)
+    probe('smpte2084\n')
+    const dir = video()
+    expect(await detectFeatures(meta(dir, { type: 'video' }))).toEqual({ hdr: true, hrtf: false })
+    const [cmd, args, opts] = execFile.mock.calls[0]
+    expect(cmd).toBe('ffprobe')
+    expect(args).toEqual(['-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=color_transfer', '-of', 'csv=p=0', path.join(dir, 'clip.mp4')])
+    expect(opts).toEqual({ timeout: 10_000, encoding: 'utf8' })
+    expect(isCommandAvailable).toHaveBeenCalledWith('ffprobe')
+  })
+
+  it('knows HLG as HDR and SDR transfers as not', async () => {
+    isCommandAvailable.mockReturnValue(true)
+    probe('arib-std-b67\n')
+    expect((await detectFeatures(meta(video(), { type: 'video' }))).hdr).toBe(true)
+    probe('bt709\n')
+    expect((await detectFeatures(meta(video(), { type: 'video' }))).hdr).toBe(false)
+    probe('  smpte2084  \nbt709\n')
+    expect((await detectFeatures(meta(video(), { type: 'video' }))).hdr).toBe(true)
+    probe('')
+    expect((await detectFeatures(meta(video(), { type: 'video' }))).hdr).toBe(false)
+  })
+
+  it('cannot tell without ffprobe or when it fails', async () => {
+    isCommandAvailable.mockReturnValue(false)
+    expect(await detectFeatures(meta(video(), { type: 'video' }))).toEqual({ hdr: undefined, hrtf: false })
+    expect(execFile).not.toHaveBeenCalled()
+    isCommandAvailable.mockReturnValue(true)
+    execFile.mockImplementation((_c: string, _a: string[], _o: unknown, done: (e: Error) => void) => { done(new Error('boom')) })
+    expect(await detectFeatures(meta(video(), { type: 'video' }))).toEqual({ hdr: undefined, hrtf: false })
+  })
+
+  it('cannot tell when the folder has no video', async () => {
+    isCommandAvailable.mockReturnValue(true)
+    const dir = wallpaperDir({ 'project.json': JSON.stringify({ type: 'video', file: 'gone.mp4' }) })
+    expect(await detectFeatures(meta(dir, { type: 'video' }))).toEqual({ hdr: undefined, hrtf: false })
+  })
+
+  it('has no HDR or HRTF for web wallpapers', async () => {
+    const dir = wallpaperDir({ 'project.json': JSON.stringify({ type: 'web', file: 'index.html' }) })
+    expect(await detectFeatures(meta(dir, { type: 'web' }))).toEqual({ hdr: false, hrtf: false })
+  })
+})

+ 1 - 1
src/main/utils/hdr.test.ts

@@ -29,7 +29,7 @@ function makePkg(files: Record<string, string>): Buffer {
 }
 
 const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'hdr-test-'))
-afterAll(() => fs.rmSync(dir, { recursive: true, force: true }))
+afterAll(() => { fs.rmSync(dir, { recursive: true, force: true }) })
 
 describe('readPkgEntry', () => {
   it('reads one entry without the rest of the package', async () => {

+ 2 - 2
src/main/utils/hdr.ts

@@ -11,7 +11,7 @@ const execFileAsync = promisify(execFile)
 // .pkg files can be huge, read only the entry table (64KB covers most) and one entry
 const PKG_HEADER_CHUNK = 64 * 1024
 
-export function parsePkgHeader(buf: Buffer): { dataStart: number; entries: Map<string, { offset: number; length: number }> } | undefined {
+function parsePkgHeader(buf: Buffer): { dataStart: number; entries: Map<string, { offset: number; length: number }> } | undefined {
   let pos = 0
   const u32 = (): number => {
     if (pos + 4 > buf.length) throw new RangeError('short pkg header')
@@ -97,7 +97,7 @@ interface Project {
 
 async function readProject(localPath: string): Promise<Project | undefined> {
   try {
-    return JSON.parse(await fs.promises.readFile(path.join(localPath, 'project.json'), 'utf8'))
+    return JSON.parse(await fs.promises.readFile(path.join(localPath, 'project.json'), 'utf8')) as Project
   } catch {
     return undefined
   }

+ 1 - 1
src/main/utils/localLibrary.test.ts

@@ -16,7 +16,7 @@ beforeEach(() => {
   tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'wem-local-'))
 })
 
-afterEach(() => fs.rmSync(tmp, { recursive: true, force: true }))
+afterEach(() => { fs.rmSync(tmp, { recursive: true, force: true }) })
 
 describe('localWallpaperId', () => {
   it('keeps a workshop folder name', async () => {

+ 2 - 1
src/main/utils/localLibrary.ts

@@ -18,7 +18,8 @@ export async function localWallpaperId(dir: string): Promise<string | null> {
   }
   const name = path.basename(dir)
   if (WORKSHOP_ID.test(name)) return name
-  const fromProject = pj?.workshopid === undefined ? '' : String(pj.workshopid)
+  const id = pj?.workshopid
+  const fromProject = typeof id === 'string' || typeof id === 'number' ? String(id) : ''
   return WORKSHOP_ID.test(fromProject) ? fromProject : name
 }
 

+ 91 - 0
src/main/utils/packages.test.ts

@@ -0,0 +1,91 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const execFileSync = vi.fn<(cmd: string, args: string[], opts?: unknown) => string>()
+const isCommandAvailable = vi.fn<(cmd: string) => boolean>()
+
+vi.mock('child_process', () => ({ execFileSync }))
+vi.mock('./platform', () => ({ isCommandAvailable }))
+
+const { owningPackage, packageVersion } = await import('./packages')
+
+beforeEach(() => {
+  execFileSync.mockReset()
+  isCommandAvailable.mockReset()
+  isCommandAvailable.mockReturnValue(true)
+})
+
+describe('query commands', () => {
+  it('passes each manager the file or package name as its own argument', () => {
+    isCommandAvailable.mockReturnValue(true)
+    execFileSync.mockImplementation(() => { throw new Error('no') })
+    owningPackage('/usr/bin/x')
+    expect(execFileSync.mock.calls.map((call) => [call[0], call[1]])).toEqual([
+      ['pacman', ['-Qoq', '/usr/bin/x']],
+      ['rpm', ['-qf', '--qf', '%{NAME}', '/usr/bin/x']],
+      ['dpkg-query', ['-S', '/usr/bin/x']]
+    ])
+    expect(execFileSync.mock.calls[0][2]).toMatchObject({ encoding: 'utf8', timeout: 5000 })
+  })
+
+  it('does not run a manager that is not installed', () => {
+    isCommandAvailable.mockReturnValue(false)
+    expect(owningPackage('/usr/bin/x')).toBeUndefined()
+    expect(packageVersion({ manager: 'rpm', name: 'lwe' })).toBeUndefined()
+    expect(execFileSync).not.toHaveBeenCalled()
+  })
+
+  it('only takes the first line', () => {
+    execFileSync.mockReturnValueOnce('first\nsecond\n')
+    expect(owningPackage('/x')).toEqual({ manager: 'pacman', name: 'first' })
+  })
+})
+
+describe('owningPackage', () => {
+  it('asks pacman first', () => {
+    execFileSync.mockReturnValueOnce('linux-wallpaperengine-kde\n')
+    expect(owningPackage('/usr/bin/x')).toEqual({ manager: 'pacman', name: 'linux-wallpaperengine-kde' })
+  })
+
+  it('falls through to rpm and then dpkg when the earlier ones fail or are missing', () => {
+    isCommandAvailable.mockImplementation((command: string) => command !== 'pacman')
+    execFileSync.mockImplementationOnce(() => { throw new Error('not owned') })
+    execFileSync.mockReturnValueOnce('lwe:amd64\n')
+    expect(owningPackage('/usr/bin/x')).toEqual({ manager: 'dpkg', name: 'lwe' })
+  })
+
+  it('is undefined when no manager owns the file', () => {
+    execFileSync.mockImplementation(() => { throw new Error('no') })
+    expect(owningPackage('/home/me/x')).toBeUndefined()
+  })
+
+  it('treats empty output as not owned', () => {
+    execFileSync.mockReturnValue('\n')
+    expect(owningPackage('/x')).toBeUndefined()
+  })
+})
+
+describe('packageVersion', () => {
+  it('asks each manager for that package', () => {
+    execFileSync.mockReturnValue('1\n')
+    packageVersion({ manager: 'pacman', name: 'a' })
+    packageVersion({ manager: 'rpm', name: 'b' })
+    packageVersion({ manager: 'dpkg', name: 'c' })
+    expect(execFileSync.mock.calls.map((call) => [call[0], call[1]])).toEqual([
+      ['pacman', ['-Q', 'a']],
+      ['rpm', ['-q', '--qf', '%{VERSION}', 'b']],
+      ['dpkg-query', ['-W', '-f=${Version}', 'c']]
+    ])
+  })
+
+  it('takes the version column of pacman -Q', () => {
+    execFileSync.mockReturnValueOnce('lwe 1.2.3-1\n')
+    expect(packageVersion({ manager: 'pacman', name: 'lwe' })).toBe('1.2.3-1')
+  })
+
+  it('returns the rpm and dpkg output as is', () => {
+    execFileSync.mockReturnValueOnce('1.2.3\n')
+    expect(packageVersion({ manager: 'rpm', name: 'lwe' })).toBe('1.2.3')
+    execFileSync.mockReturnValueOnce('1.2.3-2\n')
+    expect(packageVersion({ manager: 'dpkg', name: 'lwe' })).toBe('1.2.3-2')
+  })
+})

+ 1 - 1
src/main/utils/packages.ts

@@ -1,7 +1,7 @@
 import { execFileSync } from 'child_process'
 import { isCommandAvailable } from './platform'
 
-export type PackageManager = 'pacman' | 'rpm' | 'dpkg'
+type PackageManager = 'pacman' | 'rpm' | 'dpkg'
 
 export interface OwningPackage {
   manager: PackageManager

+ 144 - 0
src/main/utils/paths.test.ts

@@ -0,0 +1,144 @@
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+import * as path from 'path'
+import * as os from 'os'
+
+const config = {
+  workshop: undefined as string | undefined,
+  backup: undefined as string | undefined,
+  libraries: [] as { path: string; name: string }[]
+}
+
+const existing = new Set<string>()
+
+vi.mock('fs', async (importOriginal) => {
+  const actual = await importOriginal<typeof import('fs')>()
+  return { ...actual, existsSync: (p: string) => existing.has(p) }
+})
+vi.mock('electron', () => ({ app: { getPath: () => '/data' } }))
+vi.mock('../services/config.service', () => ({
+  getConfiguredWorkshopPath: () => config.workshop,
+  getConfiguredBackupPath: () => config.backup,
+  getExtraLibraries: () => config.libraries
+}))
+
+const paths = await import('./paths')
+
+beforeEach(() => {
+  config.workshop = undefined
+  config.backup = undefined
+  config.libraries = []
+  existing.clear()
+})
+
+function onPlatform<T>(platform: NodeJS.Platform, run: () => T): T {
+  const original = Object.getOwnPropertyDescriptor(process, 'platform')!
+  Object.defineProperty(process, 'platform', { value: platform })
+  try {
+    return run()
+  } finally {
+    Object.defineProperty(process, 'platform', original)
+  }
+}
+
+describe('getWorkshopPath', () => {
+  it('prefers the configured folder', () => {
+    config.workshop = '/mnt/ws'
+    expect(paths.getWorkshopPath()).toBe('/mnt/ws')
+  })
+
+  it('falls back to a Steam folder on Linux', () => {
+    expect(paths.getWorkshopPath()).toMatch(/steamapps\/workshop\/content\/431960$/)
+  })
+})
+
+describe('getDefaultWorkshopPath', () => {
+  const suffix = path.join('steamapps', 'workshop', 'content', '431960')
+  const home = os.homedir()
+
+  it('takes the first Steam root that has the folder on Linux', () => {
+    existing.add(path.join(home, '.local', 'share', 'Steam', suffix))
+    existing.add(path.join(home, 'snap', 'steam', 'common', '.local', 'share', 'Steam', suffix))
+    expect(onPlatform('linux', () => paths.getDefaultWorkshopPath())).toBe(
+      path.join(home, '.local', 'share', 'Steam', suffix)
+    )
+  })
+
+  it('answers the native Steam root when none exists', () => {
+    expect(onPlatform('linux', () => paths.getDefaultWorkshopPath())).toBe(path.join(home, '.steam', 'steam', suffix))
+  })
+
+  it('knows the Windows install folders', () => {
+    const tail = path.join('Steam', suffix)
+    expect(onPlatform('win32', () => paths.getDefaultWorkshopPath())).toBe(path.join('C:', 'Program Files (x86)', tail))
+    existing.add(path.join('C:', 'SteamLibrary', suffix))
+    expect(onPlatform('win32', () => paths.getDefaultWorkshopPath())).toBe(path.join('C:', 'SteamLibrary', suffix))
+    existing.clear()
+    existing.add(path.join(home, 'AppData', 'Local', tail))
+    expect(onPlatform('win32', () => paths.getDefaultWorkshopPath())).toBe(path.join(home, 'AppData', 'Local', tail))
+  })
+
+  it('uses Application Support on macOS', () => {
+    expect(onPlatform('darwin', () => paths.getDefaultWorkshopPath())).toBe(
+      path.join(home, 'Library', 'Application Support', 'Steam', suffix)
+    )
+  })
+})
+
+describe('getExtraLibraryRoots', () => {
+  it('drops the workshop and backup folders and duplicates', () => {
+    config.workshop = '/mnt/ws'
+    config.backup = '/mnt/backup/'
+    config.libraries = [
+      { path: '/mnt/ws/', name: 'ws' },
+      { path: '/mnt/backup', name: 'backup' },
+      { path: '/mnt/a', name: 'a' },
+      { path: '/mnt/a/../a', name: 'again' },
+      { path: '/mnt/b', name: 'b' }
+    ]
+    expect(paths.getExtraLibraryRoots()).toEqual(['/mnt/a', '/mnt/b'])
+  })
+
+  it('keeps libraries when no backup folder is set', () => {
+    config.libraries = [{ path: '/mnt/a', name: 'a' }]
+    expect(paths.getExtraLibraryRoots()).toEqual(['/mnt/a'])
+  })
+})
+
+describe('getSteamRoots', () => {
+  it('covers native, Flatpak and Snap Steam under the home folder', () => {
+    const roots = paths.getSteamRoots()
+    expect(roots).toEqual([
+      path.join(os.homedir(), '.steam', 'steam'),
+      path.join(os.homedir(), '.local', 'share', 'Steam'),
+      path.join(os.homedir(), '.var', 'app', 'com.valvesoftware.Steam', '.local', 'share', 'Steam'),
+      path.join(os.homedir(), 'snap', 'steam', 'common', '.local', 'share', 'Steam')
+    ])
+    expect(roots.every((root) => root.startsWith(os.homedir()))).toBe(true)
+    expect(roots.some((root) => root.includes('com.valvesoftware.Steam'))).toBe(true)
+    expect(roots.some((root) => root.includes('snap'))).toBe(true)
+  })
+})
+
+describe('data folders', () => {
+  it('lives under userData', () => {
+    expect(paths.getDataPath()).toBe('/data')
+    expect(paths.getPreviewCachePath()).toBe('/data/preview-cache')
+    expect(paths.getThumbnailsPath()).toBe('/data/thumbnails')
+    expect(paths.getLweManifestPath()).toBe('/data/lwe-install-manifest.json')
+  })
+
+  it('puts the prebuilt engine in XDG_DATA_HOME when set', () => {
+    const before = process.env.XDG_DATA_HOME
+    process.env.XDG_DATA_HOME = '/xdg'
+    expect(paths.getLwePrebuiltDir()).toBe(path.join('/xdg', 'linux-wallpaperengine-kde'))
+    if (before === undefined) delete process.env.XDG_DATA_HOME
+    else process.env.XDG_DATA_HOME = before
+  })
+
+  it('falls back to ~/.local/share without XDG_DATA_HOME', () => {
+    const before = process.env.XDG_DATA_HOME
+    delete process.env.XDG_DATA_HOME
+    expect(paths.getLwePrebuiltDir()).toBe(path.join(os.homedir(), '.local', 'share', 'linux-wallpaperengine-kde'))
+    if (before !== undefined) process.env.XDG_DATA_HOME = before
+  })
+})

+ 306 - 0
src/main/utils/platform-session.test.ts

@@ -0,0 +1,306 @@
+import * as fs from 'fs'
+import * as os from 'os'
+import * as path from 'path'
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+
+const execSync = vi.fn<(command: string, options?: Record<string, unknown>) => string>()
+vi.mock('child_process', () => ({ execSync: (command: string, options?: Record<string, unknown>) => execSync(command, options) }))
+
+const platform = await import('./platform')
+
+const SESSION_VARIABLES = ['WAYLAND_DISPLAY', 'DISPLAY', 'XDG_SESSION_TYPE', 'XDG_CURRENT_DESKTOP', 'XDG_RUNTIME_DIR', 'APPIMAGE', 'APPDIR',
+  'HYPRLAND_INSTANCE_SIGNATURE', 'SWAYSOCK', 'NIRI_SOCKET']
+
+function clearSession(): void {
+  for (const name of SESSION_VARIABLES) vi.stubEnv(name, '')
+}
+
+function answer(answers: Record<string, string>): void {
+  execSync.mockImplementation((command: string) => {
+    const known = Object.keys(answers).find((name) => command.includes(name))
+    if (!known) throw new Error(`${command}: not found`)
+    return answers[known]
+  })
+}
+
+function asPlatform(name: NodeJS.Platform): void {
+  vi.spyOn(process, 'platform', 'get').mockReturnValue(name)
+}
+
+beforeEach(clearSession)
+
+afterEach(() => {
+  vi.unstubAllEnvs()
+  vi.restoreAllMocks()
+  execSync.mockReset()
+})
+
+describe('detectDisplayServer', () => {
+  it('prefers Wayland over X11 and knows when there is neither', () => {
+    expect(platform.detectDisplayServer()).toBe('unknown')
+    vi.stubEnv('DISPLAY', ':0')
+    expect(platform.detectDisplayServer()).toBe('x11')
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    expect(platform.detectDisplayServer()).toBe('wayland')
+  })
+
+  it('does not guess on other systems', () => {
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    asPlatform('win32')
+    expect(platform.detectDisplayServer()).toBe('unknown')
+    asPlatform('darwin')
+    expect(platform.detectDisplayServer()).toBe('unknown')
+  })
+})
+
+describe('detectDesktopEnv', () => {
+  it('reads XDG_CURRENT_DESKTOP, then the compositor markers', () => {
+    vi.stubEnv('XDG_CURRENT_DESKTOP', 'KDE')
+    expect(platform.detectDesktopEnv()).toBe('kde')
+    vi.stubEnv('XDG_CURRENT_DESKTOP', '')
+    vi.stubEnv('SWAYSOCK', '/run/sway.sock')
+    expect(platform.detectDesktopEnv()).toBe('sway')
+  })
+
+  it('is other on systems without these desktops', () => {
+    vi.stubEnv('XDG_CURRENT_DESKTOP', 'KDE')
+    asPlatform('win32')
+    expect(platform.detectDesktopEnv()).toBe('other')
+    asPlatform('darwin')
+    expect(platform.detectDesktopEnv()).toBe('other')
+  })
+})
+
+describe('runningAppImage', () => {
+  it('needs both variables and the executable inside the mount', () => {
+    vi.stubEnv('APPIMAGE', '/home/u/WE.AppImage')
+    vi.stubEnv('APPDIR', '/tmp/.mount_x')
+    expect(platform.runningAppImage()).toBeUndefined()
+    vi.stubEnv('APPDIR', path.dirname(process.execPath))
+    expect(platform.runningAppImage()).toBe('/home/u/WE.AppImage')
+    vi.stubEnv('APPIMAGE', '')
+    expect(platform.runningAppImage()).toBeUndefined()
+    vi.stubEnv('APPIMAGE', '/home/u/WE.AppImage')
+    vi.stubEnv('APPDIR', '')
+    expect(platform.runningAppImage()).toBeUndefined()
+  })
+})
+
+describe('Wayland session detection', () => {
+  it('counts WAYLAND_DISPLAY and the session type', () => {
+    expect(platform.isWaylandSession()).toBe(false)
+    vi.stubEnv('XDG_SESSION_TYPE', 'x11')
+    expect(platform.isWaylandSession()).toBe(false)
+    vi.stubEnv('XDG_SESSION_TYPE', 'wayland')
+    expect(platform.isWaylandSession()).toBe(true)
+    vi.stubEnv('XDG_SESSION_TYPE', '')
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-3')
+    expect(platform.isWaylandSession()).toBe(true)
+  })
+
+  it('takes the display from the environment first', () => {
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-3')
+    expect(platform.getWaylandDisplay()).toBe('wayland-3')
+    expect(execSync).not.toHaveBeenCalled()
+  })
+
+  it('assumes wayland-0 for a Wayland session under XWayland', () => {
+    vi.stubEnv('XDG_SESSION_TYPE', 'wayland')
+    expect(platform.getWaylandDisplay()).toBe('wayland-0')
+    expect(execSync).not.toHaveBeenCalled()
+  })
+
+  it('asks loginctl as the last resort', () => {
+    execSync.mockReturnValue('wayland\n')
+    expect(platform.getWaylandDisplay()).toBe('wayland-0')
+    expect(execSync.mock.calls[0][0]).toContain('loginctl show-session')
+    expect(execSync.mock.calls[0][1]).toEqual({ encoding: 'utf8', timeout: 3000 })
+    execSync.mockReturnValue('x11\n')
+    expect(platform.getWaylandDisplay()).toBeUndefined()
+    execSync.mockImplementation(() => {
+      throw new Error('no loginctl')
+    })
+    expect(platform.getWaylandDisplay()).toBeUndefined()
+  })
+})
+
+describe('getXdgRuntimeDir', () => {
+  it('uses the variable, else the per-user folder', () => {
+    vi.stubEnv('XDG_RUNTIME_DIR', '/run/custom')
+    expect(platform.getXdgRuntimeDir()).toBe('/run/custom')
+    vi.stubEnv('XDG_RUNTIME_DIR', '')
+    expect(platform.getXdgRuntimeDir()).toBe(`/run/user/${process.getuid?.() ?? 1000}`)
+  })
+})
+
+describe.skipIf(process.platform !== 'linux')('getMirroredScreens', () => {
+  const kscreen = JSON.stringify({ outputs: [{ name: 'DP-1', replicationSource: 0 }, { name: 'HDMI-A-1', replicationSource: 1 }] })
+
+  it('asks kscreen-doctor in a Plasma Wayland session', () => {
+    vi.stubEnv('XDG_SESSION_TYPE', 'wayland')
+    vi.stubEnv('XDG_CURRENT_DESKTOP', 'KDE')
+    answer({ 'kscreen-doctor -j': kscreen })
+    expect(platform.getMirroredScreens()).toEqual(['HDMI-A-1'])
+    expect(execSync.mock.calls[0][1]).toEqual({ encoding: 'utf8', timeout: 5000 })
+  })
+
+  it('stays out of other sessions and survives a failing tool', () => {
+    answer({ 'kscreen-doctor -j': kscreen })
+    expect(platform.getMirroredScreens()).toEqual([])
+    vi.stubEnv('XDG_SESSION_TYPE', 'wayland')
+    expect(platform.getMirroredScreens()).toEqual([])
+    vi.stubEnv('XDG_CURRENT_DESKTOP', 'KDE')
+    answer({})
+    expect(platform.getMirroredScreens()).toEqual([])
+    asPlatform('darwin')
+    answer({ 'kscreen-doctor -j': kscreen })
+    expect(platform.getMirroredScreens()).toEqual([])
+  })
+})
+
+describe.skipIf(process.platform !== 'linux')('getConnectedScreens beyond the compositor tools', () => {
+  it('reads kscreen-doctor, stripping its colours', () => {
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    answer({ 'kscreen-doctor --outputs': '\x1b[01;32mOutput: \x1b[0m1 DP-1 enabled\nOutput: 2 HDMI-A-1 enabled\nnoise\n' })
+    expect(platform.getConnectedScreens()).toEqual(['DP-1', 'HDMI-A-1'])
+  })
+
+  it('reads the connectors out of GNOME\'s display state', () => {
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    answer({ gdbus: "(uint32 4, [(('DP-1', 'DEL', 'U2720Q', '123'), [], {}), (('eDP-1', 'AUO', 'x', 'y'), [], {})], [], {})" })
+    expect(platform.getConnectedScreens()).toEqual(['DP-1', 'eDP-1'])
+  })
+
+  it('lists a connector once even when GNOME names it twice', () => {
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    answer({ gdbus: "(('DP-1', 'A', 'B', 'C'), []), (('DP-1', 'A', 'B', 'C'), [])" })
+    expect(platform.getConnectedScreens()).toEqual(['DP-1'])
+  })
+
+  it('falls back to xrandr, also in a plain X11 session', () => {
+    const xrandr = 'Screen 0: minimum 8 x 8\nDP-1 connected primary 1920x1080+0+0\nHDMI-1 disconnected\nHDMI-2 connected 1280x720+1920+0\n'
+    answer({ 'xrandr --query': xrandr })
+    expect(platform.getConnectedScreens()).toEqual(['DP-1', 'HDMI-2'])
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    expect(platform.getConnectedScreens()).toEqual(['DP-1', 'HDMI-2'])
+  })
+
+  it('has nothing without any tool, and nothing off Linux', () => {
+    answer({})
+    expect(platform.getConnectedScreens()).toEqual([])
+    asPlatform('win32')
+    answer({ 'xrandr --query': 'DP-1 connected\n' })
+    expect(platform.getConnectedScreens()).toEqual([])
+  })
+
+  it('goes on to the next tool when one prints no outputs', () => {
+    vi.stubEnv('WAYLAND_DISPLAY', 'wayland-0')
+    answer({ 'wlr-randr': '  indented only\n', 'kscreen-doctor --outputs': 'Output: 1 DP-1\n' })
+    expect(platform.getConnectedScreens()).toEqual(['DP-1'])
+  })
+})
+
+describe('getScreenGeometry', () => {
+  const xrandr = 'DP-1 connected primary 2560x1440+1920+0\nHDMI-1 connected 1920x1080+0+0\n'
+
+  it('gives the named screen, else the first one', () => {
+    answer({ xrandr })
+    expect(platform.getScreenGeometry('HDMI-1')).toBe('0x0x1920x1080')
+    expect(platform.getScreenGeometry('missing')).toBe('1920x0x2560x1440')
+    expect(platform.getScreenGeometry()).toBe('1920x0x2560x1440')
+  })
+
+  it('is null without a screen or a tool', () => {
+    answer({ xrandr: 'nothing here\n' })
+    expect(platform.getScreenGeometry()).toBeNull()
+    answer({})
+    expect(platform.getScreenGeometry('DP-1')).toBeNull()
+  })
+})
+
+describe('parsers on edge input', () => {
+  it('ignores xrandr lines that are not an output geometry', () => {
+    expect([...platform.parseXrandrGeometries('DP-1 connected 1920x1080\n  1920x1080 60.00*\n')]).toEqual([])
+  })
+
+  it('reads a gdbus answer with spaces and nothing else', () => {
+    expect(platform.parseNameHasOwner('(true,)')).toBe(true)
+    expect(platform.parseNameHasOwner('( false ,)')).toBe(false)
+    expect(platform.parseNameHasOwner('b  true')).toBe(true)
+    expect(platform.parseNameHasOwner('b trueish')).toBeNull()
+    expect(platform.parseNameHasOwner('x true')).toBeNull()
+  })
+
+  it('treats a kscreen answer without outputs or names as empty', () => {
+    expect(platform.parseKscreenMirrors(JSON.stringify({ outputs: [{ replicationSource: 3 }, { name: '', replicationSource: 3 }] }))).toEqual([])
+  })
+
+  it('keeps a niri output whose current_mode is missing from the report', () => {
+    expect(platform.parseNiriOutputs('{"a":{"current_mode":null},"b":{}}')).toEqual(['b'])
+    expect(platform.parseNiriOutputs('[1]')).toEqual([])
+    expect(platform.parseNiriOutputs('null')).toEqual([])
+  })
+
+  it('skips entries without a name in monitor lists', () => {
+    expect(platform.parseHyprctlMonitors('[null, {"name":""}, {"name":3}, {"name":"A"}]')).toEqual(['A'])
+    expect(platform.parseSwayOutputs('[null, {"name":""}, {"name":"B","active":false}, {"name":"C"}]')).toEqual(['C'])
+  })
+})
+
+describe.skipIf(process.platform !== 'linux')('isCommandAvailable', () => {
+  const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'wem-path-'))
+  const tool = `tool-${process.pid}`
+
+  afterEach(() => { platform.invalidateCommandCache(tool) })
+
+  it('searches PATH for an executable file and remembers the answer', () => {
+    vi.stubEnv('PATH', dir)
+    expect(platform.isCommandAvailable(tool)).toBe(false)
+    fs.writeFileSync(path.join(dir, tool), '#!/bin/sh\n', { mode: 0o755 })
+    expect(platform.isCommandAvailable(tool)).toBe(false)
+    platform.invalidateCommandCache(tool)
+    expect(platform.isCommandAvailable(tool)).toBe(true)
+    fs.rmSync(path.join(dir, tool))
+    expect(platform.isCommandAvailable(tool)).toBe(true)
+    platform.invalidateCommandCache(tool)
+    expect(platform.isCommandAvailable(tool)).toBe(false)
+  })
+
+  it('does not count a file that is not executable', () => {
+    vi.stubEnv('PATH', dir)
+    fs.writeFileSync(path.join(dir, tool), 'data', { mode: 0o644 })
+    expect(platform.isCommandAvailable(tool)).toBe(false)
+    fs.rmSync(path.join(dir, tool))
+  })
+
+  it('has no command to find on an empty PATH', () => {
+    vi.stubEnv('PATH', '')
+    expect(platform.isCommandAvailable(tool)).toBe(false)
+  })
+
+  it('asks where(1) on Windows', () => {
+    asPlatform('win32')
+    answer({ 'where wintool': '' })
+    expect(platform.isCommandAvailable('wintool')).toBe(true)
+    answer({})
+    expect(platform.isCommandAvailable('othertool')).toBe(false)
+    platform.invalidateCommandCache('wintool')
+    platform.invalidateCommandCache('othertool')
+  })
+})
+
+describe('whichCommand', () => {
+  it('returns the trimmed path of the program', () => {
+    answer({ 'which git': '/usr/bin/git\n' })
+    expect(platform.whichCommand('git')).toBe('/usr/bin/git')
+    expect(execSync.mock.calls[0][0]).toBe('which git')
+  })
+
+  it('uses where(1) on Windows and gives undefined when nothing is found', () => {
+    asPlatform('win32')
+    answer({ 'where git': 'C:\\git.exe\r\n' })
+    expect(platform.whichCommand('git')).toBe('C:\\git.exe')
+    answer({})
+    expect(platform.whichCommand('git')).toBeUndefined()
+  })
+})

+ 8 - 2
src/main/utils/platform.ts

@@ -61,12 +61,17 @@ function parseJson(output: string): unknown {
   }
 }
 
+function isNamed(v: unknown): v is { name: string; [key: string]: unknown } {
+  return typeof v === 'object' && v !== null && typeof (v as { name?: unknown }).name === 'string' && (v as { name: string }).name !== ''
+}
+
 /** `hyprctl monitors -j`: an array of monitors, a disabled one has no output to draw on */
 export function parseHyprctlMonitors(output: string): string[] {
   const monitors = parseJson(output)
   if (!Array.isArray(monitors)) return []
   return monitors
-    .filter(m => m && typeof m.name === 'string' && m.name && m.disabled !== true)
+    .filter(isNamed)
+    .filter(m => m.disabled !== true)
     .map(m => m.name)
 }
 
@@ -75,7 +80,8 @@ export function parseSwayOutputs(output: string): string[] {
   const outputs = parseJson(output)
   if (!Array.isArray(outputs)) return []
   return outputs
-    .filter(o => o && typeof o.name === 'string' && o.name && o.active !== false)
+    .filter(isNamed)
+    .filter(o => o.active !== false)
     .map(o => o.name)
 }
 

+ 104 - 3
src/main/utils/relaunch.test.ts

@@ -1,8 +1,35 @@
-import { describe, expect, it, vi } from 'vitest'
+import * as os from 'os'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
 
-vi.mock('electron', () => ({ app: {} }))
+const { app, unref, spawn, runningAppImage } = vi.hoisted(() => {
+  const unref = vi.fn<() => void>()
+  return {
+    app: {
+      relaunch: vi.fn<(options: { args: string[] }) => void>(),
+      quit: vi.fn<() => void>(),
+      exit: vi.fn<(code: number) => void>(),
+      releaseSingleInstanceLock: vi.fn<() => void>()
+    },
+    unref,
+    spawn: vi.fn<(cmd: string, args: string[], opts: object) => { unref: () => void }>(() => ({ unref })),
+    runningAppImage: vi.fn<() => string | undefined>()
+  }
+})
+
+vi.mock('electron', () => ({ app }))
+vi.mock('child_process', () => ({ spawn }))
+vi.mock('./platform', () => ({ runningAppImage }))
+
+import { appImageFreeEnv, relaunchApp } from './relaunch'
 
-import { appImageFreeEnv } from './relaunch'
+beforeEach(() => {
+  app.relaunch.mockReset()
+  app.quit.mockReset()
+  app.exit.mockReset()
+  spawn.mockClear()
+  unref.mockClear()
+  runningAppImage.mockReset()
+})
 
 describe('appImageFreeEnv', () => {
   it('drops the AppImage variables and the old mount from path lists', () => {
@@ -28,3 +55,77 @@ describe('appImageFreeEnv', () => {
     expect(env.PATH).toBe('/tmp/.mount_ab/bin:/usr/bin')
   })
 })
+
+describe('appImageFreeEnv without an AppImage mount', () => {
+  it('only drops the AppImage variables and leaves the path lists alone', () => {
+    const input = { APPIMAGE: '/x.AppImage', PATH: '/usr/bin:/bin', LD_LIBRARY_PATH: '/opt/lib' }
+    const env = appImageFreeEnv(input)
+    expect(env).toEqual({ PATH: '/usr/bin:/bin', LD_LIBRARY_PATH: '/opt/lib' })
+    expect(input.APPIMAGE).toBe('/x.AppImage')
+  })
+
+  it('removes a path list that only held the mount or nothing, and skips unset ones', () => {
+    const env = appImageFreeEnv({ APPDIR: '/tmp/.mount_a', LD_LIBRARY_PATH: '/tmp/.mount_a/usr/lib:/tmp/.mount_a', GSETTINGS_SCHEMA_DIR: '' })
+    expect(env).toEqual({})
+  })
+
+  it('keeps entries elsewhere in a list that mentions the mount', () => {
+    const env = appImageFreeEnv({ APPDIR: '/tmp/.mount_a', PATH: '/usr/bin:/tmp/.mount_a/usr/bin:/bin' })
+    expect(env.PATH).toBe('/usr/bin:/bin')
+  })
+})
+
+describe('relaunchApp', () => {
+  it("lets Electron relaunch with the given arguments and quits outside an AppImage", () => {
+    runningAppImage.mockReturnValue(undefined)
+    relaunchApp(['--hidden'])
+    expect(app.relaunch).toHaveBeenCalledWith({ args: ['--hidden'] })
+    expect(app.quit).toHaveBeenCalledTimes(1)
+    expect(app.exit).not.toHaveBeenCalled()
+    expect(spawn).not.toHaveBeenCalled()
+  })
+
+  it('exits instead of quitting when asked to', () => {
+    runningAppImage.mockReturnValue(undefined)
+    relaunchApp([], 'exit')
+    expect(app.exit).toHaveBeenCalledWith(0)
+    expect(app.quit).not.toHaveBeenCalled()
+  })
+
+  it('starts an AppImage itself, detached, in the folder it was started from', () => {
+    runningAppImage.mockReturnValue('/home/u/WE.AppImage')
+    vi.stubEnv('OWD', '/home/u/start')
+    vi.stubEnv('APPDIR', '/tmp/.mount_a')
+    relaunchApp(['--minimized'])
+    expect(app.relaunch).not.toHaveBeenCalled()
+    expect(spawn).toHaveBeenCalledTimes(1)
+    const [cmd, args, opts] = spawn.mock.calls[0] as unknown as [string, string[], { detached: boolean; stdio: string; cwd: string; env: NodeJS.ProcessEnv }]
+    expect(cmd).toBe('bash')
+    expect(args[0]).toBe('-c')
+    expect(args.slice(2)).toEqual(['/home/u/WE.AppImage', '--minimized'])
+    expect(opts).toMatchObject({ detached: true, stdio: 'ignore', cwd: '/home/u/start' })
+    expect(opts.env.APPDIR).toBeUndefined()
+    expect(opts.env.OWD).toBeUndefined()
+    expect(unref).toHaveBeenCalledTimes(1)
+    expect(app.releaseSingleInstanceLock.mock.invocationCallOrder[0]).toBeLessThan(spawn.mock.invocationCallOrder[0])
+    expect(app.quit).toHaveBeenCalledTimes(1)
+    vi.unstubAllEnvs()
+  })
+
+  it('falls back to the home folder without OWD', () => {
+    runningAppImage.mockReturnValue('/home/u/WE.AppImage')
+    vi.stubEnv('OWD', '')
+    relaunchApp([])
+    expect((spawn.mock.calls[0] as unknown as [string, string[], { cwd: string }])[2].cwd).toBe(os.homedir())
+    vi.unstubAllEnvs()
+  })
+
+  it('closes inherited descriptors before it execs the AppImage', () => {
+    runningAppImage.mockReturnValue('/home/u/WE.AppImage')
+    relaunchApp([])
+    const script = (spawn.mock.calls[0] as unknown as [string, string[]])[1][1]
+    expect(script).toContain('/proc/$$/fd/*')
+    expect(script).toContain('[ "$fd" -gt 2 ]')
+    expect(script).toContain('exec "$0" "$@"')
+  })
+})

+ 1 - 0
src/main/utils/relaunch.ts

@@ -30,6 +30,7 @@ const CLOSE_FDS_AND_EXEC = 'for fd in /proc/$$/fd/*; do fd=${fd##*/}; [ "$fd" -g
 export function relaunchApp(args: string[] = process.argv.slice(1), quit: 'quit' | 'exit' = 'quit'): void {
   const appImage = runningAppImage()
   if (appImage) {
+    app.releaseSingleInstanceLock()
     spawn('bash', ['-c', CLOSE_FDS_AND_EXEC, appImage, ...args], {
       detached: true,
       stdio: 'ignore',

+ 136 - 0
src/main/utils/video.test.ts

@@ -0,0 +1,136 @@
+import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
+import * as fs from 'fs'
+import * as os from 'os'
+import * as path from 'path'
+
+type Callback = (error: Error | null, result?: { stdout: string }) => void
+
+const execFile = vi.fn<(cmd: string, args: string[], opts: unknown, done: Callback) => void>()
+const isCommandAvailable = vi.fn<(cmd: string) => boolean>()
+
+vi.mock('child_process', () => ({ execFile }))
+vi.mock('./platform', () => ({ isCommandAvailable }))
+
+const { findWallpaperVideoFile, getVideoFps, getVideoDurationSec } = await import('./video')
+
+function probeReturns(stdout: string): void {
+  execFile.mockImplementation((_cmd: string, _args: string[], _opts: unknown, done: Callback) => { done(null, { stdout }) })
+}
+
+let dir = ''
+
+beforeEach(() => {
+  dir = fs.mkdtempSync(path.join(os.tmpdir(), 'wem-video-'))
+  execFile.mockReset()
+  isCommandAvailable.mockReset()
+  isCommandAvailable.mockReturnValue(true)
+})
+
+afterEach(() => {
+  fs.rmSync(dir, { recursive: true, force: true })
+})
+
+describe('findWallpaperVideoFile', () => {
+  it('uses the file project.json names when it exists', () => {
+    fs.writeFileSync(path.join(dir, 'a.mp4'), '')
+    fs.writeFileSync(path.join(dir, 'b.mp4'), '')
+    expect(findWallpaperVideoFile(dir, 'b.mp4')).toBe(path.join(dir, 'b.mp4'))
+  })
+
+  it('falls back to the first video by extension, any case', () => {
+    fs.writeFileSync(path.join(dir, 'notes.txt'), '')
+    fs.writeFileSync(path.join(dir, 'clip.MKV'), '')
+    expect(findWallpaperVideoFile(dir, 'missing.mp4')).toBe(path.join(dir, 'clip.MKV'))
+  })
+
+  it('is undefined without a video or for a missing folder', () => {
+    fs.writeFileSync(path.join(dir, 'preview.gif'), '')
+    expect(findWallpaperVideoFile(dir)).toBeUndefined()
+    expect(findWallpaperVideoFile(path.join(dir, 'nope'))).toBeUndefined()
+  })
+})
+
+describe('getVideoFps', () => {
+  it('rounds the frame rate and prefers r_frame_rate', () => {
+    probeReturns('30000/1001,25/1\n')
+    return expect(getVideoFps('/v/ntsc.mp4')).resolves.toBe(30)
+  })
+
+  it('uses avg_frame_rate when the first one is unusable', async () => {
+    probeReturns('0/0,60/1\n')
+    expect(await getVideoFps('/v/avg.mp4')).toBe(60)
+  })
+
+  it('asks ffprobe for the first video stream of that file', async () => {
+    probeReturns('25/1,25/1\n')
+    await getVideoFps('/v/args.mp4')
+    expect(execFile).toHaveBeenCalledWith(
+      'ffprobe',
+      ['-v', 'error', '-select_streams', 'v:0', '-show_entries', 'stream=r_frame_rate,avg_frame_rate', '-of', 'csv=p=0', '/v/args.mp4'],
+      { timeout: 10_000, encoding: 'utf8' },
+      expect.any(Function)
+    )
+  })
+
+  it('does not round a rate to zero or keep a negative one', async () => {
+    probeReturns('0/1,-5/1\n')
+    expect(await getVideoFps('/v/zero.mp4')).toBeUndefined()
+  })
+
+  it('caches per file', async () => {
+    probeReturns('24/1,24/1\n')
+    await getVideoFps('/v/cached.mp4')
+    await getVideoFps('/v/cached.mp4')
+    expect(execFile).toHaveBeenCalledTimes(1)
+  })
+
+  it('is undefined without ffprobe, and on a probe error', async () => {
+    isCommandAvailable.mockReturnValue(false)
+    expect(await getVideoFps('/v/noprobe.mp4')).toBeUndefined()
+    expect(execFile).not.toHaveBeenCalled()
+
+    isCommandAvailable.mockReturnValue(true)
+    execFile.mockImplementation((_c: string, _a: string[], _o: unknown, done: Callback) => { done(new Error('boom')) })
+    expect(await getVideoFps('/v/broken.mp4')).toBeUndefined()
+  })
+})
+
+describe('getVideoDurationSec', () => {
+  it('parses the duration', async () => {
+    probeReturns('12.5\n')
+    expect(await getVideoDurationSec('/v/dur.mp4')).toBe(12.5)
+  })
+
+  it('asks ffprobe for the container duration', async () => {
+    probeReturns('3\n')
+    await getVideoDurationSec('/v/dargs.mp4')
+    expect(execFile).toHaveBeenCalledWith(
+      'ffprobe',
+      ['-v', 'error', '-show_entries', 'format=duration', '-of', 'csv=p=0', '/v/dargs.mp4'],
+      { timeout: 10_000, encoding: 'utf8' },
+      expect.any(Function)
+    )
+  })
+
+  it('caches per file and skips ffprobe when it is missing', async () => {
+    probeReturns('8\n')
+    await getVideoDurationSec('/v/dcache.mp4')
+    await getVideoDurationSec('/v/dcache.mp4')
+    expect(execFile).toHaveBeenCalledTimes(1)
+
+    isCommandAvailable.mockReturnValue(false)
+    expect(await getVideoDurationSec('/v/dnone.mp4')).toBeUndefined()
+  })
+
+  it('is undefined when the probe fails', async () => {
+    execFile.mockImplementation((_c: string, _a: string[], _o: unknown, done: Callback) => { done(new Error('boom')) })
+    expect(await getVideoDurationSec('/v/dfail.mp4')).toBeUndefined()
+  })
+
+  it('rejects zero and garbage', async () => {
+    probeReturns('N/A\n')
+    expect(await getVideoDurationSec('/v/na.mp4')).toBeUndefined()
+    probeReturns('0\n')
+    expect(await getVideoDurationSec('/v/zero.mp4')).toBeUndefined()
+  })
+})

+ 38 - 0
src/main/utils/wallpaperScripts.test.ts

@@ -38,7 +38,45 @@ describe('plasmaWallpaperScript', () => {
   })
 })
 
+describe('plasmaWallpaperScript settings', () => {
+  it('sets the image plugin and writes into every desktop', () => {
+    const seen: { plugin?: string; group?: string[]; key?: string }[] = []
+    const make = () => {
+      const entry: { plugin?: string; group?: string[]; key?: string } = {}
+      seen.push(entry)
+      return {
+        set wallpaperPlugin(v: string) {
+          entry.plugin = v
+        },
+        set currentConfigGroup(v: string[]) {
+          entry.group = v
+        },
+        writeConfig: (key: string) => {
+          entry.key = key
+        }
+      }
+    }
+    new Function('desktops', plasmaWallpaperScript('/a.png'))(() => [make(), make(), make()])
+    expect(seen).toHaveLength(3)
+    for (const entry of seen) {
+      expect(entry).toEqual({ plugin: 'org.kde.image', group: ['Wallpaper', 'org.kde.image', 'General'], key: 'Image' })
+    }
+  })
+})
+
 describe('finderWallpaperArgs', () => {
+  it('is an osascript program with the path as argv', () => {
+    expect(finderWallpaperArgs('/x.png')).toEqual([
+      '-e',
+      'on run argv',
+      '-e',
+      'tell application "Finder" to set desktop picture to POSIX file (item 1 of argv)',
+      '-e',
+      'end run',
+      '/x.png'
+    ])
+  })
+
   it('passes the path as an argument, not inside the AppleScript', () => {
     const path = '/Users/u/a" & (do shell script "id") & ".png'
     const args = finderWallpaperArgs(path)

+ 30 - 91
src/preload/index.ts

@@ -4,14 +4,14 @@ import type { Appearance } from '../shared/appearance'
 import type { Language, LanguagePreference } from '../shared/i18n'
 import type { CardBorders } from '../shared/cardBorders'
 import type { CardBadges } from '../shared/cardBadges'
-import type { DesktopEnvironment } from '../shared/desktop'
 import type {
+  AppConfigSnapshot,
+  HotswapSettings,
   WorkshopQueryParams,
   WorkshopQueryResult,
   WorkshopItem,
   CreatorWorkshopQueryParams,
   WallpaperMeta,
-  XrayMode,
   WallpaperFolder,
   LibraryFilters,
   WorkshopAuthorInfo,
@@ -39,9 +39,9 @@ import type {
   PlaylistPlaybackState,
   SteamIdentity,
   LedSettings,
+  LoaderSettings,
   ExtraLibrary,
   EngineFlags,
-  ImageAdjustments,
   EngineFlagPreset,
   DisplayMode,
   ScreenTarget,
@@ -57,7 +57,6 @@ import type {
   GraphicsWarning,
   UpdateTarget
 } from '../shared/types'
-import type { VideoSegment } from '../shared/videoTrim'
 
 const api = {
   workshop: {
@@ -106,7 +105,7 @@ const api = {
       ipcRenderer.invoke(IpcChannels.STEAM_GET_FAVORITE_IDS),
     getFavoriteStatus: (): Promise<FavoriteStatus> =>
       ipcRenderer.invoke(IpcChannels.STEAM_GET_FAVORITE_STATUS),
-    getAuthorInfo: (steamId: string): Promise<WorkshopAuthorInfo | null> =>
+    getAuthorInfo: (steamId: string): Promise<WorkshopAuthorInfo> =>
       ipcRenderer.invoke(IpcChannels.STEAM_GET_AUTHOR_INFO, steamId)
   },
 
@@ -143,55 +142,13 @@ const api = {
   },
 
   config: {
-    get: (): Promise<{
-      workshopPath: string | null
-      defaultWorkshopPath: string
-      extraLibraries: ExtraLibrary[]
-      isConfigured: boolean
-      defaultFps: number | null
-      recommendedFpsEnabled: boolean
-      recommendedWebFpsEnabled: boolean
-      lweRepoUrl: string | null
-      lweRepoBranch: string | null
-      lweCmakeArgs: string | null
-      defaultLweRepoUrl: string
-      backupPath: string | null
-      isBackupConfigured: boolean
-      autoUnsubscribeAfterBackup: boolean
-      trayEnabled: boolean
-      autostartSupported: boolean
-      autostartCompositorLine: string | null
-      autostartEnabled: boolean
-      autostartMinimized: boolean
-      autostartPlaylistId: string | null
-      killLweOnQuit: boolean
-      cardBorders: CardBorders
-      cardBadges: CardBadges
-      audioScreen: string | null
-      ambientVolume: number | null
-      defaultAudioSensitivity: number
-      disablePuppetAnimation: boolean
-      scriptLimits: boolean
-      leds: LedSettings
-      disableAnimations: boolean
-      steamIdentity: SteamIdentity
-      ignoredCreators: string[]
-      engineFlags: EngineFlags
-      engineFlagPresets: EngineFlagPreset[]
-      displayMode: DisplayMode
-      disabledScreens: string[]
-      splitScreens: Record<string, SplitScreen>
-      appearance: Appearance
-      language: LanguagePreference
-      uiLanguage: Language
-      appearanceRestartNeeded: boolean
-      windowTranslucent: boolean
-      desktopEnv: DesktopEnvironment
-    }> => ipcRenderer.invoke(IpcChannels.CONFIG_GET),
+    get: (): Promise<AppConfigSnapshot> => ipcRenderer.invoke(IpcChannels.CONFIG_GET),
     setEngineFlags: (flags: EngineFlags): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_ENGINE_FLAGS, flags),
     setEnginePresets: (presets: EngineFlagPreset[]): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_ENGINE_PRESETS, presets),
+    resetEngineSettings: (): Promise<{ ok: boolean }> =>
+      ipcRenderer.invoke(IpcChannels.CONFIG_RESET_ENGINE_SETTINGS),
     setDisabledScreens: (screens: string[]): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_DISABLED_SCREENS, screens),
     setDisplayMode: (mode: DisplayMode): Promise<{ ok: boolean }> =>
@@ -226,6 +183,8 @@ const api = {
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_TRAY_ENABLED, enabled),
     setKillLweOnQuit: (enabled: boolean): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_KILL_LWE_ON_QUIT, enabled),
+    setSkipPlaylistResume: (enabled: boolean): Promise<{ ok: boolean }> =>
+      ipcRenderer.invoke(IpcChannels.CONFIG_SET_SKIP_PLAYLIST_RESUME, enabled),
     setCardBorders: (borders: CardBorders): Promise<CardBorders> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_CARD_BORDERS, borders),
     setCardBadges: (badges: CardBadges): Promise<CardBadges> =>
@@ -252,6 +211,8 @@ const api = {
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_DISABLE_PUPPET_ANIMATION, disabled),
     setScriptLimits: (enabled: boolean): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_SCRIPT_LIMITS, enabled),
+    setLoader: (loader: LoaderSettings): Promise<{ ok: boolean }> =>
+      ipcRenderer.invoke(IpcChannels.CONFIG_SET_LOADER, loader),
     setLeds: (leds: LedSettings): Promise<{ ok: boolean }> => ipcRenderer.invoke(IpcChannels.CONFIG_SET_LEDS, leds),
     setSteamIdentity: (identity: SteamIdentity): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.CONFIG_SET_STEAM_IDENTITY, identity),
@@ -377,29 +338,7 @@ const api = {
       ipcRenderer.invoke(IpcChannels.LWE_KILL_ALL),
     listObjects: (wallpaperPath: string): Promise<LweSceneObject[]> =>
       ipcRenderer.invoke(IpcChannels.LWE_LIST_OBJECTS, wallpaperPath),
-    hotswapSettings: (options: {
-      disabledObjects?: string[]
-      enabledObjects?: string[]
-      volume?: number
-      xray?: XrayMode
-      scaling?: string
-      zoom?: number
-      offsetX?: number
-      offsetY?: number
-      disableParallax?: boolean
-      expandCanvas?: boolean
-      repairAssets?: boolean
-      cornerColor?: string
-      imageAdjustments?: ImageAdjustments
-      speed?: number
-      videoSegments?: VideoSegment[]
-      videoSeek?: number
-      propertyOverrides?: Record<string, string>
-      audioScreen?: string
-      ambientVolume?: number
-      audioSensitivity?: Record<string, number>
-      soundVolume?: Record<string, number>
-    }, wallpaperPath?: string): Promise<{ ok: boolean }> =>
+    hotswapSettings: (options: HotswapSettings, wallpaperPath?: string): Promise<{ ok: boolean }> =>
       ipcRenderer.invoke(IpcChannels.LWE_HOTSWAP_SETTINGS, options, wallpaperPath),
     listProperties: (wallpaperPath: string): Promise<LweProperty[]> =>
       ipcRenderer.invoke(IpcChannels.LWE_LIST_PROPERTIES, wallpaperPath),
@@ -517,92 +456,92 @@ const api = {
 
   on: {
     downloadProgress: (cb: (info: DownloadProgressEvent) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, info: DownloadProgressEvent) => cb(info)
+      const listener = (_: Electron.IpcRendererEvent, info: DownloadProgressEvent) => { cb(info) }
       ipcRenderer.on(IpcChannels.EVENT_DOWNLOAD_PROGRESS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_DOWNLOAD_PROGRESS, listener)
     },
     wallpaperImported: (cb: (meta: WallpaperMeta) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, meta: WallpaperMeta) => cb(meta)
+      const listener = (_: Electron.IpcRendererEvent, meta: WallpaperMeta) => { cb(meta) }
       ipcRenderer.on(IpcChannels.EVENT_WALLPAPER_IMPORTED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_WALLPAPER_IMPORTED, listener)
     },
     steamStatus: (cb: (running: boolean) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, running: boolean) => cb(running)
+      const listener = (_: Electron.IpcRendererEvent, running: boolean) => { cb(running) }
       ipcRenderer.on(IpcChannels.EVENT_STEAM_STATUS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_STEAM_STATUS, listener)
     },
     lweInstallProgress: (cb: (progress: LweInstallProgress) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, progress: LweInstallProgress) => cb(progress)
+      const listener = (_: Electron.IpcRendererEvent, progress: LweInstallProgress) => { cb(progress) }
       ipcRenderer.on(IpcChannels.EVENT_LWE_INSTALL_PROGRESS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_LWE_INSTALL_PROGRESS, listener)
     },
     verifyProgress: (cb: (progress: VerifyProgressEvent) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, progress: VerifyProgressEvent) => cb(progress)
+      const listener = (_: Electron.IpcRendererEvent, progress: VerifyProgressEvent) => { cb(progress) }
       ipcRenderer.on(IpcChannels.EVENT_VERIFY_PROGRESS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_VERIFY_PROGRESS, listener)
     },
     repairProgress: (cb: (progress: VerifyProgressEvent) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, progress: VerifyProgressEvent) => cb(progress)
+      const listener = (_: Electron.IpcRendererEvent, progress: VerifyProgressEvent) => { cb(progress) }
       ipcRenderer.on(IpcChannels.EVENT_REPAIR_PROGRESS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_REPAIR_PROGRESS, listener)
     },
     backupProgress: (cb: (progress: BackupProgressEvent) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, progress: BackupProgressEvent) => cb(progress)
+      const listener = (_: Electron.IpcRendererEvent, progress: BackupProgressEvent) => { cb(progress) }
       ipcRenderer.on(IpcChannels.EVENT_BACKUP_PROGRESS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_BACKUP_PROGRESS, listener)
     },
     playlistStateChanged: (cb: (states: PlaylistPlaybackState[]) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, states: PlaylistPlaybackState[]) => cb(states)
+      const listener = (_: Electron.IpcRendererEvent, states: PlaylistPlaybackState[]) => { cb(states) }
       ipcRenderer.on(IpcChannels.EVENT_PLAYLIST_STATE_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_PLAYLIST_STATE_CHANGED, listener)
     },
     votedIdsChanged: (cb: (ids: string[]) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, ids: string[]) => cb(ids)
+      const listener = (_: Electron.IpcRendererEvent, ids: string[]) => { cb(ids) }
       ipcRenderer.on(IpcChannels.EVENT_VOTED_IDS_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_VOTED_IDS_CHANGED, listener)
     },
     dislikedIdsChanged: (cb: (ids: string[]) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, ids: string[]) => cb(ids)
+      const listener = (_: Electron.IpcRendererEvent, ids: string[]) => { cb(ids) }
       ipcRenderer.on(IpcChannels.EVENT_DISLIKED_IDS_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_DISLIKED_IDS_CHANGED, listener)
     },
     favoriteIdsChanged: (cb: (ids: string[]) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, ids: string[]) => cb(ids)
+      const listener = (_: Electron.IpcRendererEvent, ids: string[]) => { cb(ids) }
       ipcRenderer.on(IpcChannels.EVENT_FAVORITE_IDS_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_FAVORITE_IDS_CHANGED, listener)
     },
     favoriteStatusChanged: (cb: (status: FavoriteStatus) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, status: FavoriteStatus) => cb(status)
+      const listener = (_: Electron.IpcRendererEvent, status: FavoriteStatus) => { cb(status) }
       ipcRenderer.on(IpcChannels.EVENT_FAVORITE_STATUS_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_FAVORITE_STATUS_CHANGED, listener)
     },
     failedVotesChanged: (cb: (failed: Record<string, string>) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, failed: Record<string, string>) => cb(failed)
+      const listener = (_: Electron.IpcRendererEvent, failed: Record<string, string>) => { cb(failed) }
       ipcRenderer.on(IpcChannels.EVENT_FAILED_VOTES_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_FAILED_VOTES_CHANGED, listener)
     },
     libraryChanged: (cb: () => void): (() => void) => {
-      const listener = () => cb()
+      const listener = () => { cb() }
       ipcRenderer.on(IpcChannels.EVENT_LIBRARY_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_LIBRARY_CHANGED, listener)
     },
     displayChanged: (cb: () => void): (() => void) => {
-      const listener = () => cb()
+      const listener = () => { cb() }
       ipcRenderer.on(IpcChannels.EVENT_DISPLAY_CHANGED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_DISPLAY_CHANGED, listener)
     },
     wallpaperCrashed: (cb: (event: CrashEvent) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, event: CrashEvent) => cb(event)
+      const listener = (_: Electron.IpcRendererEvent, event: CrashEvent) => { cb(event) }
       ipcRenderer.on(IpcChannels.EVENT_WALLPAPER_CRASHED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_WALLPAPER_CRASHED, listener)
     },
     scheduleFired: (cb: (ruleName: string) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, ruleName: string) => cb(ruleName)
+      const listener = (_: Electron.IpcRendererEvent, ruleName: string) => { cb(ruleName) }
       ipcRenderer.on(IpcChannels.EVENT_SCHEDULE_FIRED, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_SCHEDULE_FIRED, listener)
     },
     updateStatus: (cb: (status: UpdateStatus) => void): (() => void) => {
-      const listener = (_: Electron.IpcRendererEvent, status: UpdateStatus) => cb(status)
+      const listener = (_: Electron.IpcRendererEvent, status: UpdateStatus) => { cb(status) }
       ipcRenderer.on(IpcChannels.EVENT_UPDATE_STATUS, listener)
       return () => ipcRenderer.off(IpcChannels.EVENT_UPDATE_STATUS, listener)
     }

+ 17 - 15
src/renderer/src/App.tsx

@@ -61,7 +61,7 @@ export default function App() {
 
   useEffect(() => {
     if (!config) return
-    const apply = (): void => applyAppearance(config.appearance, config.windowTranslucent)
+    const apply = (): void => { applyAppearance(config.appearance, config.windowTranslucent) }
     apply()
     return onSystemThemeChange(apply)
   }, [config])
@@ -70,7 +70,7 @@ export default function App() {
     window.electronAPI.config.get().then((cfg) => {
       setDefaultPath(cfg.defaultWorkshopPath)
       setSetupDone(cfg.isConfigured)
-    })
+    }).catch(console.error)
   }, [])
 
   // here so install progress survives leaving Settings
@@ -126,7 +126,7 @@ export default function App() {
       if (timer) return
       timer = setTimeout(() => {
         timer = null
-        queryClient.invalidateQueries({ queryKey: ['library'] })
+        void queryClient.invalidateQueries({ queryKey: ['library'] })
       }, 500)
     })
     return () => {
@@ -149,7 +149,7 @@ export default function App() {
   }, [queryClient])
 
   useEffect(() => {
-    return window.electronAPI.on.scheduleFired((name) => showToast(t('schedule.fired', { name })))
+    return window.electronAPI.on.scheduleFired((name) => { showToast(t('schedule.fired', { name })) })
   }, [showToast])
 
   if (setupDone === null) return null
@@ -158,7 +158,7 @@ export default function App() {
   if (!setupDone) {
     return (
       <ErrorBoundary>
-        <SetupScreen defaultPath={defaultPath} onComplete={() => setSetupDone(true)} />
+        <SetupScreen defaultPath={defaultPath} onComplete={() => { setSetupDone(true) }} />
       </ErrorBoundary>
     )
   }
@@ -172,16 +172,18 @@ export default function App() {
         <div className="flex flex-1 overflow-hidden">
           <Sidebar activeView={activeView} onNavigate={setActiveView} />
           <main className="flex-1 overflow-hidden">
-            {activeView === 'workshop' && (
-              <WorkshopBrowser
-                creatorFilter={creatorFilter}
-                onClearCreatorFilter={() => setCreatorFilter(null)}
-                onBrowseCreator={browseCreator}
-              />
-            )}
-            {activeView === 'library' && <LibraryView onBrowseCreator={browseCreator} />}
-            {activeView === 'playlists' && <PlaylistsView onBrowseCreator={browseCreator} />}
-            {activeView === 'settings' && <SettingsView />}
+            <div key={activeView} className="view-enter h-full">
+              {activeView === 'workshop' && (
+                <WorkshopBrowser
+                  creatorFilter={creatorFilter}
+                  onClearCreatorFilter={() => { setCreatorFilter(null) }}
+                  onBrowseCreator={browseCreator}
+                />
+              )}
+              {activeView === 'library' && <LibraryView onBrowseCreator={browseCreator} />}
+              {activeView === 'playlists' && <PlaylistsView onBrowseCreator={browseCreator} />}
+              {activeView === 'settings' && <SettingsView />}
+            </div>
           </main>
         </div>
         <StatusBar />

+ 56 - 0
src/renderer/src/assets/index.css

@@ -170,3 +170,59 @@
     box-shadow: 0 0 0 2px rgb(0 0 0 / 0.25), 0 1px 4px rgb(0 0 0 / 0.3);
   }
 }
+
+@keyframes view-in {
+  from {
+    opacity: 0;
+    transform: translateY(6px);
+  }
+  to {
+    opacity: 1;
+    transform: none;
+  }
+}
+
+.view-enter,
+.settings-sections {
+  animation: view-in 0.18s ease-out;
+}
+
+.settings-sections {
+  display: flex;
+  flex-direction: column;
+  gap: 1rem;
+}
+
+.settings-sections > :not(.fixed) {
+  border-radius: 0.5rem;
+  padding: 1.25rem;
+  background-color: color-mix(in oklab, var(--color-fg) 3%, transparent);
+  box-shadow: 0 0 0 1px color-mix(in oklab, var(--color-fg) 5%, transparent);
+}
+
+.settings-sections > :not(.fixed) > label.block:first-child {
+  font-size: 0.875rem;
+  font-weight: 500;
+  letter-spacing: normal;
+  text-transform: none;
+  color: var(--color-gray-100);
+}
+
+@layer components {
+  button:not(:disabled):active {
+    transform: scale(0.98);
+  }
+}
+
+@media (prefers-reduced-motion: reduce) {
+  .view-enter,
+  .settings-sections {
+    animation: none;
+  }
+
+  @layer components {
+    button:not(:disabled):active {
+      transform: none;
+    }
+  }
+}

+ 6 - 6
src/renderer/src/components/common/ContextMenu.tsx

@@ -73,10 +73,10 @@ export function MenuSelectionCount({ count }: { count: number }) {
 export function VoteMenuItems({ onVote }: { onVote: (up: boolean) => void }) {
   return (
     <>
-      <MenuItem icon={ThumbsUp} onClick={() => onVote(true)}>
+      <MenuItem icon={ThumbsUp} onClick={() => { onVote(true) }}>
         {t('vote.like')}
       </MenuItem>
-      <MenuItem icon={ThumbsDown} onClick={() => onVote(false)}>
+      <MenuItem icon={ThumbsDown} onClick={() => { onVote(false) }}>
         {t('vote.dislike')}
       </MenuItem>
     </>
@@ -98,12 +98,12 @@ export function FavoriteMenuItems({
   return (
     <>
       {toAdd.length > 0 && (
-        <MenuItem icon={Heart} onClick={() => onFavorite(toAdd, true)}>
+        <MenuItem icon={Heart} onClick={() => { onFavorite(toAdd, true) }}>
           {t('favorite.add')}
         </MenuItem>
       )}
       {toRemove.length > 0 && (
-        <MenuItem icon={HeartOff} onClick={() => onFavorite(toRemove, false)}>
+        <MenuItem icon={HeartOff} onClick={() => { onFavorite(toRemove, false) }}>
           {t('favorite.remove')}
         </MenuItem>
       )}
@@ -130,7 +130,7 @@ export function SubMenu({
   return (
     <div className="relative">
       <button
-        onClick={() => setOpen((v) => !v)}
+        onClick={() => { setOpen((v) => !v) }}
         className="flex w-full items-center gap-2 rounded-lg px-2.5 py-1.5 text-gray-300 hover:bg-fg/5"
       >
         <Icon size={12} /> {label}
@@ -169,7 +169,7 @@ export function FolderMenuItems({
     <>
       <SubMenu icon={FolderInput} label={t('folder.moveTo')} empty={t('folder.noOthers')}>
         {moveTargets.map((f) => (
-          <MenuItem key={f.id} icon={Folder} onClick={() => onMove(f.id)}>
+          <MenuItem key={f.id} icon={Folder} onClick={() => { onMove(f.id) }}>
             {f.title}
           </MenuItem>
         ))}

+ 2 - 2
src/renderer/src/components/common/CopyField.tsx

@@ -17,7 +17,7 @@ export default function CopyField({ text, label }: Props) {
       return
     }
     setCopied(true)
-    setTimeout(() => setCopied(false), 1500)
+    setTimeout(() => { setCopied(false) }, 1500)
   }
 
   return (
@@ -27,7 +27,7 @@ export default function CopyField({ text, label }: Props) {
         {text}
       </code>
       <button
-        onClick={copy}
+        onClick={() => void copy()}
         title={t('common.copy')}
         className="shrink-0 rounded p-1.5 text-gray-500 hover:bg-fg/5 hover:text-gray-200"
       >

+ 121 - 111
src/renderer/src/components/common/DetailSidebar.tsx

@@ -64,11 +64,11 @@ import CompatSection from './sidebar/CompatSection'
 import ThumbnailSection from './sidebar/ThumbnailSection'
 import { ShortcutRow } from './ShortcutRow'
 import { useDisplayTargets, useScreenAssignments } from '../../hooks/useDisplayTargets'
+import ResizableWidth from './ResizableWidth'
 import type {
   LweSceneObject,
   LweSceneEffect,
   LweProperty,
-  LweAudioObject,
   WallpaperMeta,
   ScalingMode,
   ImageAdjustments,
@@ -124,28 +124,28 @@ function objectState(objId: string, disabled: string[], enabled: string[]): Obje
   return 'default'
 }
 
-function LayerRow({
-  object,
+function VisibilityRow({
+  name,
   state,
   busy,
-  onToggle
+  visibleTitle,
+  hiddenTitle,
+  onToggle,
+  children
 }: {
-  object: LweSceneObject
+  name: string
   state: ObjectState
   busy: boolean
+  visibleTitle: string
+  hiddenTitle: string
   onToggle: () => void
+  children: ReactNode
 }) {
   return (
     <button
       onClick={onToggle}
       disabled={busy}
-      title={
-        state === 'default'
-          ? t('detail.layerVisible')
-          : state === 'hidden'
-            ? t('detail.layerHidden')
-            : t('detail.forcedVisible')
-      }
+      title={state === 'default' ? visibleTitle : state === 'hidden' ? hiddenTitle : t('detail.forcedVisible')}
       className={clsx(
         'flex w-full items-center gap-2 rounded px-1.5 py-1 text-left text-xs transition-colors hover:bg-fg/5 disabled:opacity-40',
         state === 'hidden' ? 'text-gray-600' : 'text-gray-300'
@@ -158,14 +158,37 @@ function LayerRow({
       ) : (
         <Eye size={12} className="shrink-0 text-gray-500" />
       )}
-      <span className={clsx('flex-1 truncate', state === 'hidden' && 'line-through')}>
-        {object.name}
-      </span>
-      <span className="shrink-0 text-gray-600">{object.type}</span>
+      <span className={clsx('flex-1 truncate', state === 'hidden' && 'line-through')}>{name}</span>
+      {children}
     </button>
   )
 }
 
+function LayerRow({
+  object,
+  state,
+  busy,
+  onToggle
+}: {
+  object: LweSceneObject
+  state: ObjectState
+  busy: boolean
+  onToggle: () => void
+}) {
+  return (
+    <VisibilityRow
+      name={object.name}
+      state={state}
+      busy={busy}
+      visibleTitle={t('detail.layerVisible')}
+      hiddenTitle={t('detail.layerHidden')}
+      onToggle={onToggle}
+    >
+      <span className="shrink-0 text-gray-600">{object.type}</span>
+    </VisibilityRow>
+  )
+}
+
 function EffectRow({
   effect,
   state,
@@ -178,35 +201,18 @@ function EffectRow({
   onToggle: () => void
 }) {
   return (
-    <button
-      onClick={onToggle}
-      disabled={busy}
-      title={
-        state === 'default'
-          ? t('detail.effectVisible')
-          : state === 'hidden'
-            ? t('detail.effectDisabled')
-            : t('detail.forcedVisible')
-      }
-      className={clsx(
-        'flex w-full items-center gap-2 rounded px-1.5 py-1 text-left text-xs transition-colors hover:bg-fg/5 disabled:opacity-40',
-        state === 'hidden' ? 'text-gray-600' : 'text-gray-300'
-      )}
+    <VisibilityRow
+      name={effect.name}
+      state={state}
+      busy={busy}
+      visibleTitle={t('detail.effectVisible')}
+      hiddenTitle={t('detail.effectDisabled')}
+      onToggle={onToggle}
     >
-      {state === 'hidden' ? (
-        <EyeOff size={12} className="shrink-0 text-gray-600" />
-      ) : state === 'forced' ? (
-        <Pin size={12} className="shrink-0 text-accent-400" />
-      ) : (
-        <Eye size={12} className="shrink-0 text-gray-500" />
-      )}
-      <span className={clsx('flex-1 truncate', state === 'hidden' && 'line-through')}>
-        {effect.name}
-      </span>
       <span className="shrink-0 truncate text-gray-600" title={effect.objectName}>
         {t('detail.onObject', { name: effect.objectName })}
       </span>
-    </button>
+    </VisibilityRow>
   )
 }
 
@@ -231,7 +237,7 @@ function PropertyRow({
     const on = value === '1' || value === 'true'
     return (
       <button
-        onClick={() => onCommit(on ? '0' : '1')}
+        onClick={() => { onCommit(on ? '0' : '1') }}
         title={property.name}
         className={clsx(
           'flex w-full items-center gap-2 rounded px-1.5 py-1 text-left text-xs transition-colors hover:bg-fg/5',
@@ -264,7 +270,7 @@ function PropertyRow({
           max={property.max ?? 100}
           step={property.step || 1}
           value={num}
-          onChange={(e) => setDraft(Number(e.target.value))}
+          onChange={(e) => { setDraft(Number(e.target.value)) }}
           onMouseUp={(e) => { onCommit(e.currentTarget.value); setDraft(null) }}
           onTouchEnd={(e) => { onCommit(e.currentTarget.value); setDraft(null) }}
           onKeyUp={(e) => { if (!isRangeKey(e.key)) return; onCommit(e.currentTarget.value); setDraft(null) }}
@@ -282,7 +288,7 @@ function PropertyRow({
         </span>
         <select
           value={value}
-          onChange={(e) => onCommit(e.target.value)}
+          onChange={(e) => { onCommit(e.target.value) }}
           className="rounded bg-fg/5 px-1.5 py-0.5 text-xs text-gray-300 outline-none"
         >
           {property.options?.map((opt) => (
@@ -327,7 +333,7 @@ function AudioObjectRow({
         max={200}
         step={5}
         value={percent}
-        onChange={(e) => setDraft(Number(e.target.value))}
+        onChange={(e) => { setDraft(Number(e.target.value)) }}
         onMouseUp={(e) => { onCommit(Number(e.currentTarget.value) / 100); setDraft(null) }}
         onTouchEnd={(e) => { onCommit(Number(e.currentTarget.value) / 100); setDraft(null) }}
         onKeyUp={(e) => { if (!isRangeKey(e.key)) return; onCommit(Number(e.currentTarget.value) / 100); setDraft(null) }}
@@ -363,7 +369,7 @@ function SoundTrackRow({
         max={1}
         step={0.1}
         value={value}
-        onChange={(e) => setDraft(Number(e.target.value))}
+        onChange={(e) => { setDraft(Number(e.target.value)) }}
         onMouseUp={(e) => { onCommit(Number(e.currentTarget.value)); setDraft(null) }}
         onTouchEnd={(e) => { onCommit(Number(e.currentTarget.value)); setDraft(null) }}
         onKeyUp={(e) => { if (!isRangeKey(e.key)) return; onCommit(Number(e.currentTarget.value)); setDraft(null) }}
@@ -463,7 +469,9 @@ export default function DetailSidebar({
     queryKey: ['author-info', creatorSteamId],
     queryFn: () => window.electronAPI.steam.getAuthorInfo(creatorSteamId!),
     enabled: !!creatorSteamId,
-    staleTime: Infinity
+    staleTime: Infinity,
+    retry: 3,
+    retryDelay: (attempt) => Math.min(2000 * 2 ** attempt, 15_000)
   })
 
   const { data: libraryMeta } = useQuery({
@@ -528,7 +536,7 @@ export default function DetailSidebar({
   })
   // sensitivity is per object, which can drive several properties
   const audioObjects: { objectId: string; objectName: string; properties: string[] }[] = []
-  for (const p of audioObjectProperties as LweAudioObject[]) {
+  for (const p of audioObjectProperties) {
     const existing = audioObjects.find((o) => o.objectId === p.objectId)
     if (existing) existing.properties.push(p.property)
     else audioObjects.push({ objectId: p.objectId, objectName: p.objectName, properties: [p.property] })
@@ -560,7 +568,7 @@ export default function DetailSidebar({
   async function persistAndMaybeRelaunch(patch: Partial<WallpaperMeta>) {
     const updated = await window.electronAPI.library.update(id, patch)
     queryClient.setQueryData(['library', 'item', id], updated)
-    queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
     if (isActive) {
       // customArgs and effect overrides can't be hotswapped
       const { ok } = 'customArgs' in patch || 'disabledEffects' in patch || 'enabledEffects' in patch || 'engineFlags' in patch
@@ -590,7 +598,7 @@ export default function DetailSidebar({
       if (!ok) {
         for (const screen of activeScreens) await window.electronAPI.wallpaper.apply({ wallpaperId: id, screen })
       }
-      queryClient.invalidateQueries({ queryKey: ['screen-assignments'] })
+      void queryClient.invalidateQueries({ queryKey: ['screen-assignments'] })
     }
   }
 
@@ -598,7 +606,7 @@ export default function DetailSidebar({
   async function persistOnly(patch: Partial<WallpaperMeta>) {
     const updated = await window.electronAPI.library.update(id, patch)
     queryClient.setQueryData(['library', 'item', id], updated)
-    queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
   }
 
   const livePreviewTimer = useRef<ReturnType<typeof setTimeout> | null>(null)
@@ -617,7 +625,7 @@ export default function DetailSidebar({
     if (!isActive) return
     if (livePreviewTimer.current) clearTimeout(livePreviewTimer.current)
     livePreviewTimer.current = setTimeout(() => {
-      window.electronAPI.lwe.hotswapSettings(patch, localPath)
+      window.electronAPI.lwe.hotswapSettings(patch, localPath).catch(console.error)
     }, 80)
   }
 
@@ -908,7 +916,8 @@ export default function DetailSidebar({
   }
 
   return (
-    <div className="flex w-80 flex-shrink-0 flex-col overflow-y-auto border-l border-fg/5 bg-pane">
+    <ResizableWidth storageKey="we-detail-panel-width" defaultWidth={320} min={280} max={640} edge="left">
+    <div className="flex w-full flex-col overflow-y-auto border-l border-fg/5 bg-pane">
       <div className="relative aspect-video shrink-0 overflow-hidden bg-sunken">
         {previewUrl ? (
           <img src={previewUrl} alt={title} className="h-full w-full object-cover" />
@@ -945,7 +954,7 @@ export default function DetailSidebar({
               </div>
             )}
             <span className="text-sm text-accent-300 hover:text-accent-200">
-              {author?.name ?? '...'}
+              {author?.name ?? creatorSteamId}
             </span>
           </button>
         )}
@@ -954,23 +963,23 @@ export default function DetailSidebar({
 
         <div className="flex flex-wrap gap-1.5">
           {typeTag && (
-            <span className="rounded bg-fg/5 px-2 py-1 text-xs text-gray-300">
+            <span className="whitespace-nowrap rounded bg-fg/5 px-2 py-1 text-xs text-gray-300">
               {tagLabel(typeTag)}
               {fileSizeLabel ? ` · ${fileSizeLabel}` : ''}
             </span>
           )}
           {genreTags.map((tag) => (
-            <span key={tag} className="rounded bg-fg/5 px-2 py-1 text-xs text-gray-400">
+            <span key={tag} className="whitespace-nowrap rounded bg-fg/5 px-2 py-1 text-xs text-gray-400">
               {tagLabel(tag)}
             </span>
           ))}
           {resolutionTags.map((tag) => (
-            <span key={tag} className="rounded bg-fg/5 px-2 py-1 text-xs text-gray-400">
+            <span key={tag} className="whitespace-nowrap rounded bg-fg/5 px-2 py-1 text-xs text-gray-400">
               {tagLabel(tag)}
             </span>
           ))}
           {ageTag && (
-            <span className="rounded bg-fg/5 px-2 py-1 text-xs text-gray-400">{tagLabel(ageTag)}</span>
+            <span className="whitespace-nowrap rounded bg-fg/5 px-2 py-1 text-xs text-gray-400">{tagLabel(ageTag)}</span>
           )}
         </div>
 
@@ -982,7 +991,7 @@ export default function DetailSidebar({
           <div className="border-t border-fg/5 pt-3">
             <div className="flex items-center gap-1.5">
               <button
-                onClick={() => setLayersOpen((v) => !v)}
+                onClick={() => { setLayersOpen((v) => !v) }}
                 className="flex flex-1 items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
               >
                 {layersOpen ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -997,7 +1006,7 @@ export default function DetailSidebar({
               </button>
               {fogObjects.length > 0 && (
                 <button
-                  onClick={toggleFog}
+                  onClick={() => void toggleFog()}
                   disabled={togglingFog}
                   title={fogDisabled ? t('detail.fogDisabled') : t('detail.fogEnabled')}
                   className={clsx(
@@ -1018,7 +1027,7 @@ export default function DetailSidebar({
                     object={obj}
                     state={objectState(obj.id, disabledObjects, enabledObjects)}
                     busy={togglingObjectId === obj.id}
-                    onToggle={() => toggleObject(obj.id)}
+                    onToggle={() => void toggleObject(obj.id)}
                   />
                 ))}
               </div>
@@ -1029,7 +1038,7 @@ export default function DetailSidebar({
         {localPath && lweInstalled && (effectsLoading || effects.length > 0) && (
           <div className="border-t border-fg/5 pt-3">
             <button
-              onClick={() => setEffectsOpen((v) => !v)}
+              onClick={() => { setEffectsOpen((v) => !v) }}
               className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
             >
               {effectsOpen ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -1045,7 +1054,7 @@ export default function DetailSidebar({
                     effect={fx}
                     state={objectState(fx.id, disabledEffects, enabledEffects)}
                     busy={togglingEffectId === fx.id}
-                    onToggle={() => toggleEffect(fx.id)}
+                    onToggle={() => void toggleEffect(fx.id)}
                   />
                 ))}
               </div>
@@ -1072,7 +1081,7 @@ export default function DetailSidebar({
             <select
               value={scalingMode}
               disabled={isCommittingScaling}
-              onChange={(e) => commitScaling(e.target.value as ScalingMode)}
+              onChange={(e) => void commitScaling(e.target.value as ScalingMode)}
               className="w-full rounded bg-fg/5 px-1.5 py-1 text-xs text-gray-300 outline-none disabled:opacity-50"
             >
               {SCALING_MODE_OPTIONS.map((opt) => (
@@ -1109,9 +1118,9 @@ export default function DetailSidebar({
                 setZoomDraft(v)
                 previewLive({ zoom: v / 100 })
               }}
-              onMouseUp={(e) => commitZoom(Number(e.currentTarget.value))}
-              onTouchEnd={(e) => commitZoom(Number(e.currentTarget.value))}
-              onKeyUp={(e) => isRangeKey(e.key) && commitZoom(Number(e.currentTarget.value))}
+              onMouseUp={(e) => void commitZoom(Number(e.currentTarget.value))}
+              onTouchEnd={(e) => void commitZoom(Number(e.currentTarget.value))}
+              onKeyUp={(e) => void (isRangeKey(e.key) && commitZoom(Number(e.currentTarget.value)))}
               className="w-full accent-accent-500 disabled:opacity-50"
             />
           </div>
@@ -1143,9 +1152,9 @@ export default function DetailSidebar({
                   setOffsetXDraft(v)
                   previewLive({ offsetX: v, offsetY })
                 }}
-                onMouseUp={(e) => commitOffset(Number(e.currentTarget.value) / 100, offsetY)}
-                onTouchEnd={(e) => commitOffset(Number(e.currentTarget.value) / 100, offsetY)}
-                onKeyUp={(e) => isRangeKey(e.key) && commitOffset(Number(e.currentTarget.value) / 100, offsetY)}
+                onMouseUp={(e) => void commitOffset(Number(e.currentTarget.value) / 100, offsetY)}
+                onTouchEnd={(e) => void commitOffset(Number(e.currentTarget.value) / 100, offsetY)}
+                onKeyUp={(e) => void (isRangeKey(e.key) && commitOffset(Number(e.currentTarget.value) / 100, offsetY))}
                 className="w-full accent-accent-500 disabled:opacity-50"
               />
               <span className="w-8 shrink-0 text-right text-[10px] text-gray-400">
@@ -1166,9 +1175,9 @@ export default function DetailSidebar({
                   setOffsetYDraft(v)
                   previewLive({ offsetX, offsetY: v })
                 }}
-                onMouseUp={(e) => commitOffset(offsetX, Number(e.currentTarget.value) / 100)}
-                onTouchEnd={(e) => commitOffset(offsetX, Number(e.currentTarget.value) / 100)}
-                onKeyUp={(e) => isRangeKey(e.key) && commitOffset(offsetX, Number(e.currentTarget.value) / 100)}
+                onMouseUp={(e) => void commitOffset(offsetX, Number(e.currentTarget.value) / 100)}
+                onTouchEnd={(e) => void commitOffset(offsetX, Number(e.currentTarget.value) / 100)}
+                onKeyUp={(e) => void (isRangeKey(e.key) && commitOffset(offsetX, Number(e.currentTarget.value) / 100))}
                 className="w-full accent-accent-500 disabled:opacity-50"
               />
               <span className="w-8 shrink-0 text-right text-[10px] text-gray-400">
@@ -1192,18 +1201,18 @@ export default function DetailSidebar({
                 placeholder={t('library.fpsDefault')}
                 value={fps ?? ''}
                 disabled={isCommittingFps}
-                onChange={(e) => setFpsDraft(e.target.value === '' ? null : Number(e.target.value))}
+                onChange={(e) => { setFpsDraft(e.target.value === '' ? null : Number(e.target.value)) }}
                 onKeyDown={(e) => {
                   if (e.key === 'Enter') e.currentTarget.blur()
                 }}
                 onBlur={(e) => {
                   const raw = e.currentTarget.value.trim()
                   if (raw === '') {
-                    commitFps(null)
+                    void commitFps(null)
                     return
                   }
                   const parsed = Number(raw)
-                  commitFps(Number.isFinite(parsed) ? Math.min(240, Math.max(1, parsed)) : fps)
+                  void commitFps(Number.isFinite(parsed) ? Math.min(240, Math.max(1, parsed)) : fps)
                 }}
                 title={t('detail.fpsHint')}
                 className="w-14 rounded bg-fg/5 px-1 py-0.5 text-right normal-case text-gray-400 outline-none focus:ring-1 focus:ring-accent-500 disabled:opacity-50"
@@ -1230,14 +1239,14 @@ export default function DetailSidebar({
                 step={5}
                 value={speedPercent}
                 disabled={isCommittingSpeed}
-                onChange={(e) => setSpeedDraft(Number(e.target.value))}
+                onChange={(e) => { setSpeedDraft(Number(e.target.value)) }}
                 onKeyDown={(e) => {
                   if (e.key === 'Enter') e.currentTarget.blur()
                 }}
                 onBlur={(e) => {
                   const raw = Number(e.currentTarget.value)
                   const clamped = Number.isFinite(raw) ? Math.min(200, Math.max(10, raw)) : speedPercent
-                  commitSpeed(clamped)
+                  void commitSpeed(clamped)
                 }}
                 title={t('detail.speedInputHint')}
                 className="w-12 rounded bg-fg/5 px-1 py-0.5 text-right normal-case text-gray-400 outline-none focus:ring-1 focus:ring-accent-500 disabled:opacity-50"
@@ -1256,9 +1265,9 @@ export default function DetailSidebar({
                 setSpeedDraft(v)
                 previewLive({ speed: v / 100 })
               }}
-              onMouseUp={(e) => commitSpeed(Number(e.currentTarget.value))}
-              onTouchEnd={(e) => commitSpeed(Number(e.currentTarget.value))}
-              onKeyUp={(e) => isRangeKey(e.key) && commitSpeed(Number(e.currentTarget.value))}
+              onMouseUp={(e) => void commitSpeed(Number(e.currentTarget.value))}
+              onTouchEnd={(e) => void commitSpeed(Number(e.currentTarget.value))}
+              onKeyUp={(e) => void (isRangeKey(e.key) && commitSpeed(Number(e.currentTarget.value)))}
               title={t('detail.speedHint')}
               className="w-full accent-accent-500 disabled:opacity-50"
             />
@@ -1273,7 +1282,7 @@ export default function DetailSidebar({
             onCommit={(segments) =>
               persistAndMaybeRelaunch({ videoSegments: segments, videoStart: undefined, videoEnd: undefined })
             }
-            onPreview={(segments, seek) => previewLive({ videoSegments: segments, videoSeek: seek })}
+            onPreview={(segments, seek) => { previewLive({ videoSegments: segments, videoSeek: seek }); }}
           />
         )}
 
@@ -1282,7 +1291,7 @@ export default function DetailSidebar({
             adjustments={libraryMeta.imageAdjustments}
             live={isActive}
             onCommit={(imageAdjustments) => persistAndMaybeRelaunch({ imageAdjustments })}
-            onPreview={(imageAdjustments) => previewLive({ imageAdjustments })}
+            onPreview={(imageAdjustments) => { previewLive({ imageAdjustments }); }}
           />
         )}
 
@@ -1301,7 +1310,7 @@ export default function DetailSidebar({
                 type="color"
                 value={cornerColor}
                 disabled={isCommittingCornerColor}
-                onChange={(e) => commitCornerColor(e.target.value)}
+                onChange={(e) => void commitCornerColor(e.target.value)}
                 title={t('detail.cornerColorHint')}
                 className="h-5 w-8 shrink-0 cursor-pointer rounded border border-fg/10 bg-transparent p-0 disabled:opacity-50"
               />
@@ -1321,7 +1330,7 @@ export default function DetailSidebar({
               )}
               {libraryMeta && (globalAutomute || automuteIgnored) && (
                 <button
-                  onClick={toggleAutomuteIgnore}
+                  onClick={() => void toggleAutomuteIgnore()}
                   disabled={togglingAutomute}
                   title={automuteIgnored ? t('detail.automuteIgnoreOn') : t('detail.automuteIgnoreOff')}
                   className={clsx(
@@ -1351,9 +1360,9 @@ export default function DetailSidebar({
                 setVolumeDraft(v)
                 previewLive({ volume: v })
               }}
-              onMouseUp={(e) => commitVolume(Number(e.currentTarget.value))}
-              onTouchEnd={(e) => commitVolume(Number(e.currentTarget.value))}
-              onKeyUp={(e) => isRangeKey(e.key) && commitVolume(Number(e.currentTarget.value))}
+              onMouseUp={(e) => void commitVolume(Number(e.currentTarget.value))}
+              onTouchEnd={(e) => void commitVolume(Number(e.currentTarget.value))}
+              onKeyUp={(e) => void (isRangeKey(e.key) && commitVolume(Number(e.currentTarget.value)))}
               className="w-full accent-accent-500 disabled:opacity-50"
             />
           </div>
@@ -1362,7 +1371,7 @@ export default function DetailSidebar({
         {localPath && lweInstalled && libraryMeta?.type === 'scene' && (
           <div className="border-t border-fg/5 pt-3">
             <button
-              onClick={() => setXray({ xrayFullReveal: !xrayFullReveal, xrayDisabled: false })}
+              onClick={() => void setXray({ xrayFullReveal: !xrayFullReveal, xrayDisabled: false })}
               disabled={isCommittingXray}
               title={t('detail.fullXrayHint')}
               className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300 disabled:opacity-40"
@@ -1383,7 +1392,7 @@ export default function DetailSidebar({
               )}
             </button>
             <button
-              onClick={() => setXray({ xrayDisabled: !xrayDisabled, xrayFullReveal: false })}
+              onClick={() => void setXray({ xrayDisabled: !xrayDisabled, xrayFullReveal: false })}
               disabled={isCommittingXray}
               title={t('detail.disableXrayHint')}
               className="mt-1.5 flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300 disabled:opacity-40"
@@ -1404,7 +1413,7 @@ export default function DetailSidebar({
               )}
             </button>
             <button
-              onClick={toggleParallax}
+              onClick={() => void toggleParallax()}
               disabled={isCommittingParallax}
               title={t('detail.disableParallaxHint')}
               className="mt-1.5 flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300 disabled:opacity-40"
@@ -1425,7 +1434,7 @@ export default function DetailSidebar({
               )}
             </button>
             <button
-              onClick={toggleExpandCanvas}
+              onClick={() => void toggleExpandCanvas()}
               disabled={isCommittingExpandCanvas}
               title={t('detail.showFullImageHint')}
               className="mt-1.5 flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300 disabled:opacity-40"
@@ -1446,7 +1455,7 @@ export default function DetailSidebar({
               )}
             </button>
             <button
-              onClick={toggleRepairAssets}
+              onClick={() => void toggleRepairAssets()}
               disabled={isCommittingRepairAssets}
               title={t('detail.repairAssetsTitle')}
               className="mt-1.5 flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300 disabled:opacity-40"
@@ -1487,8 +1496,8 @@ export default function DetailSidebar({
               spellCheck={false}
               value={customArgs}
               disabled={isCommittingCustomArgs}
-              onChange={(e) => setCustomArgsDraft(e.target.value)}
-              onBlur={(e) => commitCustomArgs(e.target.value)}
+              onChange={(e) => { setCustomArgsDraft(e.target.value) }}
+              onBlur={(e) => void commitCustomArgs(e.target.value)}
               onKeyDown={(e) => {
                 if (e.key === 'Enter') e.currentTarget.blur()
               }}
@@ -1501,7 +1510,7 @@ export default function DetailSidebar({
         {localPath && lweInstalled && (propertiesLoading || properties.length > 0) && (
           <div className="border-t border-fg/5 pt-3">
             <button
-              onClick={() => setPropertiesOpen((v) => !v)}
+              onClick={() => { setPropertiesOpen((v) => !v) }}
               className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
             >
               {propertiesOpen ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -1521,7 +1530,7 @@ export default function DetailSidebar({
                     key={prop.name}
                     property={prop}
                     value={propertyCommits.values[prop.name] ?? prop.value}
-                    onCommit={(value) => propertyCommits.commit(prop.name, value)}
+                    onCommit={(value) => { propertyCommits.commit(prop.name, value) }}
                   />
                 ))}
               </div>
@@ -1532,7 +1541,7 @@ export default function DetailSidebar({
         {localPath && lweInstalled && (audioObjectsLoading || audioObjects.length > 0) && (
           <div className="border-t border-fg/5 pt-3">
             <button
-              onClick={() => setAudioOpen((v) => !v)}
+              onClick={() => { setAudioOpen((v) => !v) }}
               className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
             >
               {audioOpen ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -1553,7 +1562,7 @@ export default function DetailSidebar({
                     objectName={obj.objectName}
                     properties={obj.properties}
                     multiplier={audioCommits.values[obj.objectId] ?? 1}
-                    onCommit={(multiplier) => audioCommits.commit(obj.objectId, multiplier)}
+                    onCommit={(multiplier) => { audioCommits.commit(obj.objectId, multiplier) }}
                   />
                 ))}
               </div>
@@ -1564,7 +1573,7 @@ export default function DetailSidebar({
         {localPath && lweInstalled && (objectsLoading || soundObjects.length > 0) && (
           <div className="border-t border-fg/5 pt-3">
             <button
-              onClick={() => setSoundTracksOpen((v) => !v)}
+              onClick={() => { setSoundTracksOpen((v) => !v) }}
               className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
             >
               {soundTracksOpen ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -1584,7 +1593,7 @@ export default function DetailSidebar({
                     key={obj.id}
                     trackName={obj.name}
                     volume={soundCommits.values[obj.id] ?? 0}
-                    onCommit={(level) => soundCommits.commit(obj.id, level)}
+                    onCommit={(level) => { soundCommits.commit(obj.id, level) }}
                   />
                 ))}
               </div>
@@ -1611,7 +1620,7 @@ export default function DetailSidebar({
               canGenerate={lweInstalled && !!localPath && libraryMeta.type !== 'application'}
               onUpdated={(updated) => {
                 queryClient.setQueryData(['library', 'item', id], updated)
-                queryClient.invalidateQueries({ queryKey: ['library'] })
+                void queryClient.invalidateQueries({ queryKey: ['library'] })
               }}
             />
           </>
@@ -1620,7 +1629,7 @@ export default function DetailSidebar({
         <div className="flex flex-col gap-1.5 border-t border-fg/5 pt-3">
           <div className="flex gap-1.5">
             <button
-              onClick={() => handleVote(true)}
+              onClick={() => { handleVote(true) }}
               disabled={isLiked || isLiking || isDisliking || unavailable}
               title={unavailable ? t('vote.unavailable') : undefined}
               className={clsx(
@@ -1636,7 +1645,7 @@ export default function DetailSidebar({
               {isLiked ? t('vote.liked') : t('vote.like')}
             </button>
             <button
-              onClick={() => handleVote(false)}
+              onClick={() => { handleVote(false) }}
               disabled={isLiking || isDisliking || unavailable || (isDisliked && !isLiked)}
               title={unavailable ? t('vote.unavailable') : undefined}
               className={clsx(
@@ -1653,7 +1662,7 @@ export default function DetailSidebar({
             </button>
             {workshopId && (
               <button
-                onClick={() => setFavorite(id, favoriteAdd)}
+                onClick={() => void setFavorite(id, favoriteAdd)}
                 disabled={isFavoritePending || (unavailable && favoriteAdd)}
                 title={
                   favoriteFailure
@@ -1688,7 +1697,7 @@ export default function DetailSidebar({
               <span>
                 {favoriteFailure.message}.{' '}
                 <button
-                  onClick={() => setFavorite(id, favoriteFailure.add)}
+                  onClick={() => void setFavorite(id, favoriteFailure.add)}
                   disabled={isFavoritePending || (unavailable && favoriteFailure.add)}
                   className="underline underline-offset-2 hover:text-red-200 disabled:opacity-50"
                 >
@@ -1709,7 +1718,7 @@ export default function DetailSidebar({
           )}
           {canPlay && (
             <button
-              onClick={handlePlay}
+              onClick={() => void handlePlay()}
               disabled={isApplying || !lweInstalled}
               title={lweInstalled ? undefined : t('play.installFirst')}
               className="flex items-center justify-center gap-1.5 rounded-lg bg-accent-600 py-1.5 text-xs text-white transition-colors hover:bg-accent-500 disabled:cursor-not-allowed disabled:opacity-50"
@@ -1721,7 +1730,7 @@ export default function DetailSidebar({
 
           {isSubscribed ? (
             <button
-              onClick={handleUnsubscribe}
+              onClick={() => void handleUnsubscribe()}
               disabled={isUnsubscribing}
               className={clsx(
                 'flex items-center justify-center gap-1.5 rounded-lg py-1.5 text-xs transition-colors',
@@ -1745,22 +1754,23 @@ export default function DetailSidebar({
 
           {workshopId && (
             <>
-              <SidebarButton icon={MessageCircle} onClick={() => window.electronAPI.steam.openWorkshopItem(id)}>
+              <SidebarButton icon={MessageCircle} onClick={() => void window.electronAPI.steam.openWorkshopItem(id)}>
                 {t('detail.comment')}
               </SidebarButton>
-              <SidebarButton icon={ExternalLink} onClick={() => openWorkshopPage(id)}>
+              <SidebarButton icon={ExternalLink} onClick={() => { openWorkshopPage(id) }}>
                 {t('menu.openWorkshop')}
               </SidebarButton>
             </>
           )}
 
           {creatorSteamId && (
-            <SidebarButton icon={User} onClick={() => openProfilePage(creatorSteamId)}>
+            <SidebarButton icon={User} onClick={() => { openProfilePage(creatorSteamId) }}>
               {t('detail.viewProfile')}
             </SidebarButton>
           )}
         </div>
       </div>
     </div>
+    </ResizableWidth>
   )
 }

+ 16 - 13
src/renderer/src/components/common/FilterPanel.tsx

@@ -2,15 +2,18 @@ import { useEffect, useRef, useState, type ReactNode } from 'react'
 import { ChevronDown, ChevronRight } from 'lucide-react'
 import clsx from 'clsx'
 import { WE_RESOLUTION_GROUPS, setGroupSelected, type FilterItem } from '../../constants/weFilters'
+import ResizableWidth from './ResizableWidth'
 import { toggle } from '../../utils/array'
 import { t, tagLabel } from '../../i18n'
 
 
 export function FilterPanel({ children }: { children: ReactNode }) {
   return (
-    <div className="w-52 flex-shrink-0 space-y-3 overflow-y-auto border-r border-fg/5 bg-pane px-3 py-3">
-      {children}
-    </div>
+    <ResizableWidth storageKey="we-filter-panel-width" defaultWidth={208} min={160} max={400} edge="right">
+      <div className="w-full space-y-3 overflow-y-auto border-r border-fg/5 bg-pane px-3 py-3">
+        {children}
+      </div>
+    </ResizableWidth>
   )
 }
 
@@ -62,7 +65,7 @@ export function CheckGroup({ children }: { children: ReactNode }) {
   return <div className="ml-[6px] pl-2.5">{children}</div>
 }
 
-export function AllNoneButtons({ onAll, onNone }: { onAll: () => void; onNone: () => void }) {
+function AllNoneButtons({ onAll, onNone }: { onAll: () => void; onNone: () => void }) {
   return (
     <div className="flex gap-2">
       <button onClick={onAll} className="text-[10px] text-gray-600 hover:text-gray-400">{t('filters.all')}</button>
@@ -90,7 +93,7 @@ export function FilterSection({
   return (
     <div>
       <button
-        onClick={() => setOpen((v) => !v)}
+        onClick={() => { setOpen((v) => !v) }}
         className="flex w-full items-center gap-1 py-1 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
       >
         {open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -131,15 +134,15 @@ export function TagFilterSection({
       title={title}
       defaultOpen={defaultOpen}
       activeCount={activeCount}
-      onAll={() => onChange(options.map((i) => i.tag))}
-      onNone={() => onChange([])}
+      onAll={() => { onChange(options.map((i) => i.tag)) }}
+      onNone={() => { onChange([]) }}
     >
       {options.map((item) => (
         <CheckItem
           key={item.tag}
           label={tagLabel(item.label)}
           checked={selected.includes(item.tag)}
-          onChange={() => onChange(toggle(selected, item.tag))}
+          onChange={() => { onChange(toggle(selected, item.tag)) }}
         />
       ))}
     </FilterSection>
@@ -164,16 +167,16 @@ export function ResolutionFilterSection({
       title={t('filters.resolution')}
       defaultOpen={false}
       activeCount={activeCount}
-      onAll={() => onChange(allTags)}
-      onNone={() => onChange([])}
+      onAll={() => { onChange(allTags) }}
+      onNone={() => { onChange([]) }}
     >
       {WE_RESOLUTION_GROUPS.map((group) => (
         <div key={group.label} className="mt-2">
           <div className="mb-0.5 flex items-center justify-between pl-0.5">
             <p className="text-xs text-gray-600">{tagLabel(group.label)}</p>
             <AllNoneButtons
-              onAll={() => onChange(setGroupSelected(selected, group, true))}
-              onNone={() => onChange(setGroupSelected(selected, group, false))}
+              onAll={() => { onChange(setGroupSelected(selected, group, true)) }}
+              onNone={() => { onChange(setGroupSelected(selected, group, false)) }}
             />
           </div>
           {group.items.map((item) => (
@@ -182,7 +185,7 @@ export function ResolutionFilterSection({
               label={tagLabel(item.label)}
               checked={selected.includes(item.tag)}
               count={counts ? (counts.get(item.tag) ?? 0) : undefined}
-              onChange={() => onChange(toggle(selected, item.tag))}
+              onChange={() => { onChange(toggle(selected, item.tag)) }}
             />
           ))}
         </div>

+ 1 - 1
src/renderer/src/components/common/FontNotice.tsx

@@ -47,7 +47,7 @@ export default function FontNotice({ wallpaperPath, revision }: { wallpaperPath:
         ))}
       </ul>
       <button
-        onClick={handleAdd}
+        onClick={() => void handleAdd()}
         className="mt-2 flex items-center gap-1.5 rounded bg-fg/10 px-2 py-1 text-xs text-gray-300 hover:bg-fg/15"
       >
         <Type size={11} />

+ 8 - 6
src/renderer/src/components/common/GridCard.tsx

@@ -14,13 +14,14 @@ interface GridCardProps extends HTMLAttributes<HTMLDivElement> {
   isDetailOpen: boolean
   steam: CardSteamState
   borders: CardBorders
+  row?: boolean
   [dataAttr: `data-${string}`]: string
 }
 
 // outside the card, so a liked favorite shows both colors
 const FRAME_INSET_PX = [4, 7]
 
-export function GridCard({ selected, isDetailOpen, steam, borders, className, children, ...rest }: GridCardProps) {
+export function GridCard({ selected, isDetailOpen, steam, borders, row = false, className, children, ...rest }: GridCardProps) {
   const { frames, title } = cardFrames(borders, steam)
   return (
     <div
@@ -28,7 +29,8 @@ export function GridCard({ selected, isDetailOpen, steam, borders, className, ch
       data-preview-hover=""
       title={title}
       className={clsx(
-        'group relative cursor-pointer select-none rounded-xl bg-card shadow-sm shadow-black/10 transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg hover:shadow-black/25',
+        'group relative cursor-pointer select-none rounded-md bg-card shadow-sm shadow-black/10 transition-all duration-200',
+        row ? 'hover:bg-fg/[0.04]' : 'hover:-translate-y-0.5 hover:shadow-lg hover:shadow-black/25',
         isDetailOpen ? 'ring-2 ring-sky-400' : selected ? 'ring-2 ring-accent-500' : 'ring-1 ring-fg/5 hover:ring-accent-500/50',
         className
       )}
@@ -40,13 +42,13 @@ export function GridCard({ selected, isDetailOpen, steam, borders, className, ch
           className="pointer-events-none absolute border-2"
           style={{
             inset: -FRAME_INSET_PX[i],
-            borderRadius: 12 + FRAME_INSET_PX[i],
+            borderRadius: 6 + FRAME_INSET_PX[i],
             borderColor: frame.color,
             borderStyle: frame.kind === 'failed' ? 'dashed' : 'solid'
           }}
         />
       ))}
-      <div className="relative h-full overflow-hidden rounded-xl">
+      <div className={clsx('relative h-full overflow-hidden rounded-md', row && 'flex items-center')}>
         <div
           className={clsx(
             'absolute left-2 top-2 z-10 flex h-5 w-5 items-center justify-center rounded border transition-all',
@@ -180,7 +182,7 @@ export function LikeAction({
             ? t('vote.alreadyLiked')
             : t('vote.likeOnSteam')
       }
-      onClick={() => vote(id, true)}
+      onClick={() => void vote(id, true)}
     />
   )
 }
@@ -192,7 +194,7 @@ export function SteamAction({ id, compact }: { id: string; compact?: boolean })
       label="Steam"
       compact={compact}
       title={t('menu.openWorkshop')}
-      onClick={() => openWorkshopPage(id)}
+      onClick={() => { openWorkshopPage(id) }}
     />
   )
 }

+ 3 - 3
src/renderer/src/components/common/GridControls.tsx

@@ -70,7 +70,7 @@ export function SearchInput({
         placeholder={placeholder}
         title={title}
         value={value}
-        onChange={(e) => onChange(e.target.value)}
+        onChange={(e) => { onChange(e.target.value) }}
         className="w-full rounded-lg bg-fg/5 py-2 pl-9 pr-3 text-sm text-gray-200 placeholder-gray-500 outline-none focus:ring-1 focus:ring-accent-500"
       />
     </div>
@@ -140,7 +140,7 @@ export function Pagination({
     <div className="flex items-center gap-2 text-xs text-gray-400">
       <button
         disabled={page <= 1}
-        onClick={() => onPage(Math.max(1, page - 1))}
+        onClick={() => { onPage(Math.max(1, page - 1)) }}
         className="rounded bg-fg/5 px-2.5 py-1 text-gray-300 hover:bg-fg/10 disabled:opacity-40"
       >
         {t('pagination.prev')}
@@ -148,7 +148,7 @@ export function Pagination({
       <span>{children}</span>
       <button
         disabled={!canNext}
-        onClick={() => onPage(page + 1)}
+        onClick={() => { onPage(page + 1) }}
         className="rounded bg-fg/5 px-2.5 py-1 text-gray-300 hover:bg-fg/10 disabled:opacity-40"
       >
         {t('common.next')}

+ 83 - 0
src/renderer/src/components/common/PickerParts.tsx

@@ -0,0 +1,83 @@
+import type { ReactNode } from 'react'
+import { Check, Search, X } from 'lucide-react'
+import type { WallpaperMeta } from '@shared/types'
+import { getPreviewSrc } from '../../utils/preview'
+import PreviewImage from './PreviewImage'
+import { t } from '../../i18n'
+
+export function PickerFrame({ title, onClose, children }: { title: string; onClose: () => void; children: ReactNode }) {
+  return (
+    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-8">
+      <div className="flex h-full max-h-[600px] w-full max-w-2xl flex-col rounded-xl border border-fg/10 bg-popup shadow-2xl">
+        <div className="flex items-center justify-between border-b border-fg/5 px-4 py-3">
+          <h3 className="text-sm font-semibold text-gray-100">{title}</h3>
+          <button onClick={onClose} className="rounded p-1 text-gray-500 hover:bg-fg/5 hover:text-gray-300">
+            <X size={16} />
+          </button>
+        </div>
+        {children}
+      </div>
+    </div>
+  )
+}
+
+export function PickerSearch({ value, onChange }: { value: string; onChange: (value: string) => void }) {
+  return (
+    <div className="relative flex-1">
+      <Search size={14} className="absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500" />
+      <input
+        autoFocus
+        type="text"
+        placeholder={t('picker.search')}
+        value={value}
+        onChange={(e) => { onChange(e.target.value) }}
+        className="w-full rounded-lg bg-fg/5 py-1.5 pl-8 pr-3 text-sm text-gray-200 placeholder-gray-500 outline-none focus:ring-1 focus:ring-accent-500"
+      />
+    </div>
+  )
+}
+
+export function PickerGrid({ loading, empty, children }: { loading: boolean; empty: boolean; children: ReactNode }) {
+  return (
+    <div className="flex-1 overflow-y-auto p-3">
+      {loading && <p className="p-4 text-center text-xs text-gray-500">{t('common.loading')}</p>}
+      {!loading && empty && <p className="p-4 text-center text-xs text-gray-500">{t('picker.empty')}</p>}
+      <div className="grid grid-cols-3 gap-2">{children}</div>
+    </div>
+  )
+}
+
+export function PickerCard({
+  wallpaper,
+  selected,
+  onClick,
+  label
+}: {
+  wallpaper: WallpaperMeta
+  selected: boolean
+  onClick: () => void
+  label: ReactNode
+}) {
+  const previewSrc = getPreviewSrc(wallpaper)
+  return (
+    <button
+      onClick={onClick}
+      data-preview-hover=""
+      className={`group relative overflow-hidden rounded-xl bg-card text-left transition-all ${
+        selected ? 'ring-2 ring-accent-500' : 'hover:ring-1 hover:ring-accent-500/50'
+      }`}
+    >
+      <div className="aspect-video bg-sunken">
+        {previewSrc ? (
+          <PreviewImage src={previewSrc} alt={wallpaper.title} />
+        ) : (
+          <div className="flex h-full items-center justify-center text-xs text-gray-600">{t('card.noPreview')}</div>
+        )}
+      </div>
+      <div className="flex items-center justify-between gap-1 p-2">
+        {label}
+        {selected && <Check size={12} className="shrink-0 text-accent-400" />}
+      </div>
+    </button>
+  )
+}

+ 5 - 5
src/renderer/src/components/common/PreviewImage.tsx

@@ -82,7 +82,7 @@ function loadFirstFrame(src: string): Promise<StillSource> {
   return new Promise((resolve, reject) => {
     const img = new Image()
     img.decoding = 'async'
-    img.addEventListener('load', () => resolve({ source: img, width: img.naturalWidth, height: img.naturalHeight }))
+    img.addEventListener('load', () => { resolve({ source: img, width: img.naturalWidth, height: img.naturalHeight }) })
     img.addEventListener('error', reject)
     img.src = src
   })
@@ -122,7 +122,7 @@ function HoverAnimatedImage({ src, alt, className }: { src: string; alt: string;
       { rootMargin: '300px' }
     )
     observer.observe(el)
-    return () => observer.disconnect()
+    return () => { observer.disconnect() }
   }, [])
 
   useEffect(() => {
@@ -140,7 +140,7 @@ function HoverAnimatedImage({ src, alt, className }: { src: string; alt: string;
           return
         }
         drawCover(canvas, still)
-        resize = new ResizeObserver(() => drawCover(canvas, still))
+        resize = new ResizeObserver(() => { drawCover(canvas, still) })
         resize.observe(canvas)
       })
       .catch(() => {
@@ -165,7 +165,7 @@ function HoverAnimatedImage({ src, alt, className }: { src: string; alt: string;
     }
     const enter = (): void => {
       if (timer) clearTimeout(timer)
-      timer = setTimeout(() => setLive(true), HOVER_DELAY_MS)
+      timer = setTimeout(() => { setLive(true) }, HOVER_DELAY_MS)
     }
     const visibility = (): void => {
       if (document.hidden) stop()
@@ -189,7 +189,7 @@ function HoverAnimatedImage({ src, alt, className }: { src: string; alt: string;
           src={src}
           alt=""
           draggable={false}
-          onLoad={() => setLiveLoaded(true)}
+          onLoad={() => { setLiveLoaded(true) }}
           className={clsx(
             'absolute inset-0 h-full w-full object-cover transition-opacity duration-150',
             liveLoaded ? 'opacity-100' : 'opacity-0'

+ 7 - 4
src/renderer/src/components/common/PreviewSizeToggle.tsx

@@ -1,12 +1,15 @@
+import type { ReactNode } from 'react'
+import { List } from 'lucide-react'
 import clsx from 'clsx'
 import type { PreviewSize } from '../../hooks/usePreviewSize'
 import { t } from '../../i18n'
 import type { MessageKey } from '@shared/i18n'
 
-const OPTIONS: { value: PreviewSize; label: string; title: MessageKey }[] = [
+const OPTIONS: { value: PreviewSize; label: ReactNode; title: MessageKey }[] = [
   { value: 'small', label: 'S', title: 'previewSize.small' },
   { value: 'normal', label: 'M', title: 'previewSize.normal' },
-  { value: 'big', label: 'L', title: 'previewSize.big' }
+  { value: 'big', label: 'L', title: 'previewSize.big' },
+  { value: 'list', label: <List size={14} />, title: 'previewSize.list' }
 ]
 
 export default function PreviewSizeToggle({
@@ -21,10 +24,10 @@ export default function PreviewSizeToggle({
       {OPTIONS.map((opt) => (
         <button
           key={opt.value}
-          onClick={() => onChange(opt.value)}
+          onClick={() => { onChange(opt.value) }}
           title={t(opt.title)}
           className={clsx(
-            'px-2.5 py-2 transition-colors',
+            'flex items-center px-2.5 py-2 transition-colors',
             value === opt.value
               ? 'bg-accent-600 text-white'
               : 'bg-fg/5 text-gray-400 hover:text-gray-200'

+ 145 - 0
src/renderer/src/components/common/Reorderable.tsx

@@ -0,0 +1,145 @@
+import { useEffect, useMemo, useState, type ReactNode } from 'react'
+import { GripVertical } from 'lucide-react'
+import clsx from 'clsx'
+import { usePersistentState } from '../../hooks/usePersistentState'
+import { t } from '../../i18n'
+
+const DRAG_TYPE = 'text/we-reorder'
+
+// dragover can't read the data, so the item being dragged is kept here
+let dragging: { group: string; id: string } | null = null
+
+function loadOrder(stored: unknown): string[] {
+  return Array.isArray(stored) ? stored.filter((id): id is string => typeof id === 'string') : []
+}
+
+export function useReorder(storageKey: string, ids: string[]) {
+  const [saved, setSaved] = usePersistentState<string[]>(storageKey, [], loadOrder)
+  const idsKey = ids.join('\n')
+
+  const order = useMemo(() => {
+    const present = new Set(idsKey.split('\n'))
+    const head = saved.filter((id) => present.has(id))
+    const seen = new Set(head)
+    return [...head, ...idsKey.split('\n').filter((id) => id && !seen.has(id))]
+  }, [saved, idsKey])
+
+  function move(fromId: string, toId: string, after: boolean) {
+    if (fromId === toId) return
+    const rest = order.filter((id) => id !== fromId)
+    rest.splice(rest.indexOf(toId) + (after ? 1 : 0), 0, fromId)
+    const shown = new Set(order)
+    const queue = [...rest]
+    const next = saved.map((id) => (shown.has(id) ? queue.shift() ?? id : id))
+    setSaved([...next, ...queue])
+  }
+
+  function sortItems<T>(items: T[], idOf: (item: T) => string): T[] {
+    const byId = new Map(items.map((item) => [idOf(item), item]))
+    return order.flatMap((id) => byId.get(id) ?? [])
+  }
+
+  return { order, move, sortItems }
+}
+
+interface ReorderableProps {
+  group: string
+  id: string
+  onMove: (fromId: string, toId: string, after: boolean) => void
+  axis?: 'y' | 'x'
+  handle?: boolean
+  disabled?: boolean
+  className?: string
+  children: ReactNode
+}
+
+export function Reorderable({ group, id, onMove, axis = 'y', handle = false, disabled = false, className, children }: ReorderableProps) {
+  const [armed, setArmed] = useState(false)
+  const [edge, setEdge] = useState<'before' | 'after' | null>(null)
+
+  useEffect(() => {
+    if (!armed) return
+    const release = () => { setArmed(false) }
+    window.addEventListener('mouseup', release, { once: true })
+    return () => { window.removeEventListener('mouseup', release) }
+  }, [armed])
+
+  function accepts(): boolean {
+    return dragging !== null && dragging.group === group && dragging.id !== id
+  }
+
+  return (
+    <div
+      draggable={!disabled && (!handle || armed)}
+      onDragStart={(e) => {
+        if (e.target !== e.currentTarget) return
+        dragging = { group, id }
+        e.dataTransfer.setData(DRAG_TYPE, id)
+        e.dataTransfer.effectAllowed = 'move'
+      }}
+      onDragEnd={() => {
+        dragging = null
+        setArmed(false)
+        setEdge(null)
+      }}
+      onDragOver={(e) => {
+        if (!accepts()) return
+        e.preventDefault()
+        const rect = e.currentTarget.getBoundingClientRect()
+        const after = axis === 'y' ? e.clientY > rect.top + rect.height / 2 : e.clientX > rect.left + rect.width / 2
+        setEdge(after ? 'after' : 'before')
+      }}
+      onDragLeave={(e) => {
+        if (!e.currentTarget.contains(e.relatedTarget as Node | null)) setEdge(null)
+      }}
+      onDrop={(e) => {
+        if (!accepts() || !dragging) return
+        e.preventDefault()
+        onMove(dragging.id, id, edge === 'after')
+        setEdge(null)
+      }}
+      className={clsx('group/reorder relative', className)}
+    >
+      {handle && !disabled && (
+        <span
+          title={t('common.dragReorder')}
+          onMouseDown={() => { setArmed(true) }}
+          className="absolute -left-3 top-1.5 z-10 cursor-grab text-gray-600 opacity-0 transition-opacity hover:text-gray-300 group-hover/reorder:opacity-100"
+        >
+          <GripVertical size={12} />
+        </span>
+      )}
+      {children}
+      {edge && (
+        <span
+          aria-hidden
+          className={clsx(
+            'pointer-events-none absolute z-10 rounded-full bg-accent-500',
+            axis === 'y'
+              ? clsx('inset-x-0 h-0.5', edge === 'before' ? '-top-px' : '-bottom-px')
+              : clsx('inset-y-0 w-0.5', edge === 'before' ? '-left-px' : '-right-px')
+          )}
+        />
+      )}
+    </div>
+  )
+}
+
+export interface ReorderSection {
+  id: string
+  node: ReactNode
+}
+
+export function ReorderableSections({ storageKey, sections }: { storageKey: string; sections: ReorderSection[] }) {
+  const shown = sections.filter((section) => section.node)
+  const { move, sortItems } = useReorder(storageKey, shown.map((section) => section.id))
+  return (
+    <>
+      {sortItems(shown, (section) => section.id).map((section) => (
+        <Reorderable key={section.id} group={storageKey} id={section.id} onMove={move} handle>
+          {section.node}
+        </Reorderable>
+      ))}
+    </>
+  )
+}

+ 68 - 0
src/renderer/src/components/common/ResizableWidth.tsx

@@ -0,0 +1,68 @@
+import { useRef, useState, type ReactNode } from 'react'
+import clsx from 'clsx'
+import { usePersistentState } from '../../hooks/usePersistentState'
+import { t } from '../../i18n'
+
+interface ResizableWidthProps {
+  storageKey: string
+  defaultWidth: number
+  min: number
+  max: number
+  edge: 'left' | 'right'
+  children: ReactNode
+}
+
+function clamp(value: number, min: number, max: number): number {
+  return Math.min(max, Math.max(min, value))
+}
+
+const MAX_WINDOW_SHARE = 0.3
+
+export default function ResizableWidth({ storageKey, defaultWidth, min, max, edge, children }: ResizableWidthProps) {
+  const [stored, setStored] = usePersistentState<number>(
+    storageKey,
+    defaultWidth,
+    (value) => (typeof value === 'number' && Number.isFinite(value) ? clamp(value, min, max) : defaultWidth)
+  )
+  const [live, setLive] = useState<number | null>(null)
+  const start = useRef({ x: 0, width: 0 })
+  const dragging = live !== null
+  const limit = Math.max(min, Math.min(max, Math.round(window.innerWidth * MAX_WINDOW_SHARE)))
+  const width = clamp(live ?? stored, min, limit)
+
+  function finishDrag() {
+    if (live !== null) setStored(live)
+    setLive(null)
+  }
+
+  return (
+    <div className="relative flex shrink-0" style={{ width }}>
+      {children}
+      <div
+        role="separator"
+        aria-orientation="vertical"
+        title={t('common.dragResize')}
+        onPointerDown={(e) => {
+          if (e.button !== 0) return
+          e.currentTarget.setPointerCapture(e.pointerId)
+          start.current = { x: e.clientX, width }
+          setLive(width)
+        }}
+        onPointerMove={(e) => {
+          if (!dragging) return
+          const dx = e.clientX - start.current.x
+          setLive(clamp(start.current.width + (edge === 'right' ? dx : -dx), min, limit))
+        }}
+        onPointerUp={finishDrag}
+        onPointerCancel={finishDrag}
+        onLostPointerCapture={finishDrag}
+        onDoubleClick={() => { setStored(defaultWidth) }}
+        className={clsx(
+          'absolute inset-y-0 z-20 w-1.5 cursor-col-resize select-none transition-colors hover:bg-accent-500/40',
+          edge === 'right' ? '-right-[3px]' : '-left-[3px]',
+          dragging && 'bg-accent-500/60'
+        )}
+      />
+    </div>
+  )
+}

+ 1 - 1
src/renderer/src/components/common/ScreenSelect.tsx

@@ -16,7 +16,7 @@ export default function ScreenSelect({ targets, value, onChange, title }: Props)
       <Monitor size={12} />
       <select
         value={value}
-        onChange={(e) => onChange(e.target.value)}
+        onChange={(e) => { onChange(e.target.value) }}
         className="rounded bg-fg/5 px-1.5 py-1 text-xs text-gray-200 outline-none"
       >
         <option value="*">{t('common.allScreens')}</option>

+ 10 - 10
src/renderer/src/components/common/ShortcutRow.tsx

@@ -100,7 +100,7 @@ export function ShortcutRow({
           <span className="truncate">{current ? describe(current, apps) : t('shortcut.notAssigned')}</span>
         </span>
         <button
-          onClick={() => setDraft(draft ? null : (current ?? { type: 'application', file: '', arguments: '' }))}
+          onClick={() => { setDraft(draft ? null : (current ?? { type: 'application', file: '', arguments: '' })); }}
           title={current ? t('shortcut.change') : t('shortcut.assign')}
           className="rounded p-0.5 text-gray-400 hover:bg-fg/10 hover:text-gray-200 disabled:opacity-40"
         >
@@ -108,7 +108,7 @@ export function ShortcutRow({
         </button>
         {current && (
           <button
-            onClick={() => onCommit('')}
+            onClick={() => { onCommit('') }}
             title={t('shortcut.remove')}
             className="rounded p-0.5 text-gray-400 hover:bg-fg/10 hover:text-gray-200 disabled:opacity-40"
           >
@@ -123,7 +123,7 @@ export function ShortcutRow({
             {TYPES.map(({ type, label: typeLabel, icon: Icon }) => (
               <button
                 key={type}
-                onClick={() => setDraft({ type, file: '', arguments: '' })}
+                onClick={() => { setDraft({ type, file: '', arguments: '' }); }}
                 className={clsx(
                   'flex flex-1 items-center justify-center gap-1 rounded px-1 py-0.5',
                   draft.type === type ? 'bg-accent-500/30 text-accent-200' : 'text-gray-400 hover:bg-fg/5'
@@ -139,7 +139,7 @@ export function ShortcutRow({
             <>
               <input
                 value={search}
-                onChange={(e) => setSearch(e.target.value)}
+                onChange={(e) => { setSearch(e.target.value) }}
                 placeholder={t('shortcut.searchApps')}
                 className="w-full rounded bg-black/20 px-1.5 py-0.5 text-gray-200 outline-none"
               />
@@ -147,7 +147,7 @@ export function ShortcutRow({
                 {filteredApps.map((app) => (
                   <button
                     key={app.file}
-                    onClick={() => setDraft({ ...draft, file: app.file })}
+                    onClick={() => { setDraft({ ...draft, file: app.file }); }}
                     title={app.file}
                     className={clsx(
                       'block w-full truncate rounded px-1.5 py-0.5 text-left',
@@ -165,12 +165,12 @@ export function ShortcutRow({
             <div className="flex gap-1">
               <input
                 value={draft.file}
-                onChange={(e) => setDraft({ ...draft, file: e.target.value })}
+                onChange={(e) => { setDraft({ ...draft, file: e.target.value }); }}
                 placeholder={draft.type === 'directory' ? t('shortcut.folderPlaceholder') : t('shortcut.filePlaceholder')}
                 className="min-w-0 flex-1 rounded bg-black/20 px-1.5 py-0.5 text-gray-200 outline-none"
               />
               <button
-                onClick={() => pick(draft.type === 'directory' ? 'directory' : 'file')}
+                onClick={() => void pick(draft.type === 'directory' ? 'directory' : 'file')}
                 className="rounded bg-fg/5 px-1.5 text-gray-300 hover:bg-fg/10"
               >
                 {t('common.browse')}
@@ -181,7 +181,7 @@ export function ShortcutRow({
           {draft.type === 'web' && (
             <input
               value={draft.file}
-              onChange={(e) => setDraft({ ...draft, file: e.target.value })}
+              onChange={(e) => { setDraft({ ...draft, file: e.target.value }); }}
               placeholder="https://"
               className="w-full rounded bg-black/20 px-1.5 py-0.5 text-gray-200 outline-none"
             />
@@ -191,7 +191,7 @@ export function ShortcutRow({
             <>
               <input
                 value={draft.file}
-                onChange={(e) => setDraft({ ...draft, file: e.target.value })}
+                onChange={(e) => { setDraft({ ...draft, file: e.target.value }); }}
                 placeholder={t('shortcut.command')}
                 className="w-full rounded bg-black/20 px-1.5 py-0.5 font-mono text-gray-200 outline-none"
               />
@@ -202,7 +202,7 @@ export function ShortcutRow({
           )}
 
           <div className="flex justify-end gap-1">
-            <button onClick={() => setDraft(null)} className="rounded px-2 py-0.5 text-gray-400 hover:bg-fg/5">
+            <button onClick={() => { setDraft(null) }} className="rounded px-2 py-0.5 text-gray-400 hover:bg-fg/5">
               {t('common.cancel')}
             </button>
             <button

+ 10 - 10
src/renderer/src/components/common/WallpaperContextMenu.tsx

@@ -99,7 +99,7 @@ export default function WallpaperContextMenu({
     } catch (err) {
       showToast(t('backup.failed', { error: (err as Error).message }))
     }
-    queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
   }
 
   async function removeBackup() {
@@ -121,8 +121,8 @@ export default function WallpaperContextMenu({
     if (result.keptDirs.length > 0) summary += ' ' + t('backup.keptOutside', { count: result.keptDirs.length })
     if (result.failed > 0) summary += ', ' + t('common.failedCount', { count: result.failed })
     showToast(summary)
-    queryClient.invalidateQueries({ queryKey: ['library'] })
-    queryClient.invalidateQueries({ queryKey: ['folders'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['folders'] })
   }
 
   async function transfer(library: ExtraLibrary, mode: 'copy' | 'move') {
@@ -145,14 +145,14 @@ export default function WallpaperContextMenu({
     } catch (err) {
       showToast(t(mode === 'copy' ? 'transfer.copyFailed' : 'transfer.moveFailed', { error: (err as Error).message }))
     }
-    queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
   }
 
   async function addToSplit(screen: string) {
     const split = config?.splitScreens?.[screen] ?? { layout: 'aspect' as const, slots: [] }
     const slots = [...split.slots, ...splittable.map((w) => ({ wallpaperId: w.id }))]
     await window.electronAPI.wallpaper.setSplit(screen, { ...split, slots })
-    queryClient.invalidateQueries({ queryKey: ['config'] })
+    void queryClient.invalidateQueries({ queryKey: ['config'] })
     showToast(t('split.added', { count: splittable.length, screen }))
   }
 
@@ -183,7 +183,7 @@ export default function WallpaperContextMenu({
         </MenuItem>
       )}
       {backupable.length > 0 && (
-        <MenuItem icon={ShieldCheck} onClick={run(async () => showToast(await verifyFiles(backupable.map((w) => w.id), () => {})))}>
+        <MenuItem icon={ShieldCheck} onClick={run(async () => { showToast(await verifyFiles(backupable.map((w) => w.id), () => {})); })}>
           {t('verify.action')}
         </MenuItem>
       )}
@@ -192,15 +192,15 @@ export default function WallpaperContextMenu({
       </MenuItem>
 
       <MenuSeparator />
-      <VoteMenuItems onVote={(up) => run(() => batchVote(ids, up))()} />
+      <VoteMenuItems onVote={(up) => { run(() => batchVote(ids, up))() }} />
       <FavoriteMenuItems
         ids={ids.filter(isWorkshopId)}
         favorites={favoriteIds}
-        onFavorite={(favIds, add) => run(() => batchFavorite(favIds, add))()}
+        onFavorite={(favIds, add) => { run(() => batchFavorite(favIds, add))() }}
       />
 
       <MenuSeparator />
-      <MenuItem icon={ExternalLink} onClick={run(() => ids.forEach(openWorkshopPage))}>
+      <MenuItem icon={ExternalLink} onClick={run(() => { ids.forEach(openWorkshopPage) })}>
         {t('menu.openWorkshop')}
       </MenuItem>
       <MenuItem icon={FolderOpen} onClick={run(openLocally)}>
@@ -252,7 +252,7 @@ export default function WallpaperContextMenu({
       <FolderMenuItems
         moveTargets={moveTargets}
         hasFolder={hasFolder}
-        onMove={(folderId) => run(() => moveToFolder(folderId, ids))()}
+        onMove={(folderId) => { run(() => moveToFolder(folderId, ids))() }}
         onRemove={run(() => removeFromFolders(ids))}
       />
     </ContextMenu>

+ 6 - 6
src/renderer/src/components/common/sidebar/CompatSection.tsx

@@ -57,7 +57,7 @@ export default function CompatSection({ wallpaper, canTest, onChange, onTest }:
   return (
     <div className="border-t border-fg/5 pt-3">
       <button
-        onClick={() => setOpen((v) => !v)}
+        onClick={() => { setOpen((v) => !v) }}
         className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
       >
         {open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -80,7 +80,7 @@ export default function CompatSection({ wallpaper, canTest, onChange, onTest }:
               {new Date(compat.lastCrash.at).toLocaleString(currentLanguage())}
               {compat.runtimeCrashes ? ` ${t('compat.runtimeCount', { count: compat.runtimeCrashes })}` : ''}
               {compat.lastCrash.log.length > 0 && (
-                <button onClick={() => setShowLog((v) => !v)} className="ml-1 text-accent-300 hover:text-accent-200">
+                <button onClick={() => { setShowLog((v) => !v) }} className="ml-1 text-accent-300 hover:text-accent-200">
                   {showLog ? t('compat.hideLog') : t('compat.showLog')}
                 </button>
               )}
@@ -94,8 +94,8 @@ export default function CompatSection({ wallpaper, canTest, onChange, onTest }:
 
           <textarea
             value={note}
-            onChange={(e) => setNoteDraft(e.target.value)}
-            onBlur={(e) => commitNote(e.target.value)}
+            onChange={(e) => { setNoteDraft(e.target.value) }}
+            onBlur={(e) => void commitNote(e.target.value)}
             rows={2}
             placeholder={t('compat.notePlaceholder')}
             className="w-full resize-y rounded border border-fg/10 bg-black/30 px-2 py-1 text-xs text-gray-200 placeholder:text-gray-600 focus:border-accent-500/50 focus:outline-none"
@@ -104,7 +104,7 @@ export default function CompatSection({ wallpaper, canTest, onChange, onTest }:
           <div className="flex gap-1.5">
             {canTest && (
               <button
-                onClick={test}
+                onClick={() => void test()}
                 disabled={testing}
                 title={t('compat.testHint')}
                 className="flex items-center gap-1 rounded bg-fg/5 px-2 py-1 text-gray-300 hover:bg-fg/10 disabled:opacity-50"
@@ -115,7 +115,7 @@ export default function CompatSection({ wallpaper, canTest, onChange, onTest }:
             )}
             {status !== 'ok' && (
               <button
-                onClick={clearStatus}
+                onClick={() => void clearStatus()}
                 className="flex items-center gap-1 rounded bg-fg/5 px-2 py-1 text-gray-300 hover:bg-fg/10"
               >
                 <Undo2 size={11} />

+ 6 - 8
src/renderer/src/components/common/sidebar/EngineFlagsSection.tsx

@@ -50,7 +50,7 @@ export default function EngineFlagsSection({ flags = {}, onChange }: Props) {
   return (
     <div className="border-t border-fg/5 pt-3">
       <button
-        onClick={() => setOpen((v) => !v)}
+        onClick={() => { setOpen((v) => !v) }}
         className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
       >
         {open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -70,7 +70,7 @@ export default function EngineFlagsSection({ flags = {}, onChange }: Props) {
             <select
               value=""
               disabled={busy}
-              onChange={(e) => applyPreset(e.target.value)}
+              onChange={(e) => { applyPreset(e.target.value) }}
               className={`${selectClass} flex-1`}
             >
               <option value="" disabled>
@@ -84,7 +84,7 @@ export default function EngineFlagsSection({ flags = {}, onChange }: Props) {
             </select>
             {hasEngineFlags(flags) && (
               <button
-                onClick={() => commit({ engineFlags: undefined })}
+                onClick={() => void commit({ engineFlags: undefined })}
                 disabled={busy}
                 className="rounded bg-fg/5 px-2 py-1 text-xs text-gray-400 hover:bg-fg/10 disabled:opacity-50"
               >
@@ -99,7 +99,7 @@ export default function EngineFlagsSection({ flags = {}, onChange }: Props) {
               <select
                 value={flags[key] === undefined ? 'inherit' : onOff(flags[key])}
                 disabled={busy}
-                onChange={(e) => setFlag(key, e.target.value === 'inherit' ? undefined : e.target.value === 'on')}
+                onChange={(e) => { setFlag(key, e.target.value === 'inherit' ? undefined : e.target.value === 'on') }}
                 className={selectClass}
               >
                 <option value="inherit">{t('common.defaultValue', { value: onOffLabel(global[key]) })}</option>
@@ -116,8 +116,7 @@ export default function EngineFlagsSection({ flags = {}, onChange }: Props) {
                 <select
                   value={flags[key] ?? 'inherit'}
                   disabled={busy}
-                  onChange={(e) =>
-                    setFlag(key, e.target.value === 'inherit' ? undefined : (e.target.value as EngineFlags[typeof key]))
+                  onChange={(e) => { setFlag(key, e.target.value === 'inherit' ? undefined : (e.target.value as EngineFlags[typeof key])) }
                   }
                   className={selectClass}
                 >
@@ -147,8 +146,7 @@ export default function EngineFlagsSection({ flags = {}, onChange }: Props) {
             <select
               value={flags.fullscreenPause ?? 'inherit'}
               disabled={busy}
-              onChange={(e) =>
-                setFlag('fullscreenPause', e.target.value === 'inherit' ? undefined : (e.target.value as FullscreenPauseMode))
+              onChange={(e) => { setFlag('fullscreenPause', e.target.value === 'inherit' ? undefined : (e.target.value as FullscreenPauseMode)) }
               }
               className={selectClass}
             >

+ 7 - 7
src/renderer/src/components/common/sidebar/ImageAdjustmentsSection.tsx

@@ -58,10 +58,10 @@ export default function ImageAdjustmentsSection({ adjustments = {}, live, onComm
           max={100}
           value={value}
           disabled={busy}
-          onChange={(e) => slide(key, Number(e.target.value))}
-          onMouseUp={() => draft && commit(draft)}
-          onTouchEnd={() => draft && commit(draft)}
-          onKeyUp={() => draft && commit(draft)}
+          onChange={(e) => { slide(key, Number(e.target.value)) }}
+          onMouseUp={() => void (draft && commit(draft))}
+          onTouchEnd={() => void (draft && commit(draft))}
+          onKeyUp={() => void (draft && commit(draft))}
           className="w-full accent-accent-500 disabled:opacity-50"
         />
       </div>
@@ -85,7 +85,7 @@ export default function ImageAdjustmentsSection({ adjustments = {}, live, onComm
           <select
             value={current.filter ?? ''}
             disabled={busy}
-            onChange={(e) => commit({ ...current, filter: e.target.value })}
+            onChange={(e) => void commit({ ...current, filter: e.target.value })}
             className={selectClass}
           >
             <option value="">{t('image.noFilter')}</option>
@@ -104,7 +104,7 @@ export default function ImageAdjustmentsSection({ adjustments = {}, live, onComm
             type="checkbox"
             checked={current.colorEnabled ?? false}
             disabled={busy}
-            onChange={(e) => commit({ ...current, colorEnabled: e.target.checked })}
+            onChange={(e) => void commit({ ...current, colorEnabled: e.target.checked })}
             className="accent-accent-500"
           />
           <span className="flex-1">{t('image.colorOptions')}</span>
@@ -137,7 +137,7 @@ export default function ImageAdjustmentsSection({ adjustments = {}, live, onComm
             type="checkbox"
             checked={current.flip ?? false}
             disabled={busy}
-            onChange={(e) => commit({ ...current, flip: e.target.checked })}
+            onChange={(e) => void commit({ ...current, flip: e.target.checked })}
             className="accent-accent-500"
           />
           {t('image.flip')}

+ 5 - 5
src/renderer/src/components/common/sidebar/ThumbnailSection.tsx

@@ -36,7 +36,7 @@ export default function ThumbnailSection({ wallpaper, canGenerate, onUpdated }:
   return (
     <div className="border-t border-fg/5 pt-3">
       <button
-        onClick={() => setOpen((v) => !v)}
+        onClick={() => { setOpen((v) => !v) }}
         className="flex w-full items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-gray-500 hover:text-gray-300"
       >
         {open ? <ChevronDown size={12} /> : <ChevronRight size={12} />}
@@ -56,7 +56,7 @@ export default function ThumbnailSection({ wallpaper, canGenerate, onUpdated }:
               ].map(({ label, original }) => (
                 <button
                   key={label}
-                  onClick={() => showOriginal(original)}
+                  onClick={() => void showOriginal(original)}
                   disabled={busy !== null || usingCustom === !original}
                   className={clsx(
                     'flex-1 py-1',
@@ -72,7 +72,7 @@ export default function ThumbnailSection({ wallpaper, canGenerate, onUpdated }:
           <div className="flex flex-wrap gap-1.5">
             {canGenerate && (
               <button
-                onClick={() => run('generate', () => window.electronAPI.wallpaper.generateThumbnail(wallpaper.id))}
+                onClick={() => void run('generate', () => window.electronAPI.wallpaper.generateThumbnail(wallpaper.id))}
                 disabled={busy !== null}
                 title={t('thumb.captureHint')}
                 className="flex items-center gap-1 rounded bg-fg/5 px-2 py-1 text-gray-300 hover:bg-fg/10 disabled:opacity-50"
@@ -82,7 +82,7 @@ export default function ThumbnailSection({ wallpaper, canGenerate, onUpdated }:
               </button>
             )}
             <button
-              onClick={() => run('pick', () => window.electronAPI.wallpaper.pickThumbnail(wallpaper.id))}
+              onClick={() => void run('pick', () => window.electronAPI.wallpaper.pickThumbnail(wallpaper.id))}
               disabled={busy !== null}
               className="flex items-center gap-1 rounded bg-fg/5 px-2 py-1 text-gray-300 hover:bg-fg/10 disabled:opacity-50"
             >
@@ -91,7 +91,7 @@ export default function ThumbnailSection({ wallpaper, canGenerate, onUpdated }:
             </button>
             {hasCustom && (
               <button
-                onClick={() => run('delete', () => window.electronAPI.wallpaper.deleteThumbnail(wallpaper.id))}
+                onClick={() => void run('delete', () => window.electronAPI.wallpaper.deleteThumbnail(wallpaper.id))}
                 disabled={busy !== null}
                 className="flex items-center gap-1 rounded bg-fg/5 px-2 py-1 text-gray-300 hover:bg-red-500/20 hover:text-red-400 disabled:opacity-50"
               >

+ 23 - 18
src/renderer/src/components/common/sidebar/VideoTrimSection.tsx

@@ -2,6 +2,7 @@ import { useState } from 'react'
 import { Loader2, Play, Plus, RotateCcw, Scissors, X } from 'lucide-react'
 import {
   formatVideoTime,
+  formatVideoTimeExact,
   normalizeVideoSegments,
   parseVideoTime,
   trimmedVideoLength,
@@ -84,13 +85,13 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
 
   function commitText(i: number, side: 'start' | 'end', text: string) {
     const key = `${i}-${side}`
-    const reset = () => clearText(key)
+    const reset = () => { clearText(key) }
     const value = text.trim() === '' ? (side === 'start' ? 0 : undefined) : parseVideoTime(text)
-    if (value === null) return reset()
+    if (value === null) { reset(); return; }
     const changed = { ...rows[i], [side]: value }
-    if (changed.start === rows[i].start && changed.end === rows[i].end) return reset()
+    if (changed.start === rows[i].start && changed.end === rows[i].end) { reset(); return; }
     const length = (changed.end ?? duration ?? Infinity) - changed.start
-    if (length < MIN_LENGTH || (duration !== null && changed.start >= duration)) return reset()
+    if (length < MIN_LENGTH || (duration !== null && changed.start >= duration)) { reset(); return; }
     void commit(withPart(i, changed))
   }
 
@@ -100,7 +101,11 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
     if (start === undefined) return null
     if (duration === null) return { start, end: start + NEW_PART_LENGTH }
     if (start > duration - MIN_LENGTH) return null
-    return { start, end: Math.min(start + NEW_PART_LENGTH, duration) }
+    // a first part covering the whole video would normalize away to "no trim"
+    const wholeVideo = rows.length === 0 && duration <= NEW_PART_LENGTH
+    const length = wholeVideo ? Math.floor((duration / 2) * 10) / 10 : NEW_PART_LENGTH
+    const end = Math.min(start + Math.max(length, MIN_LENGTH), duration)
+    return wholeVideo && end >= duration ? null : { start, end }
   }
 
   function addPart() {
@@ -121,16 +126,16 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
     return (
       <input
         type="text"
-        value={texts[key] ?? (value === null ? '' : formatVideoTime(value))}
+        value={texts[key] ?? (value === null ? '' : formatVideoTimeExact(value))}
         placeholder={side === 'start' ? '0:00' : t('trim.endPlaceholder')}
         disabled={busy}
-        onFocus={() => setSelected(i)}
-        onChange={(e) => setTexts((prev) => ({ ...prev, [key]: e.target.value }))}
+        onFocus={() => { setSelected(i) }}
+        onChange={(e) => { setTexts((prev) => ({ ...prev, [key]: e.target.value })); }}
         onKeyDown={(e) => {
           if (e.key === 'Enter') e.currentTarget.blur()
           if (e.key === 'Escape') clearText(key)
         }}
-        onBlur={(e) => texts[key] !== undefined && commitText(i, side, e.currentTarget.value)}
+        onBlur={(e) => { if (texts[key] !== undefined) commitText(i, side, e.currentTarget.value) }}
         title={t('trim.timeHint')}
         className={timeInputClass}
       />
@@ -149,10 +154,10 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
           step={0.1}
           value={side === 'start' ? part.start : (part.end ?? duration)}
           disabled={busy}
-          onChange={(e) => slide(side, Number(e.target.value))}
-          onMouseUp={() => draft && commit(draft)}
-          onTouchEnd={() => draft && commit(draft)}
-          onKeyUp={() => draft && commit(draft)}
+          onChange={(e) => { slide(side, Number(e.target.value)) }}
+          onMouseUp={() => void (draft && commit(draft))}
+          onTouchEnd={() => void (draft && commit(draft))}
+          onKeyUp={() => void (draft && commit(draft))}
           title={side === 'start' ? t('trim.startHint') : t('trim.endHint')}
           className="w-full accent-accent-500 disabled:opacity-50"
         />
@@ -170,7 +175,7 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
         {trimmed && (
           <button
             disabled={busy}
-            onClick={() => commit([])}
+            onClick={() => void commit([])}
             title={t('trim.reset')}
             className="text-gray-500 hover:text-gray-300 disabled:opacity-50"
           >
@@ -189,7 +194,7 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
               <button
                 key={i}
                 disabled={!rows.length}
-                onClick={() => setSelected(i)}
+                onClick={() => { setSelected(i) }}
                 title={`${formatVideoTime(s.start)} - ${formatVideoTime(endOf(s) ?? duration)}`}
                 className={`absolute inset-y-0 ${rows.length && i === index ? 'bg-accent-400' : 'bg-accent-500/50'}`}
                 style={{
@@ -205,7 +210,7 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
         {rows.map((s, i) => (
           <div key={i} className={`flex items-center gap-1.5 rounded px-1 ${i === index ? 'bg-fg/5' : ''}`}>
             <button
-              onClick={() => setSelected(i)}
+              onClick={() => { setSelected(i) }}
               className={`flex-1 text-left ${i === index ? 'text-gray-200' : 'text-gray-500 hover:text-gray-300'}`}
             >
               {t('trim.part', { n: i + 1 })}
@@ -215,7 +220,7 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
             {timeInput(i, 'end')}
             <button
               disabled={busy}
-              onClick={() => removePart(i)}
+              onClick={() => { removePart(i) }}
               title={t('trim.removePart')}
               className="text-gray-500 hover:text-red-300 disabled:opacity-50"
             >
@@ -245,7 +250,7 @@ export default function VideoTrimSection({ segments, duration, live, onCommit, o
           {live && trimmed && part && seamSeek(part) !== undefined && (
             <button
               disabled={busy}
-              onClick={() => onPreview(segments, seamSeek(part))}
+              onClick={() => { onPreview(segments, seamSeek(part)) }}
               title={t('trim.cutHint', { seconds: SEAM_LEAD, n: index + 1 })}
               className="flex items-center gap-1 rounded bg-fg/10 px-1.5 py-0.5 text-[10px] text-gray-300 hover:bg-fg/15 disabled:opacity-40"
             >

+ 2 - 2
src/renderer/src/components/layout/GnomeExtensionNotice.tsx

@@ -57,7 +57,7 @@ export default function GnomeExtensionNotice() {
       </span>
       {canInstall && (
         <button
-          onClick={install}
+          onClick={() => void install()}
           disabled={busy}
           className="rounded bg-accent-600 px-3 py-1 text-xs font-medium text-white hover:bg-accent-500 disabled:opacity-50"
         >
@@ -65,7 +65,7 @@ export default function GnomeExtensionNotice() {
         </button>
       )}
       {commands && (
-        <button onClick={recheck} className="rounded bg-fg/10 px-3 py-1 text-xs hover:bg-fg/20">
+        <button onClick={() => void recheck()} className="rounded bg-fg/10 px-3 py-1 text-xs hover:bg-fg/20">
           {t('gnome.checkAgain')}
         </button>
       )}

+ 1 - 1
src/renderer/src/components/layout/GraphicsNotice.tsx

@@ -66,7 +66,7 @@ export default function GraphicsNotice() {
         <span className="flex-1">{t(MESSAGES[warning.kind], { renderer: warning.renderer ?? '' })}</span>
         {warning.kind === 'flatpak-nvidia' && warning.extension && (
           <button
-            onClick={install}
+            onClick={() => void install()}
             disabled={installing}
             className="flex items-center gap-1.5 rounded bg-accent-600 px-3 py-1 text-xs font-medium text-white hover:bg-accent-500 disabled:opacity-50"
           >

+ 2 - 2
src/renderer/src/components/layout/Sidebar.tsx

@@ -42,14 +42,14 @@ export default function Sidebar({ activeView, onNavigate }: SidebarProps) {
   return (
     <aside className="flex w-14 flex-col items-center gap-1.5 border-r border-fg/5 bg-chrome py-3">
       {items.map(({ id, label, icon }) => (
-        <NavButton key={id} active={activeView === id} label={label} icon={icon} onClick={() => onNavigate(id)} />
+        <NavButton key={id} active={activeView === id} label={label} icon={icon} onClick={() => { onNavigate(id) }} />
       ))}
       <div className="flex-1" />
       <NavButton
         active={activeView === 'settings'}
         label={t('nav.settings')}
         icon={Settings}
-        onClick={() => onNavigate('settings')}
+        onClick={() => { onNavigate('settings') }}
       />
     </aside>
   )

+ 4 - 4
src/renderer/src/components/layout/StatusBar.tsx

@@ -8,7 +8,7 @@ export default function StatusBar() {
   const [steamRunning, setSteamRunning] = useState(false)
 
   useEffect(() => {
-    window.electronAPI.steam.isRunning().then(setSteamRunning).catch(() => setSteamRunning(false))
+    window.electronAPI.steam.isRunning().then(setSteamRunning).catch(() => { setSteamRunning(false) })
 
     const unsub = window.electronAPI.on.steamStatus(setSteamRunning)
     return unsub
@@ -43,9 +43,9 @@ export default function StatusBar() {
           {playback.screen !== '*' && <span className="text-gray-600">{t('status.onScreen', { screen: screenLabel(playback.screen) })}</span>}
           <button
             onClick={() =>
-              playback.isPlaying
+              void (playback.isPlaying
                 ? window.electronAPI.playlist.pause(playback.screen)
-                : window.electronAPI.playlist.resume(playback.screen)
+                : window.electronAPI.playlist.resume(playback.screen))
             }
             title={playback.isPlaying ? t('common.pause') : t('common.resume')}
             className="text-gray-400 hover:text-gray-200"
@@ -53,7 +53,7 @@ export default function StatusBar() {
             {playback.isPlaying ? <Pause size={11} /> : <Play size={11} />}
           </button>
           <button
-            onClick={() => window.electronAPI.playlist.next(playback.screen)}
+            onClick={() => void window.electronAPI.playlist.next(playback.screen)}
             title={t('common.next')}
             className="text-gray-400 hover:text-gray-200"
           >

+ 198 - 160
src/renderer/src/components/library/LibraryView.tsx

@@ -17,6 +17,7 @@ import {
   ChevronLeft
 } from 'lucide-react'
 import WallpaperCard from './WallpaperCard'
+import ResizableWidth from '../common/ResizableWidth'
 import PreviewSizeToggle from '../common/PreviewSizeToggle'
 import DetailSidebar from '../common/DetailSidebar'
 import WallpaperContextMenu from '../common/WallpaperContextMenu'
@@ -32,6 +33,7 @@ import {
   ToolbarButton
 } from '../common/GridControls'
 import { CheckItem, FilterPanel, FilterSection, ResolutionFilterSection, TagFilterSection } from '../common/FilterPanel'
+import { Reorderable, ReorderableSections, useReorder } from '../common/Reorderable'
 import { useToast } from '../common/Toast'
 import type { BackupProgressEvent, LibraryFilters, WallpaperFolder } from '@shared/types'
 import clsx from 'clsx'
@@ -146,7 +148,7 @@ function TagsFilterSection({
         type="text"
         placeholder={t('filters.searchTags')}
         value={search}
-        onChange={(e) => setSearch(e.target.value)}
+        onChange={(e) => { setSearch(e.target.value) }}
         className="mb-1 w-full rounded bg-fg/5 px-2 py-1 text-xs text-gray-200 outline-none focus:ring-1 focus:ring-accent-500"
       />
       <div className="max-h-64 overflow-y-auto">
@@ -156,7 +158,7 @@ function TagsFilterSection({
             key={tag}
             label={tagLabel(tag)}
             checked={selected.includes(tag)}
-            onChange={() => onChange(toggle(selected, tag))}
+            onChange={() => { onChange(toggle(selected, tag)) }}
           />
         ))}
       </div>
@@ -219,7 +221,13 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
   const cardBadges = useCardBadges()
   const lweInstalled = useLweInstalled()
   const isBackupConfigured = useConfig()?.isBackupConfigured ?? false
-  const { folders, foldersLoaded, refetchFolders, moveToFolder } = useFolders()
+  const { folders: savedFolders, foldersLoaded, refetchFolders, moveToFolder } = useFolders()
+  const folderOrder = useReorder('we-library-folder-order', savedFolders.map((f) => f.id))
+  const folders = useMemo(
+    () => folderOrder.sortItems(savedFolders, (f) => f.id),
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+    [savedFolders, folderOrder.order]
+  )
 
   useEffect(() => {
     if (foldersLoaded && activeFolder && !folders.some((f) => f.id === activeFolder)) setActiveFolder(null)
@@ -273,7 +281,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
     const off = window.electronAPI.on.downloadProgress((progress) => {
       if (progress.status === 'completed' || progress.status === 'error') {
         clearTimeout(timer)
-        timer = setTimeout(() => queryClient.invalidateQueries({ queryKey: ['library'] }), 500)
+        timer = setTimeout(() => void queryClient.invalidateQueries({ queryKey: ['library'] }), 500)
       }
     })
     return () => {
@@ -449,7 +457,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
   async function addToCurrentPlaylist(ids: string[]) {
     if (!currentPlaylistId || ids.length === 0) return
     await window.electronAPI.playlist.addItems(currentPlaylistId, ids)
-    queryClient.invalidateQueries({ queryKey: ['playlists'] })
+    void queryClient.invalidateQueries({ queryKey: ['playlists'] })
     showToast(t('playlist.addedToCurrent'))
   }
 
@@ -492,8 +500,8 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
 
   useEffect(() => {
     if (liveProgress || backupTaskRunning) return
-    const timer = setTimeout(() => setLingeringProgress(null), 1500)
-    return () => clearTimeout(timer)
+    const timer = setTimeout(() => { setLingeringProgress(null) }, 1500)
+    return () => { clearTimeout(timer) }
   }, [liveProgress, backupTaskRunning])
 
   const statusLine =
@@ -511,7 +519,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
         next.delete(task)
         return next
       })
-      queryClient.invalidateQueries({ queryKey: ['library'] })
+      void queryClient.invalidateQueries({ queryKey: ['library'] })
     }
   }
 
@@ -565,8 +573,8 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
     const result = await window.electronAPI.library.scan()
     setScanResult(result)
     setScanning(false)
-    queryClient.invalidateQueries({ queryKey: ['library'] })
-    queryClient.invalidateQueries({ queryKey: ['library-tags'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library-tags'] })
   }
 
   const [creatingFolder, setCreatingFolder] = useState(false)
@@ -581,7 +589,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
     await window.electronAPI.folders.create(newFolderName.trim())
     setNewFolderName('')
     setCreatingFolder(false)
-    refetchFolders()
+    void refetchFolders()
   }
 
   async function handleImportWEConfig() {
@@ -589,8 +597,8 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
       const filePath = await window.electronAPI.config.pickFile()
       if (!filePath) return
       const result = await window.electronAPI.config.importWE(filePath)
-      refetchFolders()
-      queryClient.invalidateQueries({ queryKey: ['library'] })
+      void refetchFolders()
+      void queryClient.invalidateQueries({ queryKey: ['library'] })
       setImportStatus(t('library.importedConfig', { folders: result.folders, playlists: result.playlists }))
     } catch (err) {
       setImportStatus(t('setup.importFailed', { error: (err as Error).message }))
@@ -599,7 +607,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
 
   async function handleCleanupFolders() {
     const { removed } = await window.electronAPI.folders.cleanup()
-    refetchFolders()
+    void refetchFolders()
     setImportStatus(
       removed > 0
         ? t('library.cleanedUp', { count: removed })
@@ -611,14 +619,14 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
     if (!renameValue.trim()) return
     await window.electronAPI.folders.rename(id, renameValue.trim())
     setRenamingId(null)
-    refetchFolders()
+    void refetchFolders()
   }
 
   async function handleDeleteFolder(id: string) {
     await window.electronAPI.folders.delete(id)
     if (activeFolder === id) setActiveFolder(null)
     setFolderMenu(null)
-    refetchFolders()
+    void refetchFolders()
   }
 
   // dragging a selected card moves the whole selection
@@ -641,11 +649,11 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
   useEffect(() => {
     function onKeyDown(e: KeyboardEvent) {
       if (e.key === '+' && selectedIds.size > 0 && !isEditingText()) {
-        addToCurrentPlaylist([...selectedIds])
+        void addToCurrentPlaylist([...selectedIds])
       }
     }
     window.addEventListener('keydown', onKeyDown)
-    return () => window.removeEventListener('keydown', onKeyDown)
+    return () => { window.removeEventListener('keydown', onKeyDown) }
   })
 
   function openWallpaperCtxMenu(e: React.MouseEvent, wallpaperId: string) {
@@ -660,12 +668,12 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
   return (
     <div className="flex h-full flex-col">
       <div className="flex flex-wrap items-center gap-3 border-b border-fg/5 px-4 py-3">
-        <FiltersToggle open={showFilters} activeCount={activeCount} onClick={() => setShowFilters((v) => !v)} />
-        <PanelToggle icon={Folder} label={t('library.folders')} open={showFolders} onClick={() => setShowFolders((v) => !v)} />
+        <FiltersToggle open={showFilters} activeCount={activeCount} onClick={() => { setShowFilters((v) => !v) }} />
+        <PanelToggle icon={Folder} label={t('library.folders')} open={showFolders} onClick={() => { setShowFolders((v) => !v) }} />
         <SearchInput value={search} placeholder={t('picker.search')} onChange={setSearch} />
         <select
           value={sort.sortBy ?? 'updatedAt'}
-          onChange={(e) => setSort((prev) => ({ ...prev, sortBy: e.target.value as LibraryFilters['sortBy'] }))}
+          onChange={(e) => { setSort((prev) => ({ ...prev, sortBy: e.target.value as LibraryFilters['sortBy'] })); }}
           className="rounded-lg bg-card px-3 py-2 text-sm text-gray-200 outline-none focus:ring-1 focus:ring-accent-500"
         >
           <option value="title">{t('library.sortName')}</option>
@@ -676,7 +684,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
           <option value="appliedCount">{t('library.sortMostApplied')}</option>
         </select>
         <button
-          onClick={() => setSort((prev) => ({ ...prev, sortDir: prev.sortDir === 'asc' ? 'desc' : 'asc' }))}
+          onClick={() => { setSort((prev) => ({ ...prev, sortDir: prev.sortDir === 'asc' ? 'desc' : 'asc' })); }}
           title={sort.sortDir === 'asc' ? t('library.ascending') : t('library.descending')}
           className="rounded-lg bg-fg/5 px-2 py-2 text-sm text-gray-300 hover:bg-fg/10"
         >
@@ -684,7 +692,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
         </button>
         <select
           value={pageSize}
-          onChange={(e) => setPageSize(Number(e.target.value))}
+          onChange={(e) => { setPageSize(Number(e.target.value)) }}
           className="rounded-lg bg-card px-3 py-2 text-sm text-gray-200 outline-none focus:ring-1 focus:ring-accent-500"
         >
           <option value={50}>{t('library.perPage', { count: 50 })}</option>
@@ -692,14 +700,14 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
           <option value={200}>{t('library.perPage', { count: 200 })}</option>
         </select>
         <PreviewSizeToggle value={previewSize} onChange={setPreviewSize} />
-        {activeCount > 0 && <ResetFiltersButton onClick={() => setFilterState(DEFAULT_STATE)} />}
+        {activeCount > 0 && <ResetFiltersButton onClick={() => { setFilterState(DEFAULT_STATE) }} />}
         <div className="ml-auto" />
         <ToolbarButton
           icon={<RefreshCw size={14} />}
           busy={scanning}
           disabled={scanning}
           title={t('library.scanHint')}
-          onClick={handleScan}
+          onClick={() => void handleScan()}
         >
           {t('library.scan')}
         </ToolbarButton>
@@ -796,136 +804,158 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
       <div className="flex flex-1 overflow-hidden">
         {showFilters && (
           <FilterPanel>
-            <FilterSection title={t('filters.status')} activeCount={flagCount}>
-              <CheckItem
-                label={t('subscribe.downloadFailed')}
-                title={t('filters.failedHint')}
-                count={statusCounts.failed}
-                checked={filterState.failedOnly}
-                onChange={() => toggleFlag('failedOnly')}
-              />
-              <CheckItem
-                label={t('vote.liked')}
-                title={t('filters.likedHint')}
-                count={statusCounts.liked}
-                checked={filterState.likedOnly}
-                onChange={() => toggleFlag('likedOnly')}
-              />
-              <CheckItem
-                label={t('borders.disliked')}
-                title={t('filters.dislikedHint')}
-                count={statusCounts.disliked}
-                checked={filterState.dislikedOnly}
-                onChange={() => toggleFlag('dislikedOnly')}
-              />
-              <CheckItem
-                label={t('filters.favorites')}
-                title={t('filters.favoritesHint')}
-                count={statusCounts.favorites}
-                checked={filterState.favoritesOnly}
-                onChange={() => toggleFlag('favoritesOnly')}
-              />
-              <CheckItem
-                label={t('filters.unavailable')}
-                title={
-                  unavailableNotBackedUp.length > 0
-                    ? t('filters.unavailableHintBackup', { count: unavailableNotBackedUp.length })
-                    : t('filters.unavailableHint')
-                }
-                count={statusCounts.unavailable}
-                checked={filterState.unavailableOnly}
-                onChange={() => toggleFlag('unavailableOnly')}
-              />
-              <CheckItem
-                label={t('filters.outdatedBackup')}
-                title={t('filters.outdatedBackupHint')}
-                count={statusCounts.outdatedBackup}
-                checked={filterState.outdatedBackupOnly}
-                onChange={() => toggleFlag('outdatedBackupOnly')}
-              />
-              <CheckItem
-                label={t('verify.damaged')}
-                title={t('verify.damagedHint')}
-                count={statusCounts.damaged}
-                checked={filterState.damagedOnly}
-                onChange={() => toggleFlag('damagedOnly')}
-              />
-            </FilterSection>
-            <FilterSection title={t('filters.features')} activeCount={featureCount}>
-              <CheckItem
-                label="HDR"
-                title={t('filters.hdrHint')}
-                count={statusCounts.hdr}
-                checked={filterState.hdrOnly}
-                onChange={() => toggleFlag('hdrOnly')}
-              />
-              <CheckItem
-                label="HRTF"
-                title={t('filters.hrtfHint')}
-                count={statusCounts.hrtf}
-                checked={filterState.hrtfOnly}
-                onChange={() => toggleFlag('hrtfOnly')}
-              />
-            </FilterSection>
-            <FilterSection title={t('filters.showOnly')} defaultOpen={false} activeCount={filterState.showOnly.length}>
-              {WE_SHOW_ONLY.map((item) => (
-                <CheckItem
-                  key={item.tag}
-                  label={tagLabel(item.label)}
-                  count={showOnlyCounts.get(item.tag) ?? 0}
-                  checked={filterState.showOnly.includes(item.tag)}
-                  onChange={() => setFilter('showOnly', toggle(filterState.showOnly, item.tag))}
+            <ReorderableSections
+              storageKey="we-library-filter-order"
+              sections={[
+                { id: 'status', node: (
+                <FilterSection title={t('filters.status')} activeCount={flagCount}>
+                  <CheckItem
+                    label={t('subscribe.downloadFailed')}
+                    title={t('filters.failedHint')}
+                    count={statusCounts.failed}
+                    checked={filterState.failedOnly}
+                    onChange={() => { toggleFlag('failedOnly') }}
+                  />
+                  <CheckItem
+                    label={t('vote.liked')}
+                    title={t('filters.likedHint')}
+                    count={statusCounts.liked}
+                    checked={filterState.likedOnly}
+                    onChange={() => { toggleFlag('likedOnly') }}
+                  />
+                  <CheckItem
+                    label={t('borders.disliked')}
+                    title={t('filters.dislikedHint')}
+                    count={statusCounts.disliked}
+                    checked={filterState.dislikedOnly}
+                    onChange={() => { toggleFlag('dislikedOnly') }}
+                  />
+                  <CheckItem
+                    label={t('filters.favorites')}
+                    title={t('filters.favoritesHint')}
+                    count={statusCounts.favorites}
+                    checked={filterState.favoritesOnly}
+                    onChange={() => { toggleFlag('favoritesOnly') }}
+                  />
+                  <CheckItem
+                    label={t('filters.unavailable')}
+                    title={
+                      unavailableNotBackedUp.length > 0
+                        ? t('filters.unavailableHintBackup', { count: unavailableNotBackedUp.length })
+                        : t('filters.unavailableHint')
+                    }
+                    count={statusCounts.unavailable}
+                    checked={filterState.unavailableOnly}
+                    onChange={() => { toggleFlag('unavailableOnly') }}
+                  />
+                  <CheckItem
+                    label={t('filters.outdatedBackup')}
+                    title={t('filters.outdatedBackupHint')}
+                    count={statusCounts.outdatedBackup}
+                    checked={filterState.outdatedBackupOnly}
+                    onChange={() => { toggleFlag('outdatedBackupOnly') }}
+                  />
+                  <CheckItem
+                    label={t('verify.damaged')}
+                    title={t('verify.damagedHint')}
+                    count={statusCounts.damaged}
+                    checked={filterState.damagedOnly}
+                    onChange={() => { toggleFlag('damagedOnly') }}
+                  />
+                </FilterSection>
+                ) },
+                { id: 'features', node: (
+                <FilterSection title={t('filters.features')} activeCount={featureCount}>
+                  <CheckItem
+                    label="HDR"
+                    title={t('filters.hdrHint')}
+                    count={statusCounts.hdr}
+                    checked={filterState.hdrOnly}
+                    onChange={() => { toggleFlag('hdrOnly') }}
+                  />
+                  <CheckItem
+                    label="HRTF"
+                    title={t('filters.hrtfHint')}
+                    count={statusCounts.hrtf}
+                    checked={filterState.hrtfOnly}
+                    onChange={() => { toggleFlag('hrtfOnly') }}
+                  />
+                </FilterSection>
+                ) },
+                { id: 'showOnly', node: (
+                <FilterSection title={t('filters.showOnly')} defaultOpen={false} activeCount={filterState.showOnly.length}>
+                  {WE_SHOW_ONLY.map((item) => (
+                    <CheckItem
+                      key={item.tag}
+                      label={tagLabel(item.label)}
+                      count={showOnlyCounts.get(item.tag) ?? 0}
+                      checked={filterState.showOnly.includes(item.tag)}
+                      onChange={() => { setFilter('showOnly', toggle(filterState.showOnly, item.tag)) }}
+                    />
+                  ))}
+                </FilterSection>
+                ) },
+                { id: 'type', node: (
+                <TagFilterSection
+                  title={t('filters.type')}
+                  options={LIBRARY_TYPES}
+                  selected={filterState.types}
+                  onChange={(tags) => { setFilter('types', tags) }}
                 />
-              ))}
-            </FilterSection>
-            <TagFilterSection
-              title={t('filters.type')}
-              options={LIBRARY_TYPES}
-              selected={filterState.types}
-              onChange={(tags) => setFilter('types', tags)}
-            />
-            <TagFilterSection
-              title={t('filters.ageRating')}
-              options={WE_LIBRARY_AGE_RATINGS}
-              selected={filterState.ageRatings}
-              onChange={(tags) => setFilter('ageRatings', tags)}
-            />
-            <TagFilterSection
-              title={t('filters.source')}
-              options={SOURCES}
-              selected={filterState.sources}
-              onChange={(tags) => setFilter('sources', tags)}
-            />
-            <ResolutionFilterSection
-              selected={filterState.resolutions}
-              allTags={ALL_RESOLUTION_TAGS}
-              counts={resolutionCounts}
-              onChange={(resolutions) => setFilter('resolutions', resolutions)}
-            />
-            <TagsFilterSection
-              available={availableTags}
-              selected={filterState.genres}
-              onChange={(tags) => setFilter('genres', tags)}
+                ) },
+                { id: 'ageRating', node: (
+                <TagFilterSection
+                  title={t('filters.ageRating')}
+                  options={WE_LIBRARY_AGE_RATINGS}
+                  selected={filterState.ageRatings}
+                  onChange={(tags) => { setFilter('ageRatings', tags) }}
+                />
+                ) },
+                { id: 'source', node: (
+                <TagFilterSection
+                  title={t('filters.source')}
+                  options={SOURCES}
+                  selected={filterState.sources}
+                  onChange={(tags) => { setFilter('sources', tags) }}
+                />
+                ) },
+                { id: 'resolution', node: (
+                <ResolutionFilterSection
+                  selected={filterState.resolutions}
+                  allTags={ALL_RESOLUTION_TAGS}
+                  counts={resolutionCounts}
+                  onChange={(resolutions) => { setFilter('resolutions', resolutions) }}
+                />
+                ) },
+                { id: 'tags', node: (
+                <TagsFilterSection
+                  available={availableTags}
+                  selected={filterState.genres}
+                  onChange={(tags) => { setFilter('genres', tags) }}
+                />
+                ) },
+              ]}
             />
           </FilterPanel>
         )}
 
         {showFolders && (
-        <div className="flex w-48 flex-shrink-0 flex-col border-r border-fg/5 overflow-y-auto">
+        <ResizableWidth storageKey="we-folder-panel-width" defaultWidth={192} min={140} max={360} edge="right">
+        <div className="flex w-full flex-col border-r border-fg/5 overflow-y-auto">
           <div className="flex items-center justify-between px-3 pt-3 pb-1">
             <span className="text-[10px] font-semibold uppercase tracking-wide text-gray-600">
               {t('library.folders')}
             </span>
             <div className="flex gap-1">
               <button
-                onClick={handleImportWEConfig}
+                onClick={() => void handleImportWEConfig()}
                 title={t('library.importConfig')}
                 className="rounded p-0.5 text-gray-600 hover:text-gray-300"
               >
                 <Upload size={12} />
               </button>
               <button
-                onClick={handleCleanupFolders}
+                onClick={() => void handleCleanupFolders()}
                 title={t('library.cleanup')}
                 className="rounded p-0.5 text-gray-600 hover:text-gray-300"
               >
@@ -947,7 +977,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
             </div>
           )}
 
-          <button onClick={() => setActiveFolder(null)} className={folderRowClass(activeFolder === null)}>
+          <button onClick={() => { setActiveFolder(null) }} className={folderRowClass(activeFolder === null)}>
             <Folder size={14} />
             <span className="flex-1 text-left truncate">{t('library.defaultFolder')}</span>
             <span className="text-gray-600">{unsorted.length}</span>
@@ -959,10 +989,10 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
               <input
                 autoFocus
                 value={newFolderName}
-                onChange={(e) => setNewFolderName(e.target.value)}
-                onBlur={handleCreateFolderSubmit}
+                onChange={(e) => { setNewFolderName(e.target.value) }}
+                onBlur={() => void handleCreateFolderSubmit()}
                 onKeyDown={(e) => {
-                  if (e.key === 'Enter') handleCreateFolderSubmit()
+                  if (e.key === 'Enter') void handleCreateFolderSubmit()
                   if (e.key === 'Escape') setCreatingFolder(false)
                 }}
                 placeholder={t('library.folderName')}
@@ -972,12 +1002,18 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
           )}
 
           {folders.map((folder) => (
-            <button
+            <Reorderable
               key={folder.id}
-              onClick={() => setActiveFolder(folder.id)}
-              onContextMenu={(e) => openFolderMenu(e, folder)}
-              onDragOver={(e) => e.preventDefault()}
-              onDrop={(e) => handleDrop(folder.id, dropWallpaperId(e))}
+              group="we-library-folder-order"
+              id={folder.id}
+              onMove={folderOrder.move}
+              disabled={renamingId === folder.id}
+            >
+            <button
+              onClick={() => { setActiveFolder(folder.id) }}
+              onContextMenu={(e) => { openFolderMenu(e, folder) }}
+              onDragOver={(e) => { e.preventDefault() }}
+              onDrop={(e) => { handleDrop(folder.id, dropWallpaperId(e)) }}
               className={folderRowClass(activeFolder === folder.id)}
             >
               {activeFolder === folder.id ? <FolderOpen size={14} /> : <Folder size={14} />}
@@ -985,13 +1021,13 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
                 <input
                   autoFocus
                   value={renameValue}
-                  onChange={(e) => setRenameValue(e.target.value)}
-                  onBlur={() => handleRename(folder.id)}
+                  onChange={(e) => { setRenameValue(e.target.value) }}
+                  onBlur={() => void handleRename(folder.id)}
                   onKeyDown={(e) => {
-                    if (e.key === 'Enter') handleRename(folder.id)
+                    if (e.key === 'Enter') void handleRename(folder.id)
                     if (e.key === 'Escape') setRenamingId(null)
                   }}
-                  onClick={(e) => e.stopPropagation()}
+                  onClick={(e) => { e.stopPropagation() }}
                   className="flex-1 bg-transparent text-xs text-gray-200 outline-none"
                 />
               ) : (
@@ -999,15 +1035,17 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
               )}
               <span className="text-gray-600">{folderCounts.get(folder.id) ?? 0}</span>
             </button>
+            </Reorderable>
           ))}
         </div>
+        </ResizableWidth>
         )}
 
         <div {...containerProps} className="relative flex-1 overflow-y-auto p-4 select-none">
           {!showFolders && activeFolderTitle && (
             <div className="mb-3 flex items-center gap-1.5 text-xs text-gray-400">
               <button
-                onClick={() => setActiveFolder(null)}
+                onClick={() => { setActiveFolder(null) }}
                 className="flex items-center gap-1 rounded bg-fg/5 px-2 py-1 text-gray-300 hover:bg-fg/10"
               >
                 <ChevronLeft size={12} /> {t('library.defaultFolder')}
@@ -1038,8 +1076,8 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
               {folders.map((folder) => (
                 <div
                   key={folder.id}
-                  onClick={() => setActiveFolder(folder.id)}
-                  onContextMenu={(e) => openFolderMenu(e, folder)}
+                  onClick={() => { setActiveFolder(folder.id) }}
+                  onContextMenu={(e) => { openFolderMenu(e, folder) }}
                   onDragOver={(e) => {
                     e.preventDefault()
                     e.currentTarget.classList.add('ring-2', 'ring-accent-500')
@@ -1082,8 +1120,8 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
                 previewSize={previewSize}
                 isInCurrentPlaylist={currentPlaylistItemIds.has(wallpaper.id)}
                 backupProgress={backupProgress.get(wallpaper.id) ?? null}
-                onSelect={(e) => handleCardSelect(wallpaper.id, e)}
-                onContextMenu={(e) => openWallpaperCtxMenu(e, wallpaper.id)}
+                onSelect={(e) => { handleCardSelect(wallpaper.id, e) }}
+                onContextMenu={(e) => { openWallpaperCtxMenu(e, wallpaper.id) }}
               />
             ))}
           </div>
@@ -1103,8 +1141,8 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
           <DetailSidebar
             id={detailId}
             {...detailSidebarProps(detailWallpaper)}
-            onClose={() => setDetailId(null)}
-            onSubscribe={() => subscribe(detailId)}
+            onClose={() => { setDetailId(null) }}
+            onSubscribe={() => void subscribe(detailId)}
             onUnsubscribe={() => unsubscribe([detailId])}
             onPlay={(screen) => applyWallpaper(detailId, screen)}
             onBrowseCreator={onBrowseCreator}
@@ -1116,7 +1154,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
         <ContextMenu
           x={folderMenu.x}
           y={folderMenu.y}
-          onClose={() => setFolderMenu(null)}
+          onClose={() => { setFolderMenu(null) }}
           className="min-w-[140px]"
         >
           <MenuItem
@@ -1129,7 +1167,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
           >
             {t('common.rename')}
           </MenuItem>
-          <MenuItem icon={Trash2} danger onClick={() => handleDeleteFolder(folderMenu.folder.id)}>
+          <MenuItem icon={Trash2} danger onClick={() => void handleDeleteFolder(folderMenu.folder.id)}>
             {t('common.delete')}
           </MenuItem>
         </ContextMenu>
@@ -1141,7 +1179,7 @@ export default function LibraryView({ onBrowseCreator }: LibraryViewProps) {
           y={ctxMenu.y}
           ids={ctxMenu.ids}
           wallpapers={ctxWallpapers}
-          onClose={() => setCtxMenu(null)}
+          onClose={() => { setCtxMenu(null) }}
           onBrowseCreator={onBrowseCreator}
         />
       )}

+ 181 - 96
src/renderer/src/components/library/WallpaperCard.tsx

@@ -83,7 +83,7 @@ export default function WallpaperCard({
   }, [wallpaper.downloading, wallpaper.id])
 
   function refreshLibrary() {
-    queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
   }
 
   async function handleRedownload(e: React.MouseEvent) {
@@ -121,7 +121,7 @@ export default function WallpaperCard({
     if (parsed !== undefined && (isNaN(parsed) || parsed < 1)) return
     const current = wallpaper.fpsOverride
     if ((parsed ?? undefined) === current) return
-    window.electronAPI.library.update(wallpaper.id, { fpsOverride: parsed })
+    window.electronAPI.library.update(wallpaper.id, { fpsOverride: parsed }).catch(console.error)
   }
 
   async function handleAddToPlaylist() {
@@ -131,7 +131,7 @@ export default function WallpaperCard({
     try {
       await window.electronAPI.playlist.addItems(currentPlaylistId, [wallpaper.id])
       showToast(t('playlist.addedToCurrent'))
-      queryClient.invalidateQueries({ queryKey: ['playlists'] })
+      void queryClient.invalidateQueries({ queryKey: ['playlists'] })
     } catch (err) {
       setError((err as Error).message)
     } finally {
@@ -147,7 +147,7 @@ export default function WallpaperCard({
     try {
       await window.electronAPI.steam.unsubscribe(wallpaper.id)
       refreshLibrary()
-      queryClient.invalidateQueries({ queryKey: ['folders'] })
+      void queryClient.invalidateQueries({ queryKey: ['folders'] })
     } catch (err) {
       setError((err as Error).message)
       setUnsubState('idle')
@@ -161,9 +161,174 @@ export default function WallpaperCard({
 
   const previewSrc = getPreviewSrc(wallpaper)
   const compact = previewSize !== 'big'
+  const tiny = previewSize === 'small'
 
   const playBlocked = !lweInstalled || !!wallpaper.downloading || !!wallpaper.downloadFailed
 
+  const actionButtons = (
+    <>
+      <LikeAction
+        id={wallpaper.id}
+        isLiked={steam.isLiked}
+        unavailable={wallpaper.unavailable}
+        compact={compact}
+        onError={setError}
+      />
+      <CardAction
+        icon={isInCurrentPlaylist ? Check : Plus}
+        label={isInCurrentPlaylist ? t('playlist.added') : t('playlist.add')}
+        busy={isAddingToPlaylist}
+        compact={compact}
+        tone={isInCurrentPlaylist ? 'active' : 'default'}
+        disabled={!currentPlaylistId || isAddingToPlaylist || isInCurrentPlaylist}
+        title={
+          !currentPlaylistId
+            ? t('playlist.noneActive')
+            : isInCurrentPlaylist
+              ? t('playlist.alreadyInCurrent')
+              : t('playlist.addToCurrent')
+        }
+        onClick={() => void handleAddToPlaylist()}
+      />
+      {unsubState === 'confirm' ? (
+        <div className="flex items-center gap-1">
+          {!compact && <span className="text-xs text-gray-400">{t('common.sure')}</span>}
+          <button
+            onClick={(e) => void handleUnsubscribeClick(e)}
+            title={t('subscribe.confirmUnsubscribe')}
+            className={clsx('rounded bg-red-600/80 text-xs text-white hover:bg-red-600', compact ? 'p-1.5' : 'px-2 py-1')}
+          >
+            {compact ? <Check size={11} /> : t('common.yes')}
+          </button>
+          <button
+            onClick={(e) => { e.stopPropagation(); setUnsubState('idle') }}
+            title={t('common.cancel')}
+            className={clsx('rounded bg-fg/5 text-xs text-gray-400 hover:bg-fg/10', compact ? 'p-1.5' : 'px-2 py-1')}
+          >
+            {compact ? <X size={11} /> : t('common.no')}
+          </button>
+        </div>
+      ) : (
+        <CardAction
+          icon={Trash2}
+          label={t('subscribe.unsubShort')}
+          busy={unsubState === 'pending'}
+          compact={compact}
+          tone="danger"
+          disabled={unsubState === 'pending'}
+          title={t('subscribe.unsubscribeHint')}
+          onClick={(e) => void handleUnsubscribeClick(e)}
+        />
+      )}
+      <SteamAction id={wallpaper.id} compact={compact} />
+      <CardAction
+        icon={FolderOpen}
+        label={t('common.open')}
+        compact={compact}
+        disabled={!wallpaper.localPath}
+        title={wallpaper.localPath ? t('library.openFolder') : t('library.noLocalFiles')}
+        onClick={() => void handleOpenLocally()}
+      />
+    </>
+  )
+
+  const featureBadges = (badges.hdr && wallpaper.hdr) || (badges.hrtf && wallpaper.hrtf) ? (
+    <>
+      {badges.hdr && wallpaper.hdr && (
+        <span
+          className="rounded bg-black/70 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide text-amber-300"
+          title={wallpaper.type === 'video' ? t('hdr.video') : t('hdr.scene')}
+        >
+          HDR
+        </span>
+      )}
+      {badges.hrtf && wallpaper.hrtf && (
+        <span
+          className="rounded bg-black/70 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide text-sky-300"
+          title={t('hrtf.badge')}
+        >
+          HRTF
+        </span>
+      )}
+    </>
+  ) : null
+
+  if (previewSize === 'list') {
+    const issue = wallpaper.downloadFailed || hasDamagedFiles(wallpaper)
+    return (
+      <GridCard
+        row
+        data-wallpaper-id={wallpaper.id}
+        selected={selected}
+        isDetailOpen={isDetailOpen}
+        steam={steam}
+        borders={borders}
+        draggable
+        onDragStart={(e) => {
+          e.dataTransfer.setData('text/wallpaper-id', wallpaper.id)
+          e.dataTransfer.setData('text/wallpaper-selected', 'true')
+          e.dataTransfer.effectAllowed = 'copy'
+        }}
+        onClick={onSelect}
+        onContextMenu={onContextMenu}
+      >
+        <div className="w-20 shrink-0">
+          <CardPreview src={previewSrc} alt={wallpaper.title} dimmed={wallpaper.downloading || issue} />
+        </div>
+        <div className="min-w-0 flex-1 px-3 py-1">
+          <h3 className="truncate text-sm font-medium text-gray-200" title={wallpaper.title}>
+            {wallpaper.title}
+          </h3>
+          <div className="flex items-center gap-1 overflow-hidden">
+            {wallpaper.tags.slice(0, 3).map((tag) => (
+              <span key={tag} className="whitespace-nowrap rounded bg-fg/5 px-1.5 text-[11px] text-gray-400">
+                {tagLabel(tag)}
+              </span>
+            ))}
+            {error && <span className="truncate text-[11px] text-red-400">{error}</span>}
+          </div>
+        </div>
+        <div className="flex shrink-0 items-center gap-1.5 pr-3" onClick={(e) => { e.stopPropagation() }}>
+          {wallpaper.downloading && (
+            <span className="flex items-center gap-1 text-xs text-gray-300">
+              <Download size={12} className="animate-bounce text-accent-400" />
+              {downloadPercentage != null ? `${downloadPercentage}%` : t('subscribe.downloading')}
+            </span>
+          )}
+          {backupProgress != null && (
+            <span className="flex items-center gap-1 text-xs text-gray-300">
+              <Archive size={12} className="animate-pulse text-accent-400" />
+              {backupProgress.percentage}%
+            </span>
+          )}
+          {issue && (
+            <button
+              onClick={(e) => void handleRedownload(e)}
+              disabled={isRedownloading}
+              title={wallpaper.downloadFailed ? t('subscribe.downloadFailed') : verifyProblemLabel(wallpaper.verifyProblem!)}
+              className="flex items-center gap-1 rounded bg-accent-600/80 px-2 py-1 text-xs text-white transition-colors hover:bg-accent-600 disabled:cursor-not-allowed disabled:opacity-50"
+            >
+              {isRedownloading ? <Loader2 size={11} className="animate-spin" /> : <RotateCw size={11} />}
+              {wallpaper.downloadFailed ? t('subscribe.redownload') : t('verify.repair')}
+            </button>
+          )}
+          {featureBadges}
+          {backupProgress == null && hasBackup(wallpaper) && <Archive size={12} className="text-accent-300" />}
+          {wallpaper.unavailable && <WifiOff size={12} className="text-amber-400" />}
+          <CompatBadge compat={wallpaper.compat} />
+          {actionButtons}
+          <PlayButton
+            busy={isApplying}
+            ready={!playBlocked}
+            disabled={isApplying || playBlocked}
+            title={t('play.wallpaper')}
+            onClick={() => void handleApply()}
+          />
+        </div>
+      </GridCard>
+    )
+  }
+
   return (
     <GridCard
       data-wallpaper-id={wallpaper.id}
@@ -197,7 +362,7 @@ export default function WallpaperCard({
             <AlertTriangle size={20} className="text-red-400" />
             <span className="text-xs text-gray-300">{t('subscribe.downloadFailed')}</span>
             <button
-              onClick={handleRedownload}
+              onClick={(e) => void handleRedownload(e)}
               disabled={isRedownloading}
               className="flex items-center gap-1 rounded bg-accent-600/80 px-2 py-1 text-xs text-white transition-colors hover:bg-accent-600 disabled:cursor-not-allowed disabled:opacity-50"
             >
@@ -211,7 +376,7 @@ export default function WallpaperCard({
             <AlertTriangle size={20} className="text-amber-400" />
             <span className="text-xs text-gray-300">{verifyProblemLabel(wallpaper.verifyProblem!)}</span>
             <button
-              onClick={handleRedownload}
+              onClick={(e) => void handleRedownload(e)}
               disabled={isRedownloading}
               className="flex items-center gap-1 rounded bg-accent-600/80 px-2 py-1 text-xs text-white transition-colors hover:bg-accent-600 disabled:cursor-not-allowed disabled:opacity-50"
             >
@@ -231,26 +396,7 @@ export default function WallpaperCard({
             <ProgressBar percentage={backupProgress.percentage} className="h-1 w-full max-w-[140px] rounded-full bg-fg/10" />
           </CardOverlay>
         )}
-        {((badges.hdr && wallpaper.hdr) || (badges.hrtf && wallpaper.hrtf)) && (
-          <div className="absolute right-2 top-2 flex gap-1">
-            {badges.hdr && wallpaper.hdr && (
-              <span
-                className="rounded bg-black/70 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide text-amber-300"
-                title={wallpaper.type === 'video' ? t('hdr.video') : t('hdr.scene')}
-              >
-                HDR
-              </span>
-            )}
-            {badges.hrtf && wallpaper.hrtf && (
-              <span
-                className="rounded bg-black/70 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide text-sky-300"
-                title={t('hrtf.badge')}
-              >
-                HRTF
-              </span>
-            )}
-          </div>
-        )}
+        {featureBadges && <div className="absolute right-2 top-2 flex gap-1">{featureBadges}</div>}
         {backupProgress == null && hasBackup(wallpaper) && (
           <CornerBadge className="bottom-2 right-2 bg-black/60 text-accent-300" title={t('backup.badge')}>
             <Archive size={12} />
@@ -270,20 +416,20 @@ export default function WallpaperCard({
         />
       </CardPreview>
 
-      <div className="p-3">
-        <h3 className="truncate text-sm font-medium text-gray-200" title={wallpaper.title}>
+      <div className={tiny ? 'p-2' : 'p-3'}>
+        <h3 className={clsx('truncate font-medium text-gray-200', tiny ? 'text-xs' : 'text-sm')} title={wallpaper.title}>
           {wallpaper.title}
         </h3>
-        {wallpaper.tags.length > 0 && (
+        {!tiny && wallpaper.tags.length > 0 && (
           <div className="mt-1 flex flex-wrap gap-1">
             {wallpaper.tags.slice(0, 3).map((tag) => (
-              <span key={tag} className="rounded bg-fg/5 px-1.5 py-0.5 text-xs text-gray-400">
+              <span key={tag} className="whitespace-nowrap rounded bg-fg/5 px-1.5 py-0.5 text-xs text-gray-400">
                 {tagLabel(tag)}
               </span>
             ))}
           </div>
         )}
-        <div className="mt-2 flex items-center gap-1.5" onClick={(e) => e.stopPropagation()}>
+        <div className={clsx('mt-2 items-center gap-1.5', tiny ? 'hidden' : 'flex')} onClick={(e) => { e.stopPropagation() }}>
           <span className="text-xs text-gray-500">{t('library.fps')}</span>
           <input
             type="number"
@@ -291,76 +437,15 @@ export default function WallpaperCard({
             max={360}
             placeholder={t('library.fpsDefault')}
             value={fpsInput}
-            onChange={(e) => setFpsInput(e.target.value)}
+            onChange={(e) => { setFpsInput(e.target.value) }}
             onBlur={handleFpsBlur}
             onKeyDown={(e) => { if (e.key === 'Enter') { e.currentTarget.blur() } }}
             className="w-16 rounded bg-fg/5 px-1.5 py-0.5 text-xs text-gray-300 outline-none focus:ring-1 focus:ring-accent-500 [appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none"
           />
         </div>
         {error && <p className="mt-1 text-xs text-red-400">{error}</p>}
-        <div className={clsx('mt-2 flex items-center', compact ? 'gap-1' : 'gap-2')}>
-          <LikeAction
-            id={wallpaper.id}
-            isLiked={steam.isLiked}
-            unavailable={wallpaper.unavailable}
-            compact={compact}
-            onError={setError}
-          />
-          <CardAction
-            icon={isInCurrentPlaylist ? Check : Plus}
-            label={isInCurrentPlaylist ? t('playlist.added') : t('playlist.add')}
-            busy={isAddingToPlaylist}
-            compact={compact}
-            tone={isInCurrentPlaylist ? 'active' : 'default'}
-            disabled={!currentPlaylistId || isAddingToPlaylist || isInCurrentPlaylist}
-            title={
-              !currentPlaylistId
-                ? t('playlist.noneActive')
-                : isInCurrentPlaylist
-                  ? t('playlist.alreadyInCurrent')
-                  : t('playlist.addToCurrent')
-            }
-            onClick={handleAddToPlaylist}
-          />
-          {unsubState === 'confirm' ? (
-            <div className="flex items-center gap-1">
-              {!compact && <span className="text-xs text-gray-400">{t('common.sure')}</span>}
-              <button
-                onClick={handleUnsubscribeClick}
-                title={t('subscribe.confirmUnsubscribe')}
-                className={clsx('rounded bg-red-600/80 text-xs text-white hover:bg-red-600', compact ? 'p-1.5' : 'px-2 py-1')}
-              >
-                {compact ? <Check size={11} /> : t('common.yes')}
-              </button>
-              <button
-                onClick={(e) => { e.stopPropagation(); setUnsubState('idle') }}
-                title={t('common.cancel')}
-                className={clsx('rounded bg-fg/5 text-xs text-gray-400 hover:bg-fg/10', compact ? 'p-1.5' : 'px-2 py-1')}
-              >
-                {compact ? <X size={11} /> : t('common.no')}
-              </button>
-            </div>
-          ) : (
-            <CardAction
-              icon={Trash2}
-              label={t('subscribe.unsubShort')}
-              busy={unsubState === 'pending'}
-              compact={compact}
-              tone="danger"
-              disabled={unsubState === 'pending'}
-              title={t('subscribe.unsubscribeHint')}
-              onClick={handleUnsubscribeClick}
-            />
-          )}
-          <SteamAction id={wallpaper.id} compact={compact} />
-          <CardAction
-            icon={FolderOpen}
-            label={t('common.open')}
-            compact={compact}
-            disabled={!wallpaper.localPath}
-            title={wallpaper.localPath ? t('library.openFolder') : t('library.noLocalFiles')}
-            onClick={handleOpenLocally}
-          />
+        <div className={clsx('flex items-center justify-center', tiny ? 'mt-1.5' : 'mt-2', tiny ? 'gap-0.5' : compact ? 'gap-1' : 'gap-2')}>
+          {actionButtons}
         </div>
       </div>
 
@@ -378,7 +463,7 @@ export default function WallpaperCard({
                   ? t('play.installFirst')
                   : t('play.wallpaper')
           }
-          onClick={handleApply}
+          onClick={() => void handleApply()}
         />
       </div>
     </GridCard>

+ 4 - 4
src/renderer/src/components/playlist/PlaylistItemRow.tsx

@@ -48,7 +48,7 @@ export default function PlaylistItemRow({
   return (
     <div
       draggable
-      onDragStart={() => onDragStart(index)}
+      onDragStart={() => { onDragStart(index) }}
       onDragOver={(e) => {
         e.preventDefault()
         onDragOver(index)
@@ -101,7 +101,7 @@ export default function PlaylistItemRow({
           </p>
         </button>
         <button
-          onClick={() => setExpanded((v) => !v)}
+          onClick={() => { setExpanded((v) => !v) }}
           title={t('playlist.overrides')}
           className="rounded p-1.5 text-gray-500 hover:bg-fg/5 hover:text-gray-300"
         >
@@ -126,13 +126,13 @@ export default function PlaylistItemRow({
               min={0}
               max={100}
               value={item.volume ?? defaultVolume}
-              onChange={(e) => onUpdate({ volume: Number(e.target.value) })}
+              onChange={(e) => { onUpdate({ volume: Number(e.target.value) }); }}
               className="w-24 accent-accent-500"
             />
             <span className="w-8 text-gray-300">{item.volume ?? defaultVolume}</span>
             {item.volume !== undefined && (
               <button
-                onClick={() => onUpdate({ volume: undefined })}
+                onClick={() => { onUpdate({ volume: undefined }); }}
                 className="text-gray-600 hover:text-gray-300"
               >
                 {t('common.reset')}

+ 58 - 41
src/renderer/src/components/playlist/PlaylistsView.tsx

@@ -1,5 +1,7 @@
 import { useMemo, useState } from 'react'
 import Toggle from '../common/Toggle'
+import ResizableWidth from '../common/ResizableWidth'
+import { Reorderable, useReorder } from '../common/Reorderable'
 import { useQueryClient } from '@tanstack/react-query'
 import {
   ListVideo,
@@ -57,7 +59,13 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
 
   const [ctxMenu, setCtxMenu] = useState<{ x: number; y: number; wallpaperId: string } | null>(null)
 
-  const playlists = usePlaylists()
+  const savedPlaylists = usePlaylists()
+  const playlistOrder = useReorder('we-playlist-order', savedPlaylists.map((p) => p.id))
+  const playlists = useMemo(
+    () => playlistOrder.sortItems(savedPlaylists, (p) => p.id),
+    // eslint-disable-next-line react-hooks/exhaustive-deps
+    [savedPlaylists, playlistOrder.order]
+  )
   const wallpapers = useAllWallpapers()
   const wallpaperById = useMemo(() => new Map(wallpapers.map((w) => [w.id, w])), [wallpapers])
   const playbackStates = usePlaybackStates()
@@ -72,7 +80,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
   const favoriteCount = activePlaylist?.items.filter((i) => favoriteIds.has(i.wallpaperId)).length ?? 0
 
   function invalidatePlaylists() {
-    queryClient.invalidateQueries({ queryKey: ['playlists'] })
+    void queryClient.invalidateQueries({ queryKey: ['playlists'] })
   }
 
   async function handleCreate() {
@@ -101,7 +109,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
     await window.electronAPI.playlist.delete(id)
     if (activePlaylistId === id) setActivePlaylistId(null)
     invalidatePlaylists()
-    queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
+    void queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
   }
 
   async function updateSettings(patch: Partial<PlaylistSettings>) {
@@ -165,7 +173,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
     setError(null)
     try {
       await window.electronAPI.playlist.start(activePlaylist.id, screen)
-      queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
+      void queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
     } catch (err) {
       setError((err as Error).message)
     }
@@ -176,13 +184,13 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
     const playingIt = thisStates.filter((s) => s.isPlaying && s.currentItemId === wallpaperId)
     if (playingIt.length > 0) {
       for (const s of playingIt) await window.electronAPI.playlist.pause(s.screen)
-      queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
+      void queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
       return
     }
     setError(null)
     try {
       await window.electronAPI.playlist.playItem(activePlaylist.id, wallpaperId, isThisPlaylistActive ? undefined : screen)
-      queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
+      void queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
     } catch (err) {
       setError((err as Error).message)
     }
@@ -191,7 +199,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
   // controls act on every screen this playlist plays on, narrowed down by the screen picker
   async function forEachScreen(action: (screen: ScreenTarget) => Promise<unknown>) {
     for (const s of thisStates) await action(s.screen)
-    queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
+    void queryClient.invalidateQueries({ queryKey: ['playlist-playback-state'] })
   }
 
   const handlePauseResume = () =>
@@ -215,7 +223,8 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
 
   return (
     <div className="flex h-full">
-      <div className="flex w-56 shrink-0 flex-col border-r border-fg/5 overflow-y-auto">
+      <ResizableWidth storageKey="we-playlist-panel-width" defaultWidth={224} min={160} max={400} edge="right">
+      <div className="flex w-full flex-col border-r border-fg/5 overflow-y-auto">
         <div className="flex items-center justify-between px-3 pt-3 pb-1">
           <span className="text-[10px] font-semibold uppercase tracking-wide text-gray-600">
             {t('nav.playlists')}
@@ -238,10 +247,10 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
             <input
               autoFocus
               value={newTitle}
-              onChange={(e) => setNewTitle(e.target.value)}
-              onBlur={handleCreate}
+              onChange={(e) => { setNewTitle(e.target.value) }}
+              onBlur={() => void handleCreate()}
               onKeyDown={(e) => {
-                if (e.key === 'Enter') handleCreate()
+                if (e.key === 'Enter') void handleCreate()
                 if (e.key === 'Escape') setCreating(false)
               }}
               placeholder={t('playlist.namePlaceholder')}
@@ -257,9 +266,15 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
         )}
 
         {playlists.map((p) => (
-          <button
+          <Reorderable
             key={p.id}
-            onClick={() => setActivePlaylistId(p.id)}
+            group="we-playlist-order"
+            id={p.id}
+            onMove={playlistOrder.move}
+            disabled={renamingId === p.id}
+          >
+          <button
+            onClick={() => { setActivePlaylistId(p.id) }}
             className={clsx(
               'group flex items-center gap-2 px-3 py-2 text-sm',
               activePlaylistId === p.id
@@ -278,13 +293,13 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
               <input
                 autoFocus
                 value={renameValue}
-                onChange={(e) => setRenameValue(e.target.value)}
-                onBlur={() => handleRename(p.id)}
+                onChange={(e) => { setRenameValue(e.target.value) }}
+                onBlur={() => void handleRename(p.id)}
                 onKeyDown={(e) => {
-                  if (e.key === 'Enter') handleRename(p.id)
+                  if (e.key === 'Enter') void handleRename(p.id)
                   if (e.key === 'Escape') setRenamingId(null)
                 }}
-                onClick={(e) => e.stopPropagation()}
+                onClick={(e) => { e.stopPropagation() }}
                 className="flex-1 bg-transparent text-sm text-gray-200 outline-none"
               />
             ) : (
@@ -304,15 +319,17 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
             <span
               onClick={(e) => {
                 e.stopPropagation()
-                handleDelete(p.id)
+                void handleDelete(p.id)
               }}
               className="hidden rounded p-0.5 text-gray-600 hover:text-red-400 group-hover:block"
             >
               <Trash2 size={11} />
             </span>
           </button>
+          </Reorderable>
         ))}
       </div>
+      </ResizableWidth>
 
       <div className="flex flex-1 overflow-hidden">
       <div className="flex flex-1 flex-col overflow-hidden">
@@ -332,28 +349,28 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                   {isThisPlaylistActive ? (
                     <>
                       <button
-                        onClick={handlePrevious}
+                        onClick={() => void handlePrevious()}
                         title={t('playlist.previous')}
                         className="rounded-lg bg-fg/5 p-2 text-gray-300 hover:bg-fg/10"
                       >
                         <SkipBack size={14} />
                       </button>
                       <button
-                        onClick={handlePauseResume}
+                        onClick={() => void handlePauseResume()}
                         title={isPlaying ? t('common.pause') : t('common.resume')}
                         className="rounded-lg bg-accent-600 p-2 text-white hover:bg-accent-500"
                       >
                         {isPlaying ? <Pause size={14} /> : <Play size={14} />}
                       </button>
                       <button
-                        onClick={handleNext}
+                        onClick={() => void handleNext()}
                         title={t('common.next')}
                         className="rounded-lg bg-fg/5 p-2 text-gray-300 hover:bg-fg/10"
                       >
                         <SkipForward size={14} />
                       </button>
                       <button
-                        onClick={handleStop}
+                        onClick={() => void handleStop()}
                         title={t('playlist.stop')}
                         className="rounded-lg bg-fg/5 p-2 text-gray-300 hover:bg-red-500/20 hover:text-red-400"
                       >
@@ -362,7 +379,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                     </>
                   ) : (
                     <button
-                      onClick={handlePlay}
+                      onClick={() => void handlePlay()}
                       disabled={activePlaylist.items.length === 0}
                       className="flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50"
                     >
@@ -381,7 +398,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
 
               <div className="mt-3 flex flex-wrap items-center gap-4">
                 <label className="flex items-center gap-2 text-xs text-gray-400">
-                  <Toggle on={activePlaylist.settings.randomize} onClick={() => updateSettings({ randomize: !activePlaylist.settings.randomize })} />
+                  <Toggle on={activePlaylist.settings.randomize} onClick={() => void updateSettings({ randomize: !activePlaylist.settings.randomize })} />
                   <Shuffle size={12} />
                   {t('playlist.randomize')}
                 </label>
@@ -393,7 +410,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                     <select
                       value={activePlaylist.settings.sortBy}
                       onChange={(e) =>
-                        updateSettings({ sortBy: e.target.value as PlaylistSettings['sortBy'] })
+                        void updateSettings({ sortBy: e.target.value as PlaylistSettings['sortBy'] })
                       }
                       className="rounded bg-fg/5 px-2 py-1 text-gray-200 outline-none focus:ring-1 focus:ring-accent-500"
                     >
@@ -413,7 +430,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                     min={1}
                     value={activePlaylist.settings.defaultDurationSec}
                     onChange={(e) =>
-                      updateSettings({ defaultDurationSec: Math.max(1, Number(e.target.value)) })
+                      void updateSettings({ defaultDurationSec: Math.max(1, Number(e.target.value)) })
                     }
                     className="w-20 rounded bg-fg/5 px-2 py-1 text-gray-200 outline-none focus:ring-1 focus:ring-accent-500"
                   />
@@ -424,7 +441,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                   className="flex items-center gap-2 text-xs text-gray-400"
                   title={t('playlist.finishVideosHint')}
                 >
-                  <Toggle on={!!activePlaylist.settings.finishVideos} onClick={() => updateSettings({ finishVideos: !activePlaylist.settings.finishVideos })} />
+                  <Toggle on={!!activePlaylist.settings.finishVideos} onClick={() => void updateSettings({ finishVideos: !activePlaylist.settings.finishVideos })} />
                   <Film size={12} />
                   {t('playlist.finishVideos')}
                 </label>
@@ -433,7 +450,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                   className="flex items-center gap-2 text-xs text-gray-400"
                   title={t('playlist.favoritesOnlyHint')}
                 >
-                  <Toggle on={!!activePlaylist.settings.favoritesOnly} onClick={() => updateSettings({ favoritesOnly: !activePlaylist.settings.favoritesOnly })} />
+                  <Toggle on={!!activePlaylist.settings.favoritesOnly} onClick={() => void updateSettings({ favoritesOnly: !activePlaylist.settings.favoritesOnly })} />
                   <Heart size={12} />
                   {t('playlist.favoritesOnly')}
                   {activePlaylist.settings.favoritesOnly && (
@@ -452,7 +469,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                     min={0}
                     max={100}
                     value={activePlaylist.settings.defaultVolume}
-                    onChange={(e) => updateSettings({ defaultVolume: Number(e.target.value) })}
+                    onChange={(e) => void updateSettings({ defaultVolume: Number(e.target.value) })}
                     className="w-24 accent-accent-500"
                   />
                   <span className="w-8 text-gray-300">{activePlaylist.settings.defaultVolume}</span>
@@ -465,7 +482,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                 {t('playlist.count', { count: activePlaylist.items.length })}
               </span>
               <button
-                onClick={() => setPickerOpen(true)}
+                onClick={() => { setPickerOpen(true) }}
                 className="flex items-center gap-2 rounded-lg bg-fg/5 px-3 py-1.5 text-xs text-gray-300 hover:bg-fg/10"
               >
                 <Plus size={12} />
@@ -489,12 +506,12 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
                   isCurrent={currentItemIds.has(item.wallpaperId)}
                   onDragStart={handleDragStart}
                   onDragOver={handleDragOver}
-                  onDrop={handleDrop}
-                  onPlay={() => handlePlayItem(item.wallpaperId)}
-                  onRemove={() => handleRemoveItem(item.wallpaperId)}
-                  onUpdate={(patch) => handleUpdateItem(item.wallpaperId, patch)}
-                  onContextMenu={(e) => openItemCtxMenu(e, item.wallpaperId)}
-                  onOpenDetail={() => setDetailId(item.wallpaperId)}
+                  onDrop={() => void handleDrop()}
+                  onPlay={() => void handlePlayItem(item.wallpaperId)}
+                  onRemove={() => void handleRemoveItem(item.wallpaperId)}
+                  onUpdate={(patch) => void handleUpdateItem(item.wallpaperId, patch)}
+                  onContextMenu={(e) => { openItemCtxMenu(e, item.wallpaperId) }}
+                  onOpenDetail={() => { setDetailId(item.wallpaperId) }}
                   defaultDurationSec={activePlaylist.settings.defaultDurationSec}
                   defaultVolume={activePlaylist.settings.defaultVolume}
                 />
@@ -508,8 +525,8 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
         <DetailSidebar
           id={detailWallpaper.id}
           {...detailSidebarProps(detailWallpaper)}
-          onClose={() => setDetailId(null)}
-          onSubscribe={() => subscribe(detailWallpaper.id)}
+          onClose={() => { setDetailId(null) }}
+          onSubscribe={() => void subscribe(detailWallpaper.id)}
           onUnsubscribe={() => unsubscribe([detailWallpaper.id])}
           onPlay={(target) => applyWallpaper(detailWallpaper.id, target)}
           onBrowseCreator={onBrowseCreator}
@@ -520,8 +537,8 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
       {pickerOpen && activePlaylist && (
         <WallpaperPickerModal
           excludeIds={existingIds}
-          onAdd={handleAddWallpapers}
-          onClose={() => setPickerOpen(false)}
+          onAdd={(wallpaperIds) => void handleAddWallpapers(wallpaperIds)}
+          onClose={() => { setPickerOpen(false) }}
         />
       )}
 
@@ -531,7 +548,7 @@ export default function PlaylistsView({ onBrowseCreator }: PlaylistsViewProps) {
           y={ctxMenu.y}
           ids={[ctxMenu.wallpaperId]}
           wallpapers={ctxWallpaper ? [ctxWallpaper] : []}
-          onClose={() => setCtxMenu(null)}
+          onClose={() => { setCtxMenu(null) }}
           onBrowseCreator={onBrowseCreator}
         />
       )}

+ 32 - 78
src/renderer/src/components/playlist/WallpaperPickerModal.tsx

@@ -1,8 +1,7 @@
 import { useMemo, useState } from 'react'
 import { useQuery } from '@tanstack/react-query'
-import { Search, X, Plus, Check } from 'lucide-react'
-import { getPreviewSrc } from '../../utils/preview'
-import PreviewImage from '../common/PreviewImage'
+import { Plus } from 'lucide-react'
+import { PickerCard, PickerFrame, PickerGrid, PickerSearch } from '../common/PickerParts'
 import { t } from '../../i18n'
 
 interface WallpaperPickerModalProps {
@@ -50,83 +49,38 @@ export default function WallpaperPickerModal({
   }
 
   return (
-    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-8">
-      <div className="flex h-full max-h-[600px] w-full max-w-2xl flex-col rounded-xl border border-fg/10 bg-popup shadow-2xl">
-        <div className="flex items-center justify-between border-b border-fg/5 px-4 py-3">
-          <h3 className="text-sm font-semibold text-gray-100">{t('picker.title')}</h3>
-          <button
-            onClick={onClose}
-            className="rounded p-1 text-gray-500 hover:bg-fg/5 hover:text-gray-300"
-          >
-            <X size={16} />
-          </button>
-        </div>
-
-        <div className="border-b border-fg/5 px-4 py-2">
-          <div className="relative">
-            <Search size={14} className="absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500" />
-            <input
-              autoFocus
-              type="text"
-              placeholder={t('picker.search')}
-              value={search}
-              onChange={(e) => setSearch(e.target.value)}
-              className="w-full rounded-lg bg-fg/5 py-1.5 pl-8 pr-3 text-sm text-gray-200 placeholder-gray-500 outline-none focus:ring-1 focus:ring-accent-500"
-            />
-          </div>
-        </div>
+    <PickerFrame title={t('picker.title')} onClose={onClose}>
+      <div className="flex border-b border-fg/5 px-4 py-2">
+        <PickerSearch value={search} onChange={setSearch} />
+      </div>
 
-        <div className="flex-1 overflow-y-auto p-3">
-          {isLoading && <p className="p-4 text-center text-xs text-gray-500">{t('common.loading')}</p>}
-          {!isLoading && filtered.length === 0 && (
-            <p className="p-4 text-center text-xs text-gray-500">{t('picker.empty')}</p>
-          )}
-          <div className="grid grid-cols-3 gap-2">
-            {filtered.map((w) => {
-              const isSelected = selected.has(w.id)
-              const previewSrc = getPreviewSrc(w)
-              return (
-                <button
-                  key={w.id}
-                  onClick={() => toggle(w.id)}
-                  data-preview-hover=""
-                  className={`group relative overflow-hidden rounded-xl bg-card text-left transition-all ${
-                    isSelected ? 'ring-2 ring-accent-500' : 'hover:ring-1 hover:ring-accent-500/50'
-                  }`}
-                >
-                  <div className="aspect-video bg-sunken">
-                    {previewSrc ? (
-                      <PreviewImage src={previewSrc} alt={w.title} />
-                    ) : (
-                      <div className="flex h-full items-center justify-center text-xs text-gray-600">
-                        {t('card.noPreview')}
-                      </div>
-                    )}
-                  </div>
-                  <div className="flex items-center justify-between gap-1 p-2">
-                    <span className="truncate text-xs text-gray-300" title={w.title}>
-                      {w.title}
-                    </span>
-                    {isSelected && <Check size={12} className="shrink-0 text-accent-400" />}
-                  </div>
-                </button>
-              )
-            })}
-          </div>
-        </div>
+      <PickerGrid loading={isLoading} empty={filtered.length === 0}>
+        {filtered.map((w) => (
+          <PickerCard
+            key={w.id}
+            wallpaper={w}
+            selected={selected.has(w.id)}
+            onClick={() => { toggle(w.id) }}
+            label={
+              <span className="truncate text-xs text-gray-300" title={w.title}>
+                {w.title}
+              </span>
+            }
+          />
+        ))}
+      </PickerGrid>
 
-        <div className="flex items-center justify-between border-t border-fg/5 px-4 py-3">
-          <span className="text-xs text-gray-500">{t('picker.selected', { count: selected.size })}</span>
-          <button
-            onClick={handleAdd}
-            disabled={selected.size === 0}
-            className="flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50"
-          >
-            <Plus size={14} />
-            {t('picker.add')}
-          </button>
-        </div>
+      <div className="flex items-center justify-between border-t border-fg/5 px-4 py-3">
+        <span className="text-xs text-gray-500">{t('picker.selected', { count: selected.size })}</span>
+        <button
+          onClick={handleAdd}
+          disabled={selected.size === 0}
+          className="flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50"
+        >
+          <Plus size={14} />
+          {t('picker.add')}
+        </button>
       </div>
-    </div>
+    </PickerFrame>
   )
 }

+ 12 - 12
src/renderer/src/components/settings/AppearanceSettings.tsx

@@ -42,7 +42,7 @@ function Segmented<T extends string>({
       {options.map(({ value: option, label, icon: Icon }) => (
         <button
           key={option}
-          onClick={() => onChange(option)}
+          onClick={() => { onChange(option) }}
           className={clsx(
             'flex items-center gap-1.5 rounded-lg px-3 py-1.5 text-sm transition-all',
             value === option ? 'bg-card text-gray-100 shadow-sm ring-1 ring-fg/10' : 'text-gray-400 hover:text-gray-200'
@@ -80,7 +80,7 @@ export default function AppearanceSettings() {
     setDraft(next)
     applyAppearance(next, config!.windowTranslucent)
     await window.electronAPI.config.setAppearance(next)
-    queryClient.invalidateQueries({ queryKey: ['config'] })
+    void queryClient.invalidateQueries({ queryKey: ['config'] })
   }
 
   const isKde = config.desktopEnv === 'kde'
@@ -96,7 +96,7 @@ export default function AppearanceSettings() {
       </div>
 
       <div className="mt-3">
-        <Segmented options={THEMES} value={draft.theme} onChange={(theme) => save({ theme })} />
+        <Segmented options={THEMES} value={draft.theme} onChange={(theme) => void save({ theme })} />
       </div>
 
       <div className="mt-5">
@@ -108,7 +108,7 @@ export default function AppearanceSettings() {
               <button
                 key={p.name}
                 title={translatedOr(`accent.${p.name}`, p.name)}
-                onClick={() => save({ accentHue: p.hue, accentChroma: p.chroma })}
+                onClick={() => void save({ accentHue: p.hue, accentChroma: p.chroma })}
                 className={clsx(
                   'flex h-7 w-7 items-center justify-center rounded-full text-white ring-offset-2 ring-offset-app transition-transform hover:scale-110',
                   active && 'ring-2 ring-fg/60'
@@ -127,9 +127,9 @@ export default function AppearanceSettings() {
             min={0}
             max={360}
             value={draft.accentHue}
-            onChange={(e) => preview({ accentHue: Number(e.target.value), accentChroma: draft.accentChroma || 1 })}
-            onPointerUp={() => save({})}
-            onKeyUp={(e) => isRangeKey(e.key) && save({})}
+            onChange={(e) => { preview({ accentHue: Number(e.target.value), accentChroma: draft.accentChroma || 1 }); }}
+            onPointerUp={() => void save({})}
+            onKeyUp={(e) => void (isRangeKey(e.key) && save({}))}
             className="hue-slider h-2 w-full cursor-pointer appearance-none rounded-full"
             aria-label={t('appearance.accentHue')}
           />
@@ -142,7 +142,7 @@ export default function AppearanceSettings() {
           <Segmented
             options={PREVIEW_ANIMATION}
             value={draft.previewAnimation}
-            onChange={(previewAnimation) => save({ previewAnimation })}
+            onChange={(previewAnimation) => void save({ previewAnimation })}
           />
         </div>
         <p className="mt-1 text-xs text-gray-600">
@@ -160,9 +160,9 @@ export default function AppearanceSettings() {
           min={MIN_WINDOW_OPACITY}
           max={100}
           value={draft.windowOpacity}
-          onChange={(e) => preview({ windowOpacity: Number(e.target.value) })}
-          onPointerUp={() => save({})}
-          onKeyUp={(e) => isRangeKey(e.key) && save({})}
+          onChange={(e) => { preview({ windowOpacity: Number(e.target.value) }); }}
+          onPointerUp={() => void save({})}
+          onKeyUp={(e) => void (isRangeKey(e.key) && save({}))}
           className="mt-2 w-full accent-accent-500"
           aria-label={t('appearance.opacity')}
         />
@@ -174,7 +174,7 @@ export default function AppearanceSettings() {
       <label className={clsx('mt-4 flex items-center gap-3', isKde && translucent ? 'cursor-pointer' : 'cursor-default')}>
         <Toggle
           on={draft.blur && isKde}
-          onClick={() => save({ blur: !draft.blur })}
+          onClick={() => void save({ blur: !draft.blur })}
           disabled={!isKde || !translucent}
         />
         <span className="text-sm text-gray-300">{t('appearance.blur')}</span>

+ 2 - 2
src/renderer/src/components/settings/AutomuteIgnoreSettings.tsx

@@ -17,7 +17,7 @@ export default function AutomuteIgnoreSettings() {
     const next = { ...wallpaper.engineFlags }
     delete next.automute
     await window.electronAPI.library.update(id, { engineFlags: hasEngineFlags(next) ? next : undefined })
-    queryClient.invalidateQueries({ queryKey: ['library'] })
+    void queryClient.invalidateQueries({ queryKey: ['library'] })
   }
 
   return (
@@ -37,7 +37,7 @@ export default function AutomuteIgnoreSettings() {
             <BellOff size={13} className="shrink-0 text-gray-500" />
             <span className="min-w-0 flex-1 truncate text-sm text-gray-200">{w.title}</span>
             <button
-              onClick={() => remove(w.id)}
+              onClick={() => void remove(w.id)}
               title={t('automuteIgnore.remove')}
               className="rounded p-1 text-gray-500 hover:text-red-400"
             >

+ 2 - 2
src/renderer/src/components/settings/CardBadgeSettings.tsx

@@ -18,7 +18,7 @@ export default function CardBadgeSettings() {
     const next: CardBadges = { ...badges, [kind]: !badges[kind] }
     queryClient.setQueryData(['config'], (old: object | undefined) => (old ? { ...old, cardBadges: next } : old))
     await window.electronAPI.config.setCardBadges(next)
-    queryClient.invalidateQueries({ queryKey: ['config'] })
+    void queryClient.invalidateQueries({ queryKey: ['config'] })
   }
 
   return (
@@ -28,7 +28,7 @@ export default function CardBadgeSettings() {
       <div className="mt-3 space-y-3">
         {CARD_BADGE_KINDS.map((kind) => (
           <div key={kind} className="flex items-start gap-3">
-            <Toggle on={badges[kind]} onClick={() => change(kind)} />
+            <Toggle on={badges[kind]} onClick={() => void change(kind)} />
             <div className="min-w-0 flex-1">
               <span
                 className={`rounded bg-black/70 px-1 py-0.5 text-[10px] font-semibold leading-none tracking-wide ${ROWS[kind].className}`}

+ 8 - 7
src/renderer/src/components/settings/CardBorderSettings.tsx

@@ -33,10 +33,11 @@ export default function CardBorderSettings() {
     setDraft(next)
     queryClient.setQueryData(['config'], (old: object | undefined) => (old ? { ...old, cardBorders: next } : old))
     if (saveTimer.current) clearTimeout(saveTimer.current)
-    saveTimer.current = setTimeout(async () => {
-      await window.electronAPI.config.setCardBorders(next)
-      setDraft(null)
-      queryClient.invalidateQueries({ queryKey: ['config'] })
+    saveTimer.current = setTimeout(() => {
+      void window.electronAPI.config.setCardBorders(next).then(() => {
+        setDraft(null)
+        void queryClient.invalidateQueries({ queryKey: ['config'] })
+      }).catch(console.error)
     }, SAVE_DELAY_MS)
   }
 
@@ -54,7 +55,7 @@ export default function CardBorderSettings() {
           const isDefaultColor = border.color === DEFAULT_CARD_BORDERS[kind].color
           return (
             <div key={kind} className="flex items-start gap-3">
-              <Toggle on={border.enabled} onClick={() => change(kind, { enabled: !border.enabled })} />
+              <Toggle on={border.enabled} onClick={() => { change(kind, { enabled: !border.enabled }); }} />
               <div className="min-w-0 flex-1">
                 <span className="flex items-center gap-2 text-sm text-gray-300">
                   <Icon size={14} />
@@ -65,7 +66,7 @@ export default function CardBorderSettings() {
               <div className="flex items-center gap-1.5">
                 {!isDefaultColor && (
                   <button
-                    onClick={() => change(kind, { color: DEFAULT_CARD_BORDERS[kind].color })}
+                    onClick={() => { change(kind, { color: DEFAULT_CARD_BORDERS[kind].color }); }}
                     title={t('borders.resetColor')}
                     className="rounded p-1 text-gray-500 hover:bg-fg/10 hover:text-gray-300"
                   >
@@ -80,7 +81,7 @@ export default function CardBorderSettings() {
                   <input
                     type="color"
                     value={border.color}
-                    onChange={(e) => change(kind, { color: e.target.value })}
+                    onChange={(e) => { change(kind, { color: e.target.value }); }}
                     className="absolute inset-0 cursor-pointer opacity-0"
                     aria-label={t('borders.color', { kind: label })}
                   />

+ 27 - 25
src/renderer/src/components/settings/DiagnosticsSettings.tsx

@@ -1,5 +1,6 @@
 import { useState } from 'react'
 import { Loader2, FileText, Undo2 } from 'lucide-react'
+import SettingsCard from './SettingsCard'
 import DiagnosticsTargetModal, { type DiagnosticsChoice } from './DiagnosticsTargetModal'
 import { t } from '../../i18n'
 
@@ -7,6 +8,7 @@ export default function DiagnosticsSettings() {
   const [busy, setBusy] = useState(false)
   const [picking, setPicking] = useState(false)
   const [message, setMessage] = useState<{ text: string; error: boolean } | null>(null)
+  const [resetMessage, setResetMessage] = useState<string | null>(null)
 
   async function collect(choice: DiagnosticsChoice | null) {
     setPicking(false)
@@ -25,34 +27,34 @@ export default function DiagnosticsSettings() {
 
   async function resetCrashes() {
     await window.electronAPI.diagnostics.resetCrashes()
-    setMessage({ text: t('diagnostics.resetDone'), error: false })
+    setResetMessage(t('diagnostics.resetDone'))
   }
 
   return (
-    <div>
-      <label className="block text-xs font-medium uppercase tracking-wide text-gray-500">
-        {t('diagnostics.title')}
-      </label>
-      <p className="mt-1 text-xs text-gray-600">{t('diagnostics.hint', { seconds: 20 })}</p>
+    <>
+      <SettingsCard title={t('diagnostics.title')} hint={t('diagnostics.hint', { seconds: 20 })}>
+        <button
+          onClick={() => { setPicking(true) }}
+          disabled={busy}
+          className="flex items-center gap-2 rounded-lg bg-accent-500/15 px-4 py-2 text-sm text-accent-300 hover:bg-accent-500/25 disabled:opacity-50"
+        >
+          {busy ? <Loader2 size={14} className="animate-spin" /> : <FileText size={14} />}
+          {busy ? t('diagnostics.collecting') : t('diagnostics.collect')}
+        </button>
+        {message && <p className={`text-xs ${message.error ? 'text-red-400' : 'text-gray-400'}`}>{message.text}</p>}
+      </SettingsCard>
 
-      <button
-        onClick={() => setPicking(true)}
-        disabled={busy}
-        className="mt-3 flex items-center gap-2 rounded-lg bg-fg/5 px-4 py-2 text-sm text-gray-300 hover:bg-fg/10 disabled:opacity-50"
-      >
-        {busy ? <Loader2 size={14} className="animate-spin" /> : <FileText size={14} />}
-        {busy ? t('diagnostics.collecting') : t('diagnostics.collect')}
-      </button>
-      <p className="mt-4 text-xs text-gray-600">{t('diagnostics.resetCrashesHint')}</p>
-      <button
-        onClick={resetCrashes}
-        className="mt-3 flex items-center gap-2 rounded-lg bg-fg/5 px-4 py-2 text-sm text-gray-300 hover:bg-fg/10"
-      >
-        <Undo2 size={14} />
-        {t('diagnostics.resetCrashes')}
-      </button>
-      {picking && <DiagnosticsTargetModal seconds={20} onCollect={collect} onClose={() => setPicking(false)} />}
-      {message && <p className={`mt-2 text-xs ${message.error ? 'text-red-400' : 'text-gray-400'}`}>{message.text}</p>}
-    </div>
+      <SettingsCard title={t('diagnostics.resetCrashes')} hint={t('diagnostics.resetCrashesHint')}>
+        <button
+          onClick={() => void resetCrashes()}
+          className="flex items-center gap-2 rounded-lg bg-fg/5 px-4 py-2 text-sm text-gray-300 hover:bg-fg/10"
+        >
+          <Undo2 size={14} />
+          {t('diagnostics.resetCrashes')}
+        </button>
+        {resetMessage && <p className="text-xs text-gray-400">{resetMessage}</p>}
+      </SettingsCard>
+      {picking && <DiagnosticsTargetModal seconds={20} onCollect={(choice) => void collect(choice)} onClose={() => { setPicking(false) }} />}
+    </>
   )
 }

+ 53 - 97
src/renderer/src/components/settings/DiagnosticsTargetModal.tsx

@@ -1,12 +1,11 @@
 import { useMemo, useState } from 'react'
 import { useQuery } from '@tanstack/react-query'
-import { Search, X, Play, Check } from 'lucide-react'
+import { Play } from 'lucide-react'
 import { compatStatus } from '@shared/compat'
 import type { ScreenTarget } from '@shared/types'
-import { getPreviewSrc } from '../../utils/preview'
 import { screenLabel } from '../../utils/screens'
 import { useDisplayTargets } from '../../hooks/useDisplayTargets'
-import PreviewImage from '../common/PreviewImage'
+import { PickerCard, PickerFrame, PickerGrid, PickerSearch } from '../common/PickerParts'
 import { CompatStatusIcon } from '../common/CompatBadge'
 import { t } from '../../i18n'
 
@@ -42,103 +41,60 @@ export default function DiagnosticsTargetModal({ seconds, onCollect, onClose }:
   const chosenScreen = screen && targets.includes(screen) ? screen : targets[0]
 
   return (
-    <div className="fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-8">
-      <div className="flex h-full max-h-[600px] w-full max-w-2xl flex-col rounded-xl border border-fg/10 bg-popup shadow-2xl">
-        <div className="flex items-center justify-between border-b border-fg/5 px-4 py-3">
-          <h3 className="text-sm font-semibold text-gray-100">{t('diagnostics.pickTitle')}</h3>
-          <button onClick={onClose} className="rounded p-1 text-gray-500 hover:bg-fg/5 hover:text-gray-300">
-            <X size={16} />
-          </button>
-        </div>
+    <PickerFrame title={t('diagnostics.pickTitle')} onClose={onClose}>
+      <p className="px-4 pt-3 text-xs text-gray-500">{t('diagnostics.pickHint', { seconds })}</p>
 
-        <p className="px-4 pt-3 text-xs text-gray-500">{t('diagnostics.pickHint', { seconds })}</p>
-
-        <div className="flex items-center gap-2 px-4 py-2">
-          <div className="relative flex-1">
-            <Search size={14} className="absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-500" />
-            <input
-              autoFocus
-              type="text"
-              placeholder={t('picker.search')}
-              value={search}
-              onChange={(e) => setSearch(e.target.value)}
-              className="w-full rounded-lg bg-fg/5 py-1.5 pl-8 pr-3 text-sm text-gray-200 placeholder-gray-500 outline-none focus:ring-1 focus:ring-accent-500"
-            />
-          </div>
-          {perScreen && (
-            <select
-              value={chosenScreen}
-              onChange={(e) => setScreen(e.target.value)}
-              title={t('common.screen')}
-              className="rounded-lg bg-fg/5 px-2 py-1.5 text-sm text-gray-200 outline-none"
-            >
-              {targets.map((target) => (
-                <option key={target} value={target}>
-                  {screenLabel(target)}
-                </option>
-              ))}
-            </select>
-          )}
-        </div>
+      <div className="flex items-center gap-2 px-4 py-2">
+        <PickerSearch value={search} onChange={setSearch} />
+        {perScreen && (
+          <select
+            value={chosenScreen}
+            onChange={(e) => { setScreen(e.target.value) }}
+            title={t('common.screen')}
+            className="rounded-lg bg-fg/5 px-2 py-1.5 text-sm text-gray-200 outline-none"
+          >
+            {targets.map((target) => (
+              <option key={target} value={target}>
+                {screenLabel(target)}
+              </option>
+            ))}
+          </select>
+        )}
+      </div>
 
-        <div className="flex-1 overflow-y-auto p-3">
-          {isLoading && <p className="p-4 text-center text-xs text-gray-500">{t('common.loading')}</p>}
-          {!isLoading && filtered.length === 0 && (
-            <p className="p-4 text-center text-xs text-gray-500">{t('picker.empty')}</p>
-          )}
-          <div className="grid grid-cols-3 gap-2">
-            {filtered.map((w) => {
-              const isSelected = selected === w.id
-              const previewSrc = getPreviewSrc(w)
-              const status = compatStatus(w.compat)
-              return (
-                <button
-                  key={w.id}
-                  onClick={() => setSelected(isSelected ? null : w.id)}
-                  data-preview-hover=""
-                  className={`group relative overflow-hidden rounded-xl bg-card text-left transition-all ${
-                    isSelected ? 'ring-2 ring-accent-500' : 'hover:ring-1 hover:ring-accent-500/50'
-                  }`}
-                >
-                  <div className="aspect-video bg-sunken">
-                    {previewSrc ? (
-                      <PreviewImage src={previewSrc} alt={w.title} />
-                    ) : (
-                      <div className="flex h-full items-center justify-center text-xs text-gray-600">
-                        {t('card.noPreview')}
-                      </div>
-                    )}
-                  </div>
-                  <div className="flex items-center justify-between gap-1 p-2">
-                    <span className="flex min-w-0 items-center gap-1 text-xs text-gray-300" title={w.title}>
-                      <CompatStatusIcon status={status} />
-                      <span className="truncate">{w.title}</span>
-                    </span>
-                    {isSelected && <Check size={12} className="shrink-0 text-accent-400" />}
-                  </div>
-                </button>
-              )
-            })}
-          </div>
-        </div>
+      <PickerGrid loading={isLoading} empty={filtered.length === 0}>
+        {filtered.map((w) => (
+          <PickerCard
+            key={w.id}
+            wallpaper={w}
+            selected={selected === w.id}
+            onClick={() => { setSelected(selected === w.id ? null : w.id) }}
+            label={
+              <span className="flex min-w-0 items-center gap-1 text-xs text-gray-300" title={w.title}>
+                <CompatStatusIcon status={compatStatus(w.compat)} />
+                <span className="truncate">{w.title}</span>
+              </span>
+            }
+          />
+        ))}
+      </PickerGrid>
 
-        <div className="flex items-center justify-between gap-2 border-t border-fg/5 px-4 py-3">
-          <button
-            onClick={() => onCollect(null)}
-            className="rounded-lg bg-fg/5 px-3 py-2 text-xs text-gray-300 hover:bg-fg/10"
-          >
-            {t('diagnostics.pickCurrent')}
-          </button>
-          <button
-            onClick={() => selected && onCollect({ wallpaperId: selected, screen: chosenScreen })}
-            disabled={!selected}
-            className="flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50"
-          >
-            <Play size={14} />
-            {t('diagnostics.pickCollect')}
-          </button>
-        </div>
+      <div className="flex items-center justify-between gap-2 border-t border-fg/5 px-4 py-3">
+        <button
+          onClick={() => { onCollect(null) }}
+          className="rounded-lg bg-fg/5 px-3 py-2 text-xs text-gray-300 hover:bg-fg/10"
+        >
+          {t('diagnostics.pickCurrent')}
+        </button>
+        <button
+          onClick={() => { if (selected) onCollect({ wallpaperId: selected, screen: chosenScreen }) }}
+          disabled={!selected}
+          className="flex items-center gap-2 rounded-lg bg-accent-600 px-4 py-2 text-sm font-medium text-white hover:bg-accent-500 disabled:opacity-50"
+        >
+          <Play size={14} />
+          {t('diagnostics.pickCollect')}
+        </button>
       </div>
-    </div>
+    </PickerFrame>
   )
 }

+ 4 - 4
src/renderer/src/components/settings/DisplaySettings.tsx

@@ -25,7 +25,7 @@ export default function DisplaySettings({ screens }: { screens: string[] }) {
   async function toggleScreen(screen: string) {
     const next = disabled.includes(screen) ? disabled.filter((s) => s !== screen) : [...disabled, screen]
     await window.electronAPI.config.setDisabledScreens(next)
-    for (const key of ['config', 'display-targets']) queryClient.invalidateQueries({ queryKey: [key] })
+    for (const key of ['config', 'display-targets']) void queryClient.invalidateQueries({ queryKey: [key] })
   }
 
   async function switchTo(mode: DisplayMode) {
@@ -34,7 +34,7 @@ export default function DisplaySettings({ screens }: { screens: string[] }) {
     try {
       await window.electronAPI.config.setDisplayMode(mode)
       for (const key of ['config', 'display-targets', 'screen-assignments', 'playlist-playback-state']) {
-        queryClient.invalidateQueries({ queryKey: [key] })
+        void queryClient.invalidateQueries({ queryKey: [key] })
       }
     } finally {
       setSwitching(false)
@@ -51,7 +51,7 @@ export default function DisplaySettings({ screens }: { screens: string[] }) {
         {MODES.map(({ mode, label, icon: Icon }) => (
           <button
             key={mode}
-            onClick={() => switchTo(mode)}
+            onClick={() => void switchTo(mode)}
             disabled={switching}
             className={`flex items-center gap-2 px-3 py-2 transition-colors ${
               current === mode ? 'bg-accent-600 text-white' : 'bg-fg/5 text-gray-400 hover:text-gray-200'
@@ -71,7 +71,7 @@ export default function DisplaySettings({ screens }: { screens: string[] }) {
               const on = !disabled.includes(screen) && !isMirror
               return (
                 <label key={screen} className={`flex items-center gap-2 text-sm ${isMirror ? 'text-gray-600' : 'cursor-pointer text-gray-300'}`}>
-                  <input type="checkbox" checked={on} disabled={isMirror} onChange={() => toggleScreen(screen)} />
+                  <input type="checkbox" checked={on} disabled={isMirror} onChange={() => void toggleScreen(screen)} />
                   {screen}
                   {isMirror && <span className="text-xs text-gray-500">{t('display.mirrored')}</span>}
                 </label>

部分文件因为文件数量过多而无法显示