Răsfoiți Sursa

Warn when wallpapers are drawn on the CPU, and install the NVIDIA Flatpak GL extension from the notice

UwU 1 lună în urmă
părinte
comite
1a146aeb3d

+ 1 - 1
package.json

@@ -1,6 +1,6 @@
 {
   "name": "we-manager",
-  "version": "0.9.4",
+  "version": "0.9.5",
   "type": "module",
   "description": "Wallpaper Engine workshop manager",
   "desktopName": "we-manager.desktop",

+ 4 - 0
src/main/ipc/diagnostics.handlers.ts

@@ -5,10 +5,14 @@ import * as path from 'path'
 import { IpcChannels } from '@shared/ipc-channels'
 import { t } from '../i18n'
 import { NoEngineRunningError, collectDiagnostics } from '../services/diagnostics.service'
+import { getGraphicsWarning, installNvidiaExtension } from '../services/graphics.service'
 
 let running = false
 
 export function registerDiagnosticsHandlers(win: BrowserWindow): void {
+  ipcMain.handle(IpcChannels.GRAPHICS_WARNING, () => getGraphicsWarning())
+  ipcMain.handle(IpcChannels.GRAPHICS_INSTALL_NVIDIA, () => installNvidiaExtension())
+
   ipcMain.handle(IpcChannels.DIAGNOSTICS_COLLECT, async () => {
     if (running) throw new Error('Already collecting')
     running = true

+ 113 - 0
src/main/services/graphics.service.test.ts

@@ -0,0 +1,113 @@
+import * as os from 'os'
+import { beforeEach, describe, expect, it, vi } from 'vitest'
+
+const state = vi.hoisted(() => ({ renderer: undefined as string | undefined, flatpak: false, files: new Map<string, string | string[]>() }))
+
+vi.mock('./lwe.service', () => ({ getEngineRenderer: () => state.renderer }))
+vi.mock('../utils/flatpak', () => ({ isFlatpak: () => state.flatpak, hostAppPath: () => undefined, hostCommand: (cmd: string, args: string[]) => [cmd, args] }))
+vi.mock('fs', async (importOriginal) => {
+  const real = await importOriginal<typeof import('fs')>()
+  const patched = {
+    ...real,
+    existsSync: (p: string) => state.files.has(p),
+    readdirSync: (p: string) => {
+      const entry = state.files.get(p)
+      if (!Array.isArray(entry)) throw new Error('ENOENT')
+      return entry
+    },
+    readFileSync: (p: string) => {
+      const entry = state.files.get(p)
+      if (typeof entry !== 'string') throw new Error('ENOENT')
+      return entry
+    }
+  }
+  return { ...patched, default: patched }
+})
+
+import { appInstallation, getGraphicsWarning, nvidiaExtensionName, parseNvidiaDriverVersion } from './graphics.service'
+
+const VERSION_LINE = 'NVRM version: NVIDIA UNIX x86_64 Kernel Module  615.78.08  Tue Oct 20 2026'
+
+describe('parseNvidiaDriverVersion', () => {
+  it('reads the closed module line', () => {
+    expect(parseNvidiaDriverVersion(`${VERSION_LINE}\nGCC version: gcc 15`)).toBe('615.78.08')
+  })
+
+  it('reads the open module line', () => {
+    const text = 'NVRM version: NVIDIA UNIX Open Kernel Module for x86_64  580.95.05  Release Build'
+    expect(parseNvidiaDriverVersion(text)).toBe('580.95.05')
+  })
+
+  it('finds nothing in an unrelated line', () => {
+    expect(parseNvidiaDriverVersion('no driver')).toBeUndefined()
+  })
+})
+
+describe('appInstallation', () => {
+  it('follows where the app lives', () => {
+    expect(appInstallation(`${os.homedir()}/.local/share/flatpak/app/io.github.x/x86_64/master/abc/files`)).toBe('--user')
+    expect(appInstallation('/var/lib/flatpak/app/io.github.x/x86_64/master/abc/files')).toBe('--system')
+    expect(appInstallation(undefined)).toBe('--system')
+  })
+})
+
+describe('nvidiaExtensionName', () => {
+  it('turns the dots into dashes', () => {
+    expect(nvidiaExtensionName('615.78.08')).toBe('org.freedesktop.Platform.GL.nvidia-615-78-08')
+  })
+})
+
+function nvidiaSandbox(withGl: boolean): void {
+  state.flatpak = true
+  state.files.set('/dev/nvidiactl', '')
+  state.files.set('/usr/share/glvnd/egl_vendor.d', withGl ? ['10_nvidia.json', '50_mesa.json'] : ['50_mesa.json'])
+  state.files.set('/usr/lib/x86_64-linux-gnu/GL', withGl ? ['default', 'nvidia-615-78-08'] : ['default'])
+}
+
+describe('getGraphicsWarning', () => {
+  beforeEach(() => {
+    state.renderer = undefined
+    state.flatpak = false
+    state.files = new Map()
+  })
+
+  it('says nothing on a plain system', () => {
+    expect(getGraphicsWarning()).toBeNull()
+  })
+
+  it('warns about a Flatpak with an NVIDIA device and no NVIDIA GL', () => {
+    nvidiaSandbox(false)
+    expect(getGraphicsWarning()).toEqual({ kind: 'flatpak-nvidia' })
+  })
+
+  it('names the extension when the driver version is readable', () => {
+    nvidiaSandbox(false)
+    state.files.set('/proc/driver/nvidia/version', VERSION_LINE)
+    expect(getGraphicsWarning()).toEqual({
+      kind: 'flatpak-nvidia',
+      extension: 'org.freedesktop.Platform.GL.nvidia-615-78-08'
+    })
+  })
+
+  it('stays quiet when the sandbox has the NVIDIA GL', () => {
+    nvidiaSandbox(true)
+    expect(getGraphicsWarning()).toBeNull()
+  })
+
+  it('lets a real GPU renderer override the Flatpak check', () => {
+    nvidiaSandbox(false)
+    state.renderer = 'NVIDIA GeForce RTX 4070 Ti SUPER/PCIe/SSE2'
+    expect(getGraphicsWarning()).toBeNull()
+  })
+
+  it('warns about a software renderer anywhere', () => {
+    state.renderer = 'llvmpipe (LLVM 20.1.8, 256 bits)'
+    expect(getGraphicsWarning()).toEqual({ kind: 'software', renderer: 'llvmpipe (LLVM 20.1.8, 256 bits)' })
+  })
+
+  it('blames the missing extension when a software renderer meets the NVIDIA Flatpak case', () => {
+    nvidiaSandbox(false)
+    state.renderer = 'llvmpipe (LLVM 20.1.8, 256 bits)'
+    expect(getGraphicsWarning()).toEqual({ kind: 'flatpak-nvidia', renderer: 'llvmpipe (LLVM 20.1.8, 256 bits)' })
+  })
+})

+ 106 - 0
src/main/services/graphics.service.ts

@@ -0,0 +1,106 @@
+import { execFile } from 'child_process'
+import { promisify } from 'util'
+import * as fs from 'fs'
+import * as os from 'os'
+import type { GraphicsWarning } from '@shared/types'
+import { getEngineRenderer } from './lwe.service'
+import { hostAppPath, hostCommand, isFlatpak } from '../utils/flatpak'
+
+const execFileAsync = promisify(execFile)
+
+const SOFTWARE_RENDERER = /llvmpipe|softpipe|swrast/i
+const GLVND_DIR = '/usr/share/glvnd/egl_vendor.d'
+const FLATPAK_GL_DIR = '/usr/lib/x86_64-linux-gnu/GL'
+const NVIDIA_VERSION_FILE = process.env['WEM_NVIDIA_VERSION_FILE'] || '/proc/driver/nvidia/version'
+const EXTENSION_PREFIX = 'org.freedesktop.Platform.GL.nvidia-'
+const INSTALL_TIMEOUT_MS = 10 * 60_000
+
+function listDir(dir: string): string[] {
+  try {
+    return fs.readdirSync(dir)
+  } catch {
+    return []
+  }
+}
+
+function hasNvidiaDevice(): boolean {
+  return fs.existsSync('/dev/nvidiactl')
+}
+
+/** The sandbox only gets NVIDIA's EGL from the Flatpak GL extension that matches the host driver */
+function sandboxHasNvidiaGl(): boolean {
+  const vendorDirs = [GLVND_DIR, ...(process.env['__EGL_VENDOR_LIBRARY_DIRS'] ?? '').split(':').filter(Boolean)]
+  return (
+    vendorDirs.some((dir) => listDir(dir).some((name) => /nvidia/i.test(name))) ||
+    listDir(FLATPAK_GL_DIR).some((name) => name.startsWith('nvidia'))
+  )
+}
+
+export function parseNvidiaDriverVersion(procText: string): string | undefined {
+  return /(\d{3,}\.\d+(?:\.\d+)?)/.exec(procText)?.[1]
+}
+
+export function nvidiaExtensionName(version: string): string {
+  return EXTENSION_PREFIX + version.replace(/\./g, '-')
+}
+
+function hostDriverExtension(): string | undefined {
+  try {
+    const version = parseNvidiaDriverVersion(fs.readFileSync(NVIDIA_VERSION_FILE, 'utf8'))
+    return version ? nvidiaExtensionName(version) : undefined
+  } catch {
+    return undefined
+  }
+}
+
+/** What the engine said about its renderer wins, before it did only the Flatpak NVIDIA check can tell */
+export function getGraphicsWarning(): GraphicsWarning | null {
+  const renderer = getEngineRenderer()
+  const flatpakNvidia = isFlatpak() && hasNvidiaDevice() && !sandboxHasNvidiaGl()
+
+  if (renderer !== undefined && !SOFTWARE_RENDERER.test(renderer)) return null
+  if (!flatpakNvidia) return renderer !== undefined ? { kind: 'software', renderer } : null
+
+  const extension = hostDriverExtension()
+  return { kind: 'flatpak-nvidia', ...(renderer !== undefined ? { renderer } : {}), ...(extension ? { extension } : {}) }
+}
+
+async function onHost(cmd: string, args: string[], timeout: number): Promise<string> {
+  const [file, fileArgs] = hostCommand(cmd, args)
+  const { stdout } = await execFileAsync(file, fileArgs, { timeout, maxBuffer: 1 << 20 })
+  return stdout
+}
+
+/** The extension has to go where the app is, and a remote that exists in both makes flatpak ask which one */
+export function appInstallation(appPath = hostAppPath()): '--user' | '--system' {
+  return appPath?.startsWith(os.homedir()) ? '--user' : '--system'
+}
+
+export async function installNvidiaExtension(): Promise<{ ok: boolean; message: string }> {
+  const extension = hostDriverExtension()
+  if (!isFlatpak() || !extension) return { ok: false, message: 'The driver version could not be read' }
+
+  try {
+    const installation = appInstallation()
+    const listing = await onHost(
+      'flatpak',
+      ['remote-ls', installation, 'flathub', '--runtime', '--columns=application,branch'],
+      60_000
+    )
+    const branch = listing
+      .split('\n')
+      .map((line) => line.trim().split(/\s+/))
+      .find(([id]) => id === extension)?.[1]
+    if (!branch) return { ok: false, message: `${extension} is not on Flathub` }
+
+    await onHost(
+      'flatpak',
+      ['install', installation, '-y', '--noninteractive', 'flathub', `${extension}//${branch}`],
+      INSTALL_TIMEOUT_MS
+    )
+    return { ok: true, message: extension }
+  } catch (err) {
+    const e = err as Error & { stderr?: string }
+    return { ok: false, message: (e.stderr || e.message).trim().split('\n').slice(-2).join(' ') }
+  }
+}

+ 8 - 0
src/main/services/lwe.service.ts

@@ -1175,6 +1175,7 @@ const exitListeners = new Set<(info: LweExitInfo) => void>()
 const LOG_LINES_KEPT = 60
 const HISTORY_LINES_KEPT = 5000
 let diagnosticStats = false
+let engineRenderer: string | undefined
 // a crash this soon after a launch or hotswap is blamed on it
 const CRASH_WINDOW_MS = 20_000
 const CRASH_SIGNALS = new Set(['SIGSEGV', 'SIGABRT', 'SIGBUS', 'SIGFPE', 'SIGILL', 'SIGTRAP'])
@@ -1440,6 +1441,11 @@ export function setDiagnosticStats(on: boolean): void {
   diagnosticStats = on
 }
 
+/** The GL renderer the last engine reported, undefined before one did or for engines that don't say */
+export function getEngineRenderer(): string | undefined {
+  return engineRenderer
+}
+
 export interface EngineHistory {
   screen: ScreenTarget
   wallpaperPath: string
@@ -1776,6 +1782,8 @@ export async function launchLweAsync(wallpaperPath: string, options: LweLaunchOp
       console.log(`[LWE ${stream}]`, msg)
       inst.log.push(...msg.split('\n'))
       if (inst.log.length > LOG_LINES_KEPT) inst.log.splice(0, inst.log.length - LOG_LINES_KEPT)
+      const renderer = /OpenGL renderer: (.+)/.exec(msg)
+      if (renderer) engineRenderer = renderer[1]
       inst.history.push(...msg.split('\n'))
       if (inst.history.length > HISTORY_LINES_KEPT) inst.history.splice(0, inst.history.length - HISTORY_LINES_KEPT)
     }

+ 7 - 0
src/preload/index.ts

@@ -49,6 +49,7 @@ import type {
   FavoriteStatus,
   UpdateChecks,
   UpdateStatus,
+  GraphicsWarning,
   UpdateTarget
 } from '../shared/types'
 import type { VideoSegment } from '../shared/videoTrim'
@@ -447,6 +448,12 @@ const api = {
     restart: (): Promise<void> => ipcRenderer.invoke(IpcChannels.UPDATES_RESTART)
   },
 
+  graphics: {
+    warning: (): Promise<GraphicsWarning | null> => ipcRenderer.invoke(IpcChannels.GRAPHICS_WARNING),
+    installNvidia: (): Promise<{ ok: boolean; message: string }> =>
+      ipcRenderer.invoke(IpcChannels.GRAPHICS_INSTALL_NVIDIA)
+  },
+
   diagnostics: {
     collect: (): Promise<{ status: 'saved'; path: string } | { status: 'cancelled' | 'no-engine' }> =>
       ipcRenderer.invoke(IpcChannels.DIAGNOSTICS_COLLECT)

+ 2 - 0
src/renderer/src/App.tsx

@@ -10,6 +10,7 @@ import SetupScreen from './components/setup/SetupScreen'
 import StatusBar from './components/layout/StatusBar'
 import GnomeExtensionNotice from './components/layout/GnomeExtensionNotice'
 import UpdateNotice from './components/updates/UpdateNotice'
+import GraphicsNotice from './components/layout/GraphicsNotice'
 import UpdatePrompt from './components/updates/UpdatePrompt'
 import { useToast } from './components/common/Toast'
 import { screenLabel } from './utils/screens'
@@ -157,6 +158,7 @@ export default function App() {
     <ErrorBoundary>
       <div key={language} className="flex h-full flex-col bg-app text-gray-100">
         <GnomeExtensionNotice />
+        <GraphicsNotice />
         <UpdateNotice />
         <div className="flex flex-1 overflow-hidden">
           <Sidebar activeView={activeView} onNavigate={setActiveView} />

+ 92 - 0
src/renderer/src/components/layout/GraphicsNotice.tsx

@@ -0,0 +1,92 @@
+import { useState } from 'react'
+import { useQuery } from '@tanstack/react-query'
+import { Cpu, Download, Loader2, X } from 'lucide-react'
+import type { MessageKey } from '@shared/i18n'
+import type { GraphicsWarning } from '@shared/types'
+import CopyField from '../common/CopyField'
+import { useToast } from '../common/Toast'
+import { t } from '../../i18n'
+
+const MESSAGES: Record<GraphicsWarning['kind'], MessageKey> = {
+  software: 'graphics.software',
+  'flatpak-nvidia': 'graphics.flatpakNvidia'
+}
+
+const DISMISSED_KEY = 'graphics-warning-dismissed'
+
+function wasDismissed(kind: string): boolean {
+  try {
+    return localStorage.getItem(DISMISSED_KEY) === kind
+  } catch {
+    return false
+  }
+}
+
+export default function GraphicsNotice() {
+  const [dismissed, setDismissed] = useState<string | null>(null)
+  const [installing, setInstalling] = useState(false)
+  const { showToast } = useToast()
+  const { data: warning } = useQuery({
+    queryKey: ['graphics-warning'],
+    queryFn: () => window.electronAPI.graphics.warning(),
+    refetchInterval: 5000
+  })
+
+  if (!warning || dismissed === warning.kind || wasDismissed(warning.kind)) return null
+
+  function dismiss() {
+    if (!warning) return
+    setDismissed(warning.kind)
+    try {
+      localStorage.setItem(DISMISSED_KEY, warning.kind)
+    } catch {
+      // the notice just comes back next start
+    }
+  }
+
+  async function install() {
+    setInstalling(true)
+    try {
+      const result = await window.electronAPI.graphics.installNvidia()
+      if (result.ok) showToast(t('graphics.installed'), { durationMs: 10000 })
+      else showToast(t('graphics.installFailed', { error: result.message }), { warning: true, durationMs: 12000 })
+    } finally {
+      setInstalling(false)
+    }
+  }
+
+  const command = warning.extension
+    ? `flatpak install flathub ${warning.extension}`
+    : 'flatpak install flathub org.freedesktop.Platform.GL.nvidia-<driver version, dots as dashes>'
+
+  return (
+    <div className="flex flex-col gap-2 border-b border-fg/10 bg-pane px-4 py-2">
+      <div className="flex items-center gap-3 text-sm text-gray-300">
+        <Cpu size={16} className="shrink-0 text-amber-400" />
+        <span className="flex-1">{t(MESSAGES[warning.kind], { renderer: warning.renderer ?? '' })}</span>
+        {warning.kind === 'flatpak-nvidia' && warning.extension && (
+          <button
+            onClick={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"
+          >
+            {installing ? <Loader2 size={12} className="animate-spin" /> : <Download size={12} />}
+            {installing ? t('graphics.installing') : t('graphics.install')}
+          </button>
+        )}
+        <button
+          onClick={dismiss}
+          title={t('update.dismiss')}
+          className="rounded p-1 text-gray-500 hover:bg-fg/5 hover:text-gray-300"
+        >
+          <X size={14} />
+        </button>
+      </div>
+      {warning.kind === 'flatpak-nvidia' && (
+        <div className="pl-7">
+          <CopyField text={command} />
+        </div>
+      )}
+    </div>
+  )
+}

+ 6 - 0
src/shared/i18n/locales/de.ts

@@ -382,6 +382,12 @@ export const de: Messages = {
   'folders.scanning': 'Lese ein...',
   'folders.title': 'Zusätzliche Bibliotheksordner',
 
+  'graphics.install': 'Treiber installieren',
+  'graphics.installing': 'Installiere...',
+  'graphics.installed': 'Installiert. Starte WE Manager neu, um ihn zu verwenden.',
+  'graphics.installFailed': 'Installation fehlgeschlagen: {error}. Führe den Befehl unten von Hand aus oder nutze stattdessen das AppImage oder ein Paket.',
+  'graphics.software': 'Die Wallpaper-Engine zeichnet auf der CPU ({renderer}), daher sind Wallpaper langsam und belasten die CPU stark. Prüfe die Einrichtung deines Grafiktreibers.',
+  'graphics.flatpakNvidia': 'Diesem Flatpak fehlt ein NVIDIA-Grafiktreiber für deine GPU, daher werden Wallpaper auf der CPU gezeichnet und laufen langsam. Installiere die NVIDIA-Flatpak-Erweiterung passend zu deiner Treiberversion oder nutze stattdessen das AppImage oder ein Paket.',
   'gnome.active': 'Die GNOME-Shell-Erweiterung ist aktiv',
   'gnome.allAtOnce': 'Alles auf einmal',
   'gnome.byHand': 'Oder von Hand im Terminal, danach einmal ab- und wieder anmelden, damit GNOME Shell sie lädt:',

+ 6 - 0
src/shared/i18n/locales/en.ts

@@ -380,6 +380,12 @@ export const en = {
   'folders.scanning': 'Scanning...',
   'folders.title': 'Extra library folders',
 
+  'graphics.install': 'Install driver',
+  'graphics.installing': 'Installing...',
+  'graphics.installed': 'Installed. Restart WE Manager to use it.',
+  'graphics.installFailed': 'Installation failed: {error}. Run the command below by hand, or use the AppImage or a package instead.',
+  'graphics.software': 'The wallpaper engine is drawing on the CPU ({renderer}), so wallpapers are slow and use a lot of CPU. Check your graphics driver setup.',
+  'graphics.flatpakNvidia': 'This Flatpak has no NVIDIA graphics driver for your GPU, so wallpapers are drawn on the CPU and run slowly. Install the NVIDIA Flatpak extension that matches your driver version, or use the AppImage or a package instead.',
   'gnome.active': 'The GNOME Shell extension is active',
   'gnome.allAtOnce': 'All at once',
   'gnome.byHand': 'Or by hand in a terminal, then log out and back in once so GNOME Shell loads it:',

+ 6 - 0
src/shared/i18n/locales/es.ts

@@ -382,6 +382,12 @@ export const es: Messages = {
   'folders.scanning': 'Escaneando...',
   'folders.title': 'Carpetas de biblioteca adicionales',
 
+  'graphics.install': 'Instalar controlador',
+  'graphics.installing': 'Instalando...',
+  'graphics.installed': 'Instalado. Reinicia WE Manager para usarlo.',
+  'graphics.installFailed': 'Falló la instalación: {error}. Ejecuta el comando de abajo a mano, o usa el AppImage o un paquete.',
+  'graphics.software': 'El motor de fondos está dibujando con la CPU ({renderer}), por lo que los fondos van lentos y usan mucha CPU. Revisa la configuración del controlador gráfico.',
+  'graphics.flatpakNvidia': 'Este Flatpak no tiene un controlador gráfico NVIDIA para tu GPU, así que los fondos se dibujan con la CPU y van lentos. Instala la extensión NVIDIA de Flatpak que coincida con la versión de tu controlador, o usa el AppImage o un paquete.',
   'gnome.active': 'La extensión de GNOME Shell está activa',
   'gnome.allAtOnce': 'Todo a la vez',
   'gnome.byHand': 'O a mano en una terminal, y luego cierra sesión y vuelve a entrar una vez para que GNOME Shell la cargue:',

+ 6 - 0
src/shared/i18n/locales/fr.ts

@@ -382,6 +382,12 @@ export const fr: Messages = {
   'folders.scanning': 'Analyse...',
   'folders.title': 'Dossiers de bibliothèque supplémentaires',
 
+  'graphics.install': 'Installer le pilote',
+  'graphics.installing': 'Installation...',
+  'graphics.installed': 'Installé. Redémarrez WE Manager pour l\'utiliser.',
+  'graphics.installFailed': 'Échec de l\'installation : {error}. Exécutez la commande ci-dessous à la main, ou utilisez l\'AppImage ou un paquet.',
+  'graphics.software': 'Le moteur de fonds d\'écran dessine sur le processeur ({renderer}), les fonds sont donc lents et sollicitent beaucoup le CPU. Vérifiez la configuration de votre pilote graphique.',
+  'graphics.flatpakNvidia': 'Ce Flatpak n\'a pas de pilote graphique NVIDIA pour votre GPU, les fonds d\'écran sont donc dessinés par le processeur et sont lents. Installez l\'extension Flatpak NVIDIA correspondant à la version de votre pilote, ou utilisez l\'AppImage ou un paquet.',
   'gnome.active': 'L\'extension GNOME Shell est active',
   'gnome.allAtOnce': 'Tout d\'un coup',
   'gnome.byHand': 'Ou à la main dans un terminal, puis déconnectez-vous et reconnectez-vous une fois pour que GNOME Shell la charge :',

+ 6 - 0
src/shared/i18n/locales/it.ts

@@ -382,6 +382,12 @@ export const it: Messages = {
   'folders.scanning': 'Scansione...',
   'folders.title': 'Cartelle di libreria aggiuntive',
 
+  'graphics.install': 'Installa il driver',
+  'graphics.installing': 'Installazione...',
+  'graphics.installed': 'Installato. Riavvia WE Manager per usarlo.',
+  'graphics.installFailed': 'Installazione non riuscita: {error}. Esegui a mano il comando qui sotto, oppure usa l\'AppImage o un pacchetto.',
+  'graphics.software': 'Il motore degli sfondi sta disegnando con la CPU ({renderer}), quindi gli sfondi sono lenti e usano molta CPU. Controlla la configurazione del driver grafico.',
+  'graphics.flatpakNvidia': 'Questo Flatpak non ha un driver grafico NVIDIA per la tua GPU, quindi gli sfondi vengono disegnati dalla CPU e sono lenti. Installa l\'estensione Flatpak NVIDIA che corrisponde alla versione del tuo driver, oppure usa l\'AppImage o un pacchetto.',
   'gnome.active': 'L\'estensione di GNOME Shell è attiva',
   'gnome.allAtOnce': 'Tutto insieme',
   'gnome.byHand': 'Oppure a mano in un terminale, poi esci e rientra una volta perché GNOME Shell la carichi:',

+ 6 - 0
src/shared/i18n/locales/ja.ts

@@ -361,6 +361,12 @@ export const ja: Messages = {
   'folders.scanning': 'スキャン中...',
   'folders.title': '追加のライブラリフォルダー',
 
+  'graphics.install': 'ドライバーをインストール',
+  'graphics.installing': 'インストール中...',
+  'graphics.installed': 'インストールしました。使うには WE Manager を再起動してください。',
+  'graphics.installFailed': 'インストールに失敗しました: {error}。下のコマンドを手動で実行するか、AppImage またはパッケージ版を使ってください。',
+  'graphics.software': '壁紙エンジンが CPU で描画しています ({renderer})。壁紙が遅くなり、CPU を多く使います。グラフィックドライバーの設定を確認してください。',
+  'graphics.flatpakNvidia': 'この Flatpak には、お使いの GPU 用の NVIDIA グラフィックドライバーがないため、壁紙は CPU で描画され遅くなります。ドライバーのバージョンに合う NVIDIA Flatpak 拡張機能をインストールするか、AppImage またはパッケージ版を使ってください。',
   'gnome.active': 'GNOME Shell 拡張機能は有効です',
   'gnome.allAtOnce': 'まとめて実行',
   'gnome.byHand': 'またはターミナルで手動で実行し、GNOME Shell に読み込ませるため一度ログアウトしてログインし直してください:',

+ 6 - 0
src/shared/i18n/locales/ko.ts

@@ -361,6 +361,12 @@ export const ko: Messages = {
   'folders.scanning': '검사 중...',
   'folders.title': '추가 라이브러리 폴더',
 
+  'graphics.install': '드라이버 설치',
+  'graphics.installing': '설치 중...',
+  'graphics.installed': '설치했습니다. 적용하려면 WE Manager를 다시 시작하세요.',
+  'graphics.installFailed': '설치 실패: {error}. 아래 명령을 직접 실행하거나 AppImage 또는 패키지 버전을 사용하세요.',
+  'graphics.software': '배경화면 엔진이 CPU로 그리고 있어({renderer}) 배경화면이 느리고 CPU를 많이 사용합니다. 그래픽 드라이버 설정을 확인하세요.',
+  'graphics.flatpakNvidia': '이 Flatpak에는 사용 중인 GPU용 NVIDIA 그래픽 드라이버가 없어 배경화면이 CPU로 그려지며 느립니다. 드라이버 버전에 맞는 NVIDIA Flatpak 확장을 설치하거나 AppImage 또는 패키지 버전을 사용하세요.',
   'gnome.active': 'GNOME Shell 확장이 활성화되어 있습니다',
   'gnome.allAtOnce': '한 번에 모두',
   'gnome.byHand': '또는 터미널에서 직접 실행한 뒤, GNOME Shell이 불러오도록 한 번 로그아웃했다가 다시 로그인하세요:',

+ 6 - 0
src/shared/i18n/locales/pl.ts

@@ -424,6 +424,12 @@ export const pl: Messages = {
   'folders.scanning': 'Skanowanie...',
   'folders.title': 'Dodatkowe foldery biblioteki',
 
+  'graphics.install': 'Zainstaluj sterownik',
+  'graphics.installing': 'Instalowanie...',
+  'graphics.installed': 'Zainstalowano. Uruchom WE Manager ponownie, aby go używać.',
+  'graphics.installFailed': 'Instalacja nie powiodła się: {error}. Uruchom poniższe polecenie ręcznie albo użyj AppImage lub pakietu.',
+  'graphics.software': 'Silnik tapet rysuje na procesorze ({renderer}), więc tapety działają wolno i mocno obciążają CPU. Sprawdź konfigurację sterownika grafiki.',
+  'graphics.flatpakNvidia': 'Ten Flatpak nie ma sterownika graficznego NVIDIA dla twojej karty, więc tapety są rysowane na procesorze i działają wolno. Zainstaluj rozszerzenie NVIDIA dla Flatpaka pasujące do wersji sterownika albo użyj AppImage lub pakietu.',
   'gnome.active': 'Rozszerzenie GNOME Shell jest aktywne',
   'gnome.allAtOnce': 'Wszystko naraz',
   'gnome.byHand': 'Albo ręcznie w terminalu, a potem wyloguj się i zaloguj ponownie, aby GNOME Shell je wczytał:',

+ 6 - 0
src/shared/i18n/locales/pt.ts

@@ -382,6 +382,12 @@ export const pt: Messages = {
   'folders.scanning': 'Escaneando...',
   'folders.title': 'Pastas extras da biblioteca',
 
+  'graphics.install': 'Instalar driver',
+  'graphics.installing': 'Instalando...',
+  'graphics.installed': 'Instalado. Reinicie o WE Manager para usá-lo.',
+  'graphics.installFailed': 'Falha na instalação: {error}. Execute o comando abaixo manualmente ou use o AppImage ou um pacote.',
+  'graphics.software': 'O motor de papéis de parede está desenhando na CPU ({renderer}), por isso os papéis de parede ficam lentos e usam muita CPU. Verifique a configuração do driver gráfico.',
+  'graphics.flatpakNvidia': 'Este Flatpak não tem um driver gráfico NVIDIA para a sua GPU, então os papéis de parede são desenhados na CPU e ficam lentos. Instale a extensão NVIDIA do Flatpak que corresponde à versão do seu driver, ou use o AppImage ou um pacote.',
   'gnome.active': 'A extensão do GNOME Shell está ativa',
   'gnome.allAtOnce': 'Tudo de uma vez',
   'gnome.byHand': 'Ou manualmente num terminal, depois saia e entre de novo uma vez para o GNOME Shell carregá-la:',

+ 6 - 0
src/shared/i18n/locales/ru.ts

@@ -424,6 +424,12 @@ export const ru: Messages = {
   'folders.scanning': 'Сканирование...',
   'folders.title': 'Дополнительные папки библиотеки',
 
+  'graphics.install': 'Установить драйвер',
+  'graphics.installing': 'Установка...',
+  'graphics.installed': 'Установлено. Перезапустите WE Manager, чтобы применить.',
+  'graphics.installFailed': 'Не удалось установить: {error}. Выполните команду ниже вручную или используйте AppImage либо пакет.',
+  'graphics.software': 'Движок обоев рисует на процессоре ({renderer}), поэтому обои тормозят и сильно нагружают CPU. Проверьте настройку графического драйвера.',
+  'graphics.flatpakNvidia': 'В этом Flatpak нет графического драйвера NVIDIA для вашей видеокарты, поэтому обои рисуются на процессоре и тормозят. Установите расширение NVIDIA для Flatpak, подходящее к версии вашего драйвера, или используйте AppImage либо пакет.',
   'gnome.active': 'Расширение GNOME Shell активно',
   'gnome.allAtOnce': 'Всё сразу',
   'gnome.byHand': 'Или вручную в терминале, затем один раз выйдите из сеанса и войдите снова, чтобы GNOME Shell его загрузил:',

+ 6 - 0
src/shared/i18n/locales/tr.ts

@@ -382,6 +382,12 @@ export const tr: Messages = {
   'folders.scanning': 'Taranıyor...',
   'folders.title': 'Ek kitaplık klasörleri',
 
+  'graphics.install': 'Sürücüyü kur',
+  'graphics.installing': 'Kuruluyor...',
+  'graphics.installed': 'Kuruldu. Kullanmak için WE Manager\'ı yeniden başlatın.',
+  'graphics.installFailed': 'Kurulum başarısız: {error}. Aşağıdaki komutu elle çalıştırın ya da AppImage veya bir paket kullanın.',
+  'graphics.software': 'Duvar kağıdı motoru CPU üzerinde çiziyor ({renderer}); bu yüzden duvar kağıtları yavaş çalışır ve CPU\'yu çok kullanır. Grafik sürücü kurulumunuzu kontrol edin.',
+  'graphics.flatpakNvidia': 'Bu Flatpak\'te ekran kartınız için NVIDIA grafik sürücüsü yok; bu yüzden duvar kağıtları CPU ile çiziliyor ve yavaş çalışıyor. Sürücü sürümünüzle eşleşen NVIDIA Flatpak uzantısını kurun ya da bunun yerine AppImage veya bir paket kullanın.',
   'gnome.active': 'GNOME Shell uzantısı etkin',
   'gnome.allAtOnce': 'Hepsi bir arada',
   'gnome.byHand': 'Ya da bir terminalde elle yapın, ardından GNOME Shell\'in yüklemesi için bir kez oturumu kapatıp yeniden açın:',

+ 6 - 0
src/shared/i18n/locales/zh-CN.ts

@@ -361,6 +361,12 @@ export const zhCN: Messages = {
   'folders.scanning': '正在扫描...',
   'folders.title': '额外的库文件夹',
 
+  'graphics.install': '安装驱动',
+  'graphics.installing': '正在安装...',
+  'graphics.installed': '已安装。重启 WE Manager 后生效。',
+  'graphics.installFailed': '安装失败:{error}。请手动运行下面的命令,或改用 AppImage 或软件包。',
+  'graphics.software': '壁纸引擎正在使用 CPU 绘制({renderer}),壁纸会很卡并占用大量 CPU。请检查显卡驱动配置。',
+  'graphics.flatpakNvidia': '此 Flatpak 没有适用于你的 GPU 的 NVIDIA 显卡驱动,壁纸由 CPU 绘制,运行缓慢。请安装与你的驱动版本匹配的 NVIDIA Flatpak 扩展,或改用 AppImage 或软件包。',
   'gnome.active': 'GNOME Shell 扩展已启用',
   'gnome.allAtOnce': '一次全部执行',
   'gnome.byHand': '或者在终端中手动执行,然后注销并重新登录一次,让 GNOME Shell 加载它:',

+ 6 - 0
src/shared/i18n/locales/zh-TW.ts

@@ -361,6 +361,12 @@ export const zhTW: Messages = {
   'folders.scanning': '正在掃描...',
   'folders.title': '額外的媒體庫資料夾',
 
+  'graphics.install': '安裝驅動程式',
+  'graphics.installing': '安裝中...',
+  'graphics.installed': '已安裝。重新啟動 WE Manager 後生效。',
+  'graphics.installFailed': '安裝失敗:{error}。請手動執行下方指令,或改用 AppImage 或套件。',
+  'graphics.software': '桌布引擎正在使用 CPU 繪製({renderer}),桌布會很卡並佔用大量 CPU。請檢查顯示卡驅動程式設定。',
+  'graphics.flatpakNvidia': '此 Flatpak 沒有適用於你的 GPU 的 NVIDIA 顯示驅動程式,桌布由 CPU 繪製,執行緩慢。請安裝與你的驅動程式版本相符的 NVIDIA Flatpak 擴充功能,或改用 AppImage 或套件。',
   'gnome.active': 'GNOME Shell 擴充功能已啟用',
   'gnome.allAtOnce': '一次全部執行',
   'gnome.byHand': '或在終端機中手動執行,然後登出再登入一次,讓 GNOME Shell 載入它:',

+ 2 - 0
src/shared/ipc-channels.ts

@@ -164,6 +164,8 @@ export const IpcChannels = {
   UPDATES_RESTART: 'updates:restart',
 
   DIAGNOSTICS_COLLECT: 'diagnostics:collect',
+  GRAPHICS_WARNING: 'graphics:warning',
+  GRAPHICS_INSTALL_NVIDIA: 'graphics:install-nvidia',
 
   // Events pushed from main to renderer
   EVENT_DOWNLOAD_PROGRESS: 'event:download-progress',

+ 9 - 0
src/shared/types.ts

@@ -581,3 +581,12 @@ export interface PlaylistPlaybackState {
   isPlaying: boolean
   order: string[]
 }
+
+/** Why wallpapers would be drawn on the CPU, shown as a notice */
+export interface GraphicsWarning {
+  kind: 'software' | 'flatpak-nvidia'
+  /** the renderer the engine reported */
+  renderer?: string
+  /** flatpak-nvidia: the NVIDIA GL extension for the host's driver, when the version could be read */
+  extension?: string
+}