Quellcode durchsuchen

added support for new linux-wallpapaperengine-kde

UwU vor 1 Monat
Ursprung
Commit
346c04e230

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "we-manager",
-  "version": "0.7.7",
+  "version": "0.7.8",
   "type": "module",
   "description": "Wallpaper Engine workshop manager",
   "author": "UwU <260361707+WallpaperEngineLover@users.noreply.github.com>",

+ 22 - 1
src/renderer/src/components/settings/PerformanceSettings.tsx

@@ -1,5 +1,5 @@
 import { useState } from 'react'
-import { useQueryClient } from '@tanstack/react-query'
+import { useQuery, useQueryClient } from '@tanstack/react-query'
 import { Check, Plus, Save, Trash2 } from 'lucide-react'
 import type { EngineFlagPreset, EngineFlags, FullscreenPauseMode } from '@shared/types'
 import { BOOLEAN_FLAGS, CHOICE_FLAGS, FULLSCREEN_PAUSE_OPTIONS } from '../../constants/engineFlags'
@@ -46,6 +46,10 @@ export default function PerformanceSettings({ defaultFps, onDefaultFpsChanged }:
   const config = useConfig()
   const flags: EngineFlags = config?.engineFlags ?? {}
   const presets = config?.engineFlagPresets ?? []
+  const { data: environment } = useQuery({
+    queryKey: ['environment'],
+    queryFn: () => window.electronAPI.wallpaper.detectEnvironment()
+  })
   const [newName, setNewName] = useState('')
   const [appliedId, setAppliedId] = useState<string | null>(null)
 
@@ -100,6 +104,23 @@ export default function PerformanceSettings({ defaultFps, onDefaultFpsChanged }:
             <span className="text-sm text-gray-300">{label}</span>
           </label>
         ))}
+        {environment?.desktopEnv === 'kde' && (
+          <div>
+            <label className="flex cursor-pointer items-center gap-3">
+              <Toggle
+                on={!!flags.kdeBackgroundLayer}
+                onClick={() => saveFlags({ ...flags, kdeBackgroundLayer: !flags.kdeBackgroundLayer })}
+              />
+              <span className="text-sm text-gray-300">Use the KDE background layer</span>
+            </label>
+            <p className="ml-12 mt-1 text-xs text-gray-600">
+              Older versions always did this on KDE. It puts the wallpaper in the same layer as Plasma's own
+              desktop, and whichever of the two shows up last is drawn on top. At login Plasma's desktop often
+              starts after the wallpaper and hides it, so leave this off unless the default layer causes problems
+              for you, e.g. with "keep below others" windows.
+            </p>
+          </div>
+        )}
         <label className="flex items-center gap-3 text-sm text-gray-300">
           <span>Fullscreen apps</span>
           <select

+ 27 - 2
src/renderer/src/constants/engineFlags.ts

@@ -1,7 +1,8 @@
 import type { EngineFlags, FullscreenPauseMode } from '@shared/types'
 
-type ChoiceFlag = 'postProcessing' | 'volumetrics' | 'shadows'
-type BooleanFlag = Exclude<keyof EngineFlags, 'fullscreenPause' | ChoiceFlag>
+type ChoiceFlag = 'postProcessing' | 'volumetrics' | 'shadows' | 'msaa' | 'ssaa'
+// kdeBackgroundLayer is a global desktop setting with its own toggle, wallpapers don't override it
+type BooleanFlag = Exclude<keyof EngineFlags, 'fullscreenPause' | 'kdeBackgroundLayer' | ChoiceFlag>
 
 export const BOOLEAN_FLAGS: { key: BooleanFlag; label: string; hint: string }[] = [
   { key: 'disableParticles', label: 'Disable particles', hint: 'Skips particle systems (fog, sparks, rain), usually the biggest GPU cost' },
@@ -62,5 +63,29 @@ export const CHOICE_FLAGS: {
     hint: 'Shadow quality; for now it only changes how finely shadow casting lights sample their volumetrics',
     fallback: 'medium',
     options: LIGHTING_QUALITY
+  },
+  {
+    key: 'msaa',
+    label: 'Anti-aliasing (MSAA)',
+    hint: 'Smooths the edges of 3D models; like Wallpaper Engine it only applies to scenes that contain a model',
+    fallback: 'none',
+    options: [
+      { value: 'none', label: 'Off' },
+      { value: 'x2', label: '2x' },
+      { value: 'x4', label: '4x' },
+      { value: 'x8', label: '8x' }
+    ]
+  },
+  {
+    key: 'ssaa',
+    label: 'Supersampling (SSAA)',
+    hint: 'Renders scenes at 2-4x the screen resolution per axis and scales them down: smoother edges and finer detail everywhere, but the GPU cost grows with the square (4x = 16 times the pixels)',
+    fallback: 'none',
+    options: [
+      { value: 'none', label: 'Off' },
+      { value: 'x2', label: '2x' },
+      { value: 'x3', label: '3x' },
+      { value: 'x4', label: '4x' }
+    ]
   }
 ]

