Переглянути джерело

do not try to open wallpaper if linux-wallpaperengine is not installed

UwU 2 місяців тому
батько
коміт
5123c180a0
2 змінених файлів з 5 додано та 2 видалено
  1. 2 2
      src/main/index.ts
  2. 3 0
      src/main/services/playlist-player.service.ts

+ 2 - 2
src/main/index.ts

@@ -9,7 +9,7 @@ import { initDesktopIcons, cleanupDesktopIcons } from './services/desktop-icons.
 import { getTrayEnabled, getAutostartPlaylistId, getKillLweOnQuit } from './services/config.service'
 import { createTray } from './services/tray.service'
 import { initPlaylistPlayer, startPlaylist } from './services/playlist-player.service'
-import { killAllLweProcesses } from './services/lwe.service'
+import { killAllLweProcesses, getLweStatus } from './services/lwe.service'
 
 const startMinimized = process.argv.includes('--minimized')
 let isQuitting = false
@@ -78,7 +78,7 @@ app.whenReady().then(() => {
   if (getTrayEnabled()) createTray(win)
 
   const autostartPlaylistId = getAutostartPlaylistId()
-  if (!resumed && autostartPlaylistId) {
+  if (!resumed && autostartPlaylistId && getLweStatus().installed) {
     try {
       startPlaylist(autostartPlaylistId)
     } catch (err) {

+ 3 - 0
src/main/services/playlist-player.service.ts

@@ -6,6 +6,7 @@ import { getPlaylist } from './playlist.service'
 import { getWallpaper, updateWallpaper } from './library.service'
 import { applyWallpaperMeta } from './wallpaper.service'
 import { setActiveWallpaperId } from './wallpaper-state.service'
+import { getLweStatus } from './lwe.service'
 
 interface PlaybackStore {
   activePlaylistId: string | null
@@ -265,6 +266,7 @@ export function getPlaybackState(): PlaylistPlaybackState {
  * Call once on app startup. Resumes whichever playlist was active when the app last
  * closed. Returns true if a playlist was resumed, so the caller can skip the
  * "autostart playlist" config setting to avoid starting two playlists at once.
+ * Does nothing if linux-wallpaperengine isn't installed.
  */
 export function initPlaylistPlayer(window: BrowserWindow): boolean {
   win = window
@@ -272,6 +274,7 @@ export function initPlaylistPlayer(window: BrowserWindow): boolean {
   if (!activeId) return false
   const playlist = getPlaylist(activeId)
   if (!playlist || playlist.items.length === 0) return false
+  if (!getLweStatus().installed) return false
 
   const wasPlaying = store.get('isPlaying')
   startPlaylist(activeId)