+ 6 - 0
src/shared/engineFlags.test.ts

@@ -28,6 +28,12 @@ describe('engineFlagArgs', () => {
       'disabled'
     ])
     expect(engineFlagArgs({ postProcessing: 'enabled', volumetrics: 'medium', shadows: 'medium' })).toEqual([])
+    expect(engineFlagArgs({ msaa: 'x4' })).toEqual(['--msaa', 'x4'])
+    expect(engineFlagArgs({ msaa: 'none' })).toEqual([])
+    expect(engineFlagArgs({ ssaa: 'x2' })).toEqual(['--ssaa', 'x2'])
+    expect(engineFlagArgs({ ssaa: 'none' })).toEqual([])
+    expect(engineFlagArgs({ kdeBackgroundLayer: true })).toEqual(['--layer', 'background'])
+    expect(engineFlagArgs({ kdeBackgroundLayer: false })).toEqual([])
   })
 
   it('leaves disableAnimations to the caller, it needs its own capability probe', () => {

+ 5 - 1
src/shared/engineFlags.ts

@@ -31,7 +31,8 @@ export const BUILT_IN_PRESETS: EngineFlagPreset[] = [
       silent: false,
       postProcessing: 'ultra',
       volumetrics: 'ultra',
-      shadows: 'ultra'
+      shadows: 'ultra',
+      msaa: 'x8'
     }
   },
   {
@@ -64,6 +65,9 @@ export function engineFlagArgs(flags: EngineFlags): string[] {
   if (flags.postProcessing && flags.postProcessing !== 'enabled') args.push('--post-processing', flags.postProcessing)
   if (flags.volumetrics && flags.volumetrics !== 'medium') args.push('--volumetrics', flags.volumetrics)
   if (flags.shadows && flags.shadows !== 'medium') args.push('--shadows', flags.shadows)
+  if (flags.msaa && flags.msaa !== 'none') args.push('--msaa', flags.msaa)
+  if (flags.ssaa && flags.ssaa !== 'none') args.push('--ssaa', flags.ssaa)
+  if (flags.kdeBackgroundLayer) args.push('--layer', 'background')
   return args
 }
 

+ 10 - 0
src/shared/types.ts

@@ -145,6 +145,12 @@ export type PostProcessingQuality = 'enabled' | 'ultra'
 /** Wallpaper Engine's volumetrics/shadow quality settings */
 export type LightingQuality = 'disabled' | 'low' | 'medium' | 'high' | 'ultra'
 
+/** Wallpaper Engine's anti-aliasing setting, only scenes with 3D models use it */
+export type MsaaQuality = 'none' | 'x2' | 'x4' | 'x8'
+
+/** Scene supersampling factor per axis, linux-wallpaperengine only */
+export type SsaaQuality = 'none' | 'x2' | 'x3' | 'x4'
+
 /** linux-wallpaperengine flags that only take effect on a fresh launch */
 export interface EngineFlags {
   disableParticles?: boolean
@@ -158,6 +164,10 @@ export interface EngineFlags {
   postProcessing?: PostProcessingQuality
   volumetrics?: LightingQuality
   shadows?: LightingQuality
+  msaa?: MsaaQuality
+  ssaa?: SsaaQuality
+  /** KDE only: --layer background, plasmashell's desktop window can cover the wallpaper there */
+  kdeBackgroundLayer?: boolean
 }
 
 export interface EngineFlagPreset {