Przeglądaj źródła

added support for other distros

UwU 1 miesiąc temu
rodzic
commit
c77031d331

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

@@ -75,8 +75,44 @@ jobs:
             dist/*.deb
           if-no-files-found: error
 
+  # the app's .deb plus the engine's latest portable release, see packaging/flatpak
+  flatpak:
+    needs: we-manager
+    runs-on: ubuntu-latest
+    container:
+      image: ghcr.io/flathub-infra/flatpak-github-actions:freedesktop-25.08
+      options: --privileged
+    steps:
+      - uses: actions/checkout@v7
+
+      - uses: actions/download-artifact@v8
+        with:
+          name: we-manager
+          path: ${{ runner.temp }}/we-manager
+
+      - name: Collect sources
+        run: |
+          cp "$RUNNER_TEMP"/we-manager/*.deb packaging/flatpak/we-manager.deb
+          url=$(curl -fsSL https://api.github.com/repos/WallpaperEngineLover/linux-wallpaperengine-kde/releases/latest |
+            jq -r '.assets[] | select(.name == "linux-wallpaperengine-kde-portable-x86_64.tar.gz") | .browser_download_url')
+          [ -n "$url" ] || { echo "the latest linux-wallpaperengine-kde release has no portable tarball"; exit 1; }
+          curl -fL "$url" -o packaging/flatpak/linux-wallpaperengine-kde-portable-x86_64.tar.gz
+
+      - uses: flatpak/flatpak-github-actions/flatpak-builder@v6
+        with:
+          bundle: we-manager.flatpak
+          manifest-path: packaging/flatpak/io.github.WallpaperEngineLover.we_manager.yml
+          cache-key: flatpak-builder-${{ github.sha }}
+          upload-artifact: false
+
+      - uses: actions/upload-artifact@v7
+        with:
+          name: we-manager-flatpak
+          path: we-manager.flatpak
+          if-no-files-found: error
+
   release:
-    needs: [steamworks-vote, we-manager]
+    needs: [steamworks-vote, we-manager, flatpak]
     if: ${{ !cancelled() && startsWith(github.ref, 'refs/tags/v') && needs.we-manager.result == 'success' }}
     runs-on: ubuntu-latest
     permissions:
@@ -102,4 +138,28 @@ jobs:
           GH_TOKEN: ${{ github.token }}
         run: |
           gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --generate-notes \
-            release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz 2>/dev/null)
+            release/*.AppImage release/*.deb $(ls release/steamworks.js-*.tgz release/*.flatpak 2>/dev/null)
+
+  aur:
+    needs: release
+    runs-on: ubuntu-latest
+    env:
+      HAS_AUR_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY != '' }}
+    steps:
+      - uses: actions/checkout@v7
+
+      - name: Set the version
+        run: sed -i -e "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/" -e "s/^pkgrel=.*/pkgrel=1/"
+          packaging/aur/we-manager-bin/PKGBUILD
+
+      - name: Publish we-manager-bin to the AUR
+        if: env.HAS_AUR_KEY == 'true'
+        uses: KSXGitHub/github-actions-deploy-aur@v4.1.1
+        with:
+          pkgname: we-manager-bin
+          pkgbuild: ./packaging/aur/we-manager-bin/PKGBUILD
+          updpkgsums: true
+          commit_username: ${{ secrets.AUR_USERNAME }}
+          commit_email: ${{ secrets.AUR_EMAIL }}
+          ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
+          commit_message: Update to ${{ github.ref_name }}

+ 10 - 0
.gitignore

@@ -5,3 +5,13 @@ dist/
 *.db
 *.tsbuildinfo
 preview-cache/
+# packaging/flatpak/fetch-sources.sh downloads, flatpak-builder state and bundles
+packaging/flatpak/*.deb
+packaging/flatpak/*.tar.gz
+.flatpak-builder/
+build-dir/
+repo/
+*.flatpak
+# makepkg runs in the AUR package folder
+packaging/aur/*/*
+!packaging/aur/*/PKGBUILD

+ 17 - 4
README.md

@@ -9,6 +9,16 @@ Steam must be running and Wallpaper Engine (app id 431960) must be in the
 library for workshop browsing and subscriptions to work. Without Steam the app
 still works as a local library manager.
 
+## Installing
+
+- **AppImage / .deb** from the [releases](https://github.com/WallpaperEngineLover/we_manager/releases).
+- **Flatpak**: the `.flatpak` bundle on the releases page comes with linux-wallpaperengine inside, for
+  Bazzite, Silverblue/Kinoite, SteamOS and any other distribution:
+  `flatpak install --user we-manager.flatpak` (needs Flathub for the runtime). To build it yourself:
+  `packaging/flatpak/fetch-sources.sh`, then
+  `flatpak-builder --user --install --force-clean build-dir packaging/flatpak/io.github.WallpaperEngineLover.we_manager.yml`.
+- **AUR**: `we-manager-bin`, with `linux-wallpaperengine-kde-bin` or `-git` for the engine.
+
 ## Running
 
 ```
@@ -22,10 +32,13 @@ npm run dist     # package with electron-builder
 
 - Settings downloads a prebuilt linux-wallpaperengine from the
   [linux-wallpaperengine-kde releases](https://github.com/WallpaperEngineLover/linux-wallpaperengine-kde/releases)
-  on Ubuntu 24.04, Fedora 44 and Arch, into `~/.local/share/linux-wallpaperengine-kde`
-  (sudo only to install missing system libraries). Elsewhere it builds and
-  installs from source (needs sudo for the package manager and `make install`),
-  from a configurable repository (git URL or local path) and branch.
+  into `~/.local/share/linux-wallpaperengine-kde`: the Ubuntu 24.04 or Fedora 44
+  build there, the portable build on every other distribution with glibc 2.35 or
+  newer (Arch, SteamOS, image-based systems, Debian, openSUSE, older and newer
+  Ubuntu and Fedora). sudo is only needed for missing system libraries. It can
+  also build and install from source (needs sudo for the package manager and
+  `make install`), from a configurable repository (git URL or local path) and
+  branch. Inside the Flatpak the engine comes with the app.
 - The optional desktop icons overlay
   (`src/main/services/desktop-icons-overlay.py`) draws KDE Folder View icons
   on a transparent layer-shell surface above the wallpaper. It needs python3,

+ 1 - 1
package.json

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

+ 28 - 0
packaging/aur/we-manager-bin/PKGBUILD

@@ -0,0 +1,28 @@
+# Maintainer: UwU <260361707+WallpaperEngineLover@users.noreply.github.com>
+# pkgver and the checksum are set by .github/workflows/aur.yml on every release
+pkgname=we-manager-bin
+_pkgname=we-manager
+pkgver=0.8.1
+pkgrel=1
+pkgdesc="Wallpaper Engine workshop manager for linux-wallpaperengine"
+arch=('x86_64')
+url="https://github.com/WallpaperEngineLover/we_manager"
+license=('MIT')
+# Electron's runtime, as the .deb lists it
+depends=('gtk3' 'libnotify' 'nss' 'libxss' 'libxtst' 'xdg-utils' 'at-spi2-core' 'util-linux-libs' 'libsecret')
+optdepends=('linux-wallpaperengine-kde-bin: the wallpaper engine, prebuilt'
+    'linux-wallpaperengine-kde-git: the wallpaper engine, built from git')
+provides=('we-manager')
+conflicts=('we-manager')
+options=('!strip' '!debug')
+source=("${_pkgname}_${pkgver}_amd64.deb::$url/releases/download/v$pkgver/${_pkgname}_${pkgver}_amd64.deb")
+sha256sums=('SKIP')
+
+package() {
+    bsdtar -xf data.tar.* -C "$pkgdir"
+    # the .deb's postinst does these
+    chmod 4755 "$pkgdir/opt/WE Manager/chrome-sandbox"
+    install -d "$pkgdir/usr/bin"
+    ln -s "/opt/WE Manager/we-manager" "$pkgdir/usr/bin/we-manager"
+    rm -rf "$pkgdir/usr/share/doc"
+}

+ 21 - 0
packaging/flatpak/fetch-sources.sh

@@ -0,0 +1,21 @@
+#!/usr/bin/env bash
+# Downloads what the manifest packages into this folder: the latest we_manager .deb (or the version given as the
+# first argument, e.g. 0.8.1) and the latest linux-wallpaperengine-kde portable tarball (the KDE variant, its
+# integration only switches on inside a Plasma session).
+set -euo pipefail
+cd "$(dirname "$0")"
+
+asset_url() {
+    curl -fsSL "https://api.github.com/repos/$1/releases/${2:-latest}" |
+        jq -r --arg name "$3" '.assets[] | select(.name | test($name)) | .browser_download_url' | head -1
+}
+
+tag=latest
+[ -n "${1:-}" ] && tag="tags/v$1"
+deb=$(asset_url WallpaperEngineLover/we_manager "$tag" '^we-manager_.*_amd64\.deb$')
+engine=$(asset_url WallpaperEngineLover/linux-wallpaperengine-kde latest '^linux-wallpaperengine-kde-portable-x86_64\.tar\.gz$')
+[ -n "$deb" ] || { echo "no we_manager .deb in that release" >&2; exit 1; }
+[ -n "$engine" ] || { echo "the latest linux-wallpaperengine-kde release has no portable tarball" >&2; exit 1; }
+
+curl -fL "$deb" -o we-manager.deb
+curl -fL "$engine" -o linux-wallpaperengine-kde-portable-x86_64.tar.gz

+ 31 - 0
packaging/flatpak/io.github.WallpaperEngineLover.we_manager.metainfo.xml

@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop-application">
+  <id>io.github.WallpaperEngineLover.we_manager</id>
+  <name>WE Manager</name>
+  <summary>Play Wallpaper Engine wallpapers on the Linux desktop</summary>
+  <developer id="io.github.wallpaperenginelover">
+    <name>WallpaperEngineLover</name>
+  </developer>
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>MIT AND GPL-3.0-only</project_license>
+  <description>
+    <p>
+      WE Manager browses the Steam Workshop of Wallpaper Engine, keeps a library of your wallpapers with folders,
+      tags and playlists, and plays them on your desktop with linux-wallpaperengine, which comes with it.
+    </p>
+    <p>
+      Scene, video and web wallpapers run per screen on KDE Plasma, wlroots compositors and X11. Wallpaper Engine
+      has to be in your Steam library for its assets and the Workshop.
+    </p>
+  </description>
+  <launchable type="desktop-id">io.github.WallpaperEngineLover.we_manager.desktop</launchable>
+  <url type="homepage">https://github.com/WallpaperEngineLover/we_manager</url>
+  <url type="bugtracker">https://github.com/WallpaperEngineLover/we_manager/issues</url>
+  <categories>
+    <category>Utility</category>
+  </categories>
+  <content_rating type="oars-1.1" />
+  <releases>
+    <release version="0.8.1" date="2026-10-09" />
+  </releases>
+</component>

+ 75 - 0
packaging/flatpak/io.github.WallpaperEngineLover.we_manager.yml

@@ -0,0 +1,75 @@
+# WE Manager with linux-wallpaperengine inside. Both come from their releases: the app's .deb and the engine's
+# portable tarball, which carries its own libraries except what this runtime provides (GTK, NSS, CUPS, Mesa,
+# PipeWire). fetch-sources.sh puts them next to this file, CI uses the .deb it just built.
+#
+#   packaging/flatpak/fetch-sources.sh
+#   flatpak-builder --user --install --force-clean build-dir packaging/flatpak/io.github.WallpaperEngineLover.we_manager.yml
+id: io.github.WallpaperEngineLover.we_manager
+runtime: org.freedesktop.Platform
+runtime-version: '25.08'
+sdk: org.freedesktop.Sdk
+base: org.electronjs.Electron2.BaseApp
+base-version: '25.08'
+command: we-manager
+separate-locales: false
+finish-args:
+  - --share=ipc
+  - --share=network
+  - --socket=wayland
+  - --socket=fallback-x11
+  # wallpaper sounds, and the desktop audio the visualizers react to (the sink's monitor source)
+  - --socket=pulseaudio
+  - --device=dri
+  # the Steam client's IPC (steamworks.js) uses shared memory
+  - --device=shm
+  # Steam libraries and workshop folders, Wallpaper Engine's assets, the user's own wallpaper folders
+  - --filesystem=home
+  - --filesystem=~/.var/app/com.valvesoftware.Steam
+  # library folders on other disks
+  - --filesystem=/mnt
+  - --filesystem=/media
+  - --filesystem=/run/media
+  # the host's display tools (kscreen-doctor, wlr-randr, xrandr), wallpaper setters, the desktop icons overlay
+  # and the programs user shortcuts start
+  - --talk-name=org.freedesktop.Flatpak
+  # KDE integration: KWin scripts for the cursor and fullscreen detection, which call back into the engine
+  - --talk-name=org.kde.KWin
+  - --talk-name=org.kde.plasmashell
+  - --own-name=org.linuxwallpaperengine.*
+  # media info for wallpapers that show the playing song
+  - --talk-name=org.mpris.MediaPlayer2.*
+  - --talk-name=org.kde.StatusNotifierWatcher
+  - --talk-name=org.freedesktop.Notifications
+
+modules:
+  - name: linux-wallpaperengine
+    buildsystem: simple
+    sources:
+      - type: archive
+        path: linux-wallpaperengine-kde-portable-x86_64.tar.gz
+        dest: engine
+    build-commands:
+      - mkdir -p /app/lib/linux-wallpaperengine-kde /app/bin
+      - cp -a engine/. /app/lib/linux-wallpaperengine-kde/
+      - ln -s ../lib/linux-wallpaperengine-kde/linux-wallpaperengine /app/bin/linux-wallpaperengine
+
+  - name: we-manager
+    buildsystem: simple
+    sources:
+      - type: file
+        path: we-manager.deb
+      - type: file
+        path: we-manager.sh
+      - type: file
+        path: io.github.WallpaperEngineLover.we_manager.metainfo.xml
+    build-commands:
+      - ar x we-manager.deb
+      - tar -xf data.tar.*
+      - cp -a "opt/WE Manager" /app/we-manager
+      - install -Dm755 we-manager.sh /app/bin/we-manager
+      - install -Dm644 usr/share/applications/we-manager.desktop /app/share/applications/${FLATPAK_ID}.desktop
+      - desktop-file-edit --set-key=Exec --set-value='we-manager %U' --set-icon=${FLATPAK_ID}
+        /app/share/applications/${FLATPAK_ID}.desktop
+      - for size in 16 32 48 64 128 256; do install -Dm644 usr/share/icons/hicolor/${size}x${size}/apps/we-manager.png
+        /app/share/icons/hicolor/${size}x${size}/apps/${FLATPAK_ID}.png; done
+      - install -Dm644 ${FLATPAK_ID}.metainfo.xml /app/share/metainfo/${FLATPAK_ID}.metainfo.xml

+ 4 - 0
packaging/flatpak/we-manager.sh

@@ -0,0 +1,4 @@
+#!/bin/sh
+# Electron's own sandbox goes through flatpak-spawn (zypak), Chromium can't create user namespaces in a Flatpak
+export TMPDIR="$XDG_RUNTIME_DIR/app/$FLATPAK_ID"
+exec zypak-wrapper "/app/we-manager/we-manager" "$@"

+ 24 - 7
src/main/services/desktop-icons.service.ts

@@ -2,7 +2,9 @@ import { spawn, type ChildProcess } from 'child_process'
 import * as path from 'path'
 import * as fs from 'fs'
 import Store from 'electron-store'
+import { app } from 'electron'
 import { getConnectedScreens, getWaylandDisplay, getXdgRuntimeDir } from '../utils/platform'
+import { isFlatpak } from '../utils/flatpak'
 
 interface DesktopIconsStoreSchema {
   desktopIconsEnabled: boolean
@@ -29,13 +31,25 @@ function getOverlayScriptPath(): string {
   return candidates[0]
 }
 
+const LAYER_SHELL_LIBS = [
+  '/usr/lib64/libgtk4-layer-shell.so',
+  '/usr/lib/libgtk4-layer-shell.so',
+  '/usr/lib/x86_64-linux-gnu/libgtk4-layer-shell.so'
+]
+
 function findLayerShellLib(): string {
-  const candidates = [
-    '/usr/lib64/libgtk4-layer-shell.so',
-    '/usr/lib/libgtk4-layer-shell.so',
-    '/usr/lib/x86_64-linux-gnu/libgtk4-layer-shell.so'
-  ]
-  return candidates.find((p) => fs.existsSync(p)) ?? candidates[0]
+  return LAYER_SHELL_LIBS.find((p) => fs.existsSync(p)) ?? LAYER_SHELL_LIBS[0]
+}
+
+/** The overlay needs the host's Python, GTK4 and gtk4-layer-shell, so it runs on the host from a copy of the script */
+function flatpakOverlayCommand(scriptPath: string, envVars: string[], screen?: string): [string, string[]] {
+  const hostScript = path.join(app.getPath('userData'), 'desktop-icons-overlay.py')
+  fs.copyFileSync(scriptPath, hostScript)
+  const findLib = `for lib in ${LAYER_SHELL_LIBS.join(' ')}; do [ -e "$lib" ] && export LD_PRELOAD="$lib" && break; done`
+  const args = ['--host', ...envVars.filter((v) => !v.startsWith('LD_PRELOAD=')).map((v) => `--env=${v}`),
+    'sh', '-c', `${findLib}; exec python3 "$@"`, 'sh', hostScript]
+  if (screen) args.push(screen)
+  return ['flatpak-spawn', args]
 }
 
 /** Env vars for the overlay; Electron runs under XWayland so the Wayland env must be passed explicitly. */
@@ -76,7 +90,10 @@ export function startDesktopIconsOverlay(): void {
     const args = ['python3', scriptPath]
     if (screen) args.push(screen)
 
-    const child = spawn('env', [...envVars, ...args], {
+    const [command, commandArgs] = isFlatpak()
+      ? flatpakOverlayCommand(scriptPath, envVars, screen)
+      : ['env', [...envVars, ...args]]
+    const child = spawn(command, commandArgs, {
       stdio: 'ignore',
       detached: true
     })

+ 67 - 30
src/main/services/lwe-prebuilt.service.ts

@@ -10,18 +10,25 @@ import { LWE_RELEASE_REPO } from '@shared/constants'
 import type { LweInstallProgress, LwePrebuiltTarget } from '@shared/types'
 import { isCommandAvailable } from '../utils/platform'
 import { getLwePrebuiltDir } from '../utils/paths'
-import { buildCleanBuildEnv, isOstreeSystem, readPrebuiltRelease, resetLweDetection } from './lwe.service'
+import { isFlatpak } from '../utils/flatpak'
+import { buildCleanBuildEnv, isOstreeSystem, parseOsReleaseIds, readPrebuiltRelease, resetLweDetection } from './lwe.service'
 
 const execFileAsync = promisify(execFile)
 
-// Arch builds are paused: V8 (libnode) is only in the AUR there, so the release CI can't build them
-type PrebuiltDistro = 'ubuntu-24.04' | 'fedora-44'
+/**
+ * Distribution builds link the system's own libraries. The portable build bundles all but the desktop's libraries
+ * and runs on any distribution with glibc 2.35 or newer (Arch, SteamOS, image-based systems, ...).
+ */
+type PrebuiltDistro = 'ubuntu-24.04' | 'fedora-44' | 'portable'
 
 const DISTRO_LABELS: Record<PrebuiltDistro, string> = {
   'ubuntu-24.04': 'Ubuntu 24.04',
-  'fedora-44': 'Fedora 44'
+  'fedora-44': 'Fedora 44',
+  portable: 'Portable build'
 }
 
+const PORTABLE_GLIBC = '2.35'
+
 // Libraries the engine and CEF load from the system. Fedora installs missing ones by soname instead
 // (see installMissingLibraries), so Nobara's full ffmpeg is never swapped for ffmpeg-free.
 const RUNTIME_DEPS_UBUNTU = [
@@ -46,41 +53,63 @@ function readOsRelease(): Record<string, string> {
   return fields
 }
 
+/** glibc of the running system, e.g. "2.39" */
+function glibcVersion(): string | undefined {
+  const header = (process.report?.getReport() as { header?: { glibcVersionRuntime?: string } } | undefined)?.header
+  return header?.glibcVersionRuntime
+}
+
+function versionAtLeast(version: string, minimum: string): boolean {
+  const a = version.split('.').map(Number)
+  const b = minimum.split('.').map(Number)
+  for (let i = 0; i < Math.max(a.length, b.length); i++) {
+    if ((a[i] ?? 0) !== (b[i] ?? 0)) return (a[i] ?? 0) > (b[i] ?? 0)
+  }
+  return true
+}
+
 function detectPrebuiltDistro(): PrebuiltDistro | undefined {
   const release = readOsRelease()
   const ids = [release.ID, ...(release.ID_LIKE ?? '').split(/\s+/)].filter(Boolean)
-  // Mint 22 and Pop!_OS 24.04 are built on noble and carry its libraries
-  if (release.UBUNTU_CODENAME === 'noble' || (release.ID === 'ubuntu' && release.VERSION_ID === '24.04')) {
-    return 'ubuntu-24.04'
+  if (!isOstreeSystem()) {
+    // Mint 22 and Pop!_OS 24.04 are built on noble
+    if (release.UBUNTU_CODENAME === 'noble' || (release.ID === 'ubuntu' && release.VERSION_ID === '24.04')) {
+      return 'ubuntu-24.04'
+    }
+    if (ids.includes('fedora') && release.VERSION_ID === '44') return 'fedora-44'
   }
-  if (ids.includes('fedora') && release.VERSION_ID === '44') return 'fedora-44'
+  const glibc = glibcVersion()
+  if (glibc && versionAtLeast(glibc, PORTABLE_GLIBC)) return 'portable'
   return undefined
 }
 
+function assetName(variant: string, distro: PrebuiltDistro): string {
+  return `linux-wallpaperengine-${variant}-${distro}-x86_64.tar.gz`
+}
+
 function isKdeSession(): boolean {
   return (process.env.XDG_CURRENT_DESKTOP ?? '').split(':').some(d => d.toUpperCase() === 'KDE')
 }
 
 export function getPrebuiltTarget(): LwePrebuiltTarget {
+  if (isFlatpak()) {
+    return { supported: false, managed: true, reason: 'linux-wallpaperengine comes with the Flatpak and is updated with it.' }
+  }
   if (process.arch !== 'x64') {
     return { supported: false, reason: 'Prebuilt builds are x86_64 only, build from source instead.' }
   }
   const distro = detectPrebuiltDistro()
   if (!distro) {
-    const release = readOsRelease()
-    const isArch = [release.ID, ...(release.ID_LIKE ?? '').split(/\s+/)].includes('arch')
-    const name = release.PRETTY_NAME ?? 'this distribution'
+    const glibc = glibcVersion()
     return {
       supported: false,
-      reason: isArch
-        ? 'There is no prebuilt build for Arch for now (V8 is only in the AUR there), build from source instead.'
-        : `There is no prebuilt build for ${name} (only Ubuntu 24.04 and Fedora 44), build from source instead.`
+      reason: `The prebuilt build needs glibc ${PORTABLE_GLIBC} or newer${glibc ? ` (this system has ${glibc})` : ''}, build from source instead.`
     }
   }
   const variant = isKdeSession() ? 'kde' : 'generic'
   return {
     supported: true,
-    asset: `linux-wallpaperengine-${variant}-${distro}-x86_64.tar.gz`,
+    asset: assetName(variant, distro),
     label: `${DISTRO_LABELS[distro]}, ${variant === 'kde' ? 'with' : 'without'} KDE integration`
   }
 }
@@ -120,7 +149,9 @@ async function download(url: string, dest: string, total: number, onProgress: (f
 
 /** Sonames the binary (with its bundled libs) can't resolve on this system */
 async function findMissingLibraries(binary: string): Promise<string[]> {
-  const { stdout } = await execFileAsync('ldd', [binary], {
+  // the portable launcher adds its bundled fallback libraries before running ldd
+  const portable = fs.existsSync(`${binary}.bin`)
+  const { stdout } = await execFileAsync(portable ? binary : 'ldd', portable ? ['--check-libraries'] : [binary], {
     env: buildCleanBuildEnv(),
     encoding: 'utf8',
     maxBuffer: 5 * 1024 * 1024
@@ -135,22 +166,25 @@ async function findMissingLibraries(binary: string): Promise<string[]> {
 
 /** true when layered with rpm-ostree, which needs a reboot */
 async function installMissingLibraries(distro: PrebuiltDistro, missing: string[]): Promise<boolean> {
-  if (distro === 'fedora-44' && isOstreeSystem()) {
+  const ids = parseOsReleaseIds(fs.existsSync('/etc/os-release') ? fs.readFileSync('/etc/os-release', 'utf8') : '')
+  const bySoname = missing.map(soname => `${soname}()(64bit)`)
+  if (isOstreeSystem()) {
     // --allow-inactive: a provider may already be in the base image
-    await execFileAsync('rpm-ostree', [
-      'install', '--idempotent', '--allow-inactive', ...missing.map(soname => `${soname}()(64bit)`)
-    ], { timeout: 1_200_000, maxBuffer: 10 * 1024 * 1024 })
+    await execFileAsync('rpm-ostree', ['install', '--idempotent', '--allow-inactive', ...bySoname],
+      { timeout: 1_200_000, maxBuffer: 10 * 1024 * 1024 })
     return true
   }
   const elevate = isCommandAvailable('pkexec') ? 'pkexec' : 'sudo'
   let command: string[]
-  switch (distro) {
-    case 'fedora-44':
-      command = ['dnf', 'install', '-y', ...missing.map(soname => `${soname}()(64bit)`)]
-      break
-    case 'ubuntu-24.04':
-      command = ['apt-get', 'install', '-y', ...RUNTIME_DEPS_UBUNTU]
-      break
+  if (distro === 'ubuntu-24.04') {
+    command = ['apt-get', 'install', '-y', ...RUNTIME_DEPS_UBUNTU]
+  } else if (ids.includes('fedora') && isCommandAvailable('dnf')) {
+    command = ['dnf', 'install', '-y', ...bySoname]
+  } else if ((ids.includes('suse') || ids.includes('opensuse')) && isCommandAvailable('zypper')) {
+    command = ['zypper', '--non-interactive', 'install', ...bySoname]
+  } else {
+    // apt and pacman can't install by soname without a file index
+    throw new Error(`These system libraries are missing: ${missing.join(', ')}. Install the packages providing them with your package manager.`)
   }
   await execFileAsync(elevate, command, { timeout: 600_000, maxBuffer: 10 * 1024 * 1024 })
   return false
@@ -173,8 +207,11 @@ export async function installLwePrebuilt(win: BrowserWindow): Promise<void> {
 
     send({ stage: 'downloading', message: 'Looking up the latest release...', percentage: 2 })
     const release = await fetchLatestRelease()
-    const asset = release.assets.find(a => a.name === target.asset)
+    // fall back to the portable build
+    const portableAsset = assetName(isKdeSession() ? 'kde' : 'generic', 'portable')
+    const asset = release.assets.find(a => a.name === target.asset) ?? release.assets.find(a => a.name === portableAsset)
     if (!asset) throw new Error(`Release ${release.tag_name} has no ${target.asset}.`)
+    const assetDistro: PrebuiltDistro = asset.name === portableAsset ? 'portable' : distro
 
     const installed = readPrebuiltRelease()
     const binary = path.join(installDir, 'linux-wallpaperengine')
@@ -214,7 +251,7 @@ export async function installLwePrebuilt(win: BrowserWindow): Promise<void> {
         message: `Installing missing system libraries (sudo required): ${missing.join(', ')}`,
         percentage: 88
       })
-      if (await installMissingLibraries(distro, missing)) {
+      if (await installMissingLibraries(assetDistro, missing)) {
         resetLweDetection()
         send({
           stage: 'done',
@@ -234,7 +271,7 @@ export async function installLwePrebuilt(win: BrowserWindow): Promise<void> {
       stage: 'done',
       message: upToDate
         ? `linux-wallpaperengine ${release.tag_name} is already up to date.`
-        : `linux-wallpaperengine ${release.tag_name} installed (${target.label}).`,
+        : `linux-wallpaperengine ${release.tag_name} installed (${assetDistro === distro ? target.label : DISTRO_LABELS.portable}).`,
       percentage: 100
     })
   } catch (err) {

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

@@ -12,7 +12,7 @@ vi.mock('./config.service', () => ({
   getDisablePuppetAnimation: () => false
 }))
 
-const { buildCleanBuildEnv, buildHotswapLines, nodeDevelPackage, parseCustomArgs, parseOsReleaseIds } = await import('./lwe.service')
+const { buildCleanBuildEnv, buildHotswapLines, lwePackageOwner, nodeDevelPackage, parseCustomArgs, parseOsReleaseIds } = await import('./lwe.service')
 
 describe('parseCustomArgs', () => {
   it('splits on whitespace and keeps quoted values together', () => {
@@ -145,3 +145,13 @@ describe('parseOsReleaseIds', () => {
     expect(parseOsReleaseIds('ID=pop\nID_LIKE="ubuntu debian"\nVARIANT_ID=x')).toEqual(['pop', 'ubuntu', 'debian'])
   })
 })
+
+describe('lwePackageOwner', () => {
+  it('leaves Nix store engines to Nix', () => {
+    expect(lwePackageOwner('/nix/store/abc-linux-wallpaperengine-kde/bin/linux-wallpaperengine')).toBe('Nix')
+  })
+
+  it('owns nothing in a folder of ours', () => {
+    expect(lwePackageOwner('/tmp/not-installed-by-anything/linux-wallpaperengine')).toBeUndefined()
+  })
+})

+ 73 - 11
src/main/services/lwe.service.ts

@@ -26,7 +26,8 @@ import {
   getWaylandDisplay,
   getXdgRuntimeDir
 } from '../utils/platform'
-import { getWorkshopPath, getLweManifestPath, getLwePrebuiltDir } from '../utils/paths'
+import { getWorkshopPath, getLweManifestPath, getLwePrebuiltDir, getSteamRoots } from '../utils/paths'
+import { isFlatpak } from '../utils/flatpak'
 import {
   getLweRepoUrl,
   getLweRepoBranch,
@@ -166,7 +167,11 @@ function parseExtraCmakeArgs(raw: string | null): string[] {
   return args
 }
 
+/** The engine the Flatpak ships */
+const FLATPAK_LWE_BINARY = '/app/bin/linux-wallpaperengine'
+
 function findLweBinary(): string | undefined {
+  if (isFlatpak()) return fs.existsSync(FLATPAK_LWE_BINARY) ? FLATPAK_LWE_BINARY : undefined
   for (const p of LWE_SEARCH_PATHS) {
     try {
       fs.accessSync(p, fs.constants.X_OK)
@@ -189,15 +194,55 @@ function isPrebuiltPath(p: string): boolean {
   return p.startsWith(getLwePrebuiltDir() + path.sep)
 }
 
+let ownerCache: { path: string; owner: string | undefined } | undefined
+
+/** What installed the binary when it isn't ours to remove: the Flatpak, a Nix profile or a distribution package */
+export function lwePackageOwner(binary: string): string | undefined {
+  let real = binary
+  try { real = fs.realpathSync(binary) } catch { /* keep the path */ }
+  if (ownerCache?.path === real) return ownerCache.owner
+  let owner: string | undefined
+  if (isFlatpak() && real.startsWith('/app/')) {
+    owner = 'the Flatpak'
+  } else if (real.startsWith('/nix/store/')) {
+    owner = 'Nix'
+  } else {
+    const queries: [string, string[], (out: string) => string][] = [
+      ['pacman', ['-Qoq', real], out => `pacman (${out})`],
+      ['rpm', ['-qf', '--qf', '%{NAME}', real], out => `rpm (${out})`],
+      ['dpkg-query', ['-S', real], out => `dpkg (${out.split(':')[0]})`]
+    ]
+    for (const [command, args, label] of queries) {
+      if (!isCommandAvailable(command)) continue
+      try {
+        const out = execFileSync(command, args, { encoding: 'utf8', timeout: 5000, stdio: ['ignore', 'pipe', 'ignore'] }).trim()
+        if (out) {
+          owner = label(out.split('\n')[0])
+          break
+        }
+      } catch { /* not owned by a package */ }
+    }
+  }
+  ownerCache = { path: real, owner }
+  return owner
+}
+
 export function getLweStatus(): LweStatus {
   const found = findLweBinary()
   if (!found) return { installed: false }
   const version = isPrebuiltPath(found) ? readPrebuiltRelease()?.tag : undefined
-  return version ? { installed: true, path: found, version } : { installed: true, path: found }
+  const managedBy = isPrebuiltPath(found) ? undefined : lwePackageOwner(found)
+  return {
+    installed: true,
+    path: found,
+    ...(version ? { version } : {}),
+    ...(managedBy ? { managedBy } : {})
+  }
 }
 
 /** Forget everything detected about the previous binary after it was installed, replaced or removed */
 export function resetLweDetection(): void {
+  ownerCache = undefined
   invalidateCommandCache(LWE_BINARY)
   invalidateObjectFlagsSupport()
   invalidateAudioSensitivitySupport()
@@ -208,6 +253,8 @@ export function resetLweDetection(): void {
   invalidateHelpText()
 }
 
+const FLATPAK_MANAGED = 'linux-wallpaperengine comes with the Flatpak and is updated with it.'
+
 export function parseOsReleaseIds(release: string): string[] {
   const ids: string[] = []
   for (const line of release.split('\n')) {
@@ -300,6 +347,11 @@ export async function installLweDeps(win: BrowserWindow): Promise<void> {
     win.webContents.send(IpcChannels.EVENT_LWE_INSTALL_PROGRESS, progress)
   }
 
+  if (isFlatpak()) {
+    send({ stage: 'error', message: FLATPAK_MANAGED, percentage: 0 })
+    return
+  }
+
   const distro = detectDistro()
   if (distro === 'unknown') {
     send({
@@ -377,6 +429,11 @@ export async function installLwe(win: BrowserWindow): Promise<void> {
     win.webContents.send(IpcChannels.EVENT_LWE_INSTALL_PROGRESS, progress)
   }
 
+  if (isFlatpak()) {
+    send({ stage: 'error', message: FLATPAK_MANAGED, percentage: 0 })
+    return
+  }
+
   // read by the catch handler to decide whether to preserve or wipe the build cache
   let isLocalDir = false
 
@@ -597,10 +654,14 @@ export async function installLwe(win: BrowserWindow): Promise<void> {
 }
 
 export async function uninstallLwe(): Promise<{ ok: boolean; message: string }> {
+  if (isFlatpak()) return { ok: false, message: FLATPAK_MANAGED }
   const status = getLweStatus()
   if (!status.installed || !status.path) {
     return { ok: false, message: 'linux-wallpaperengine is not installed.' }
   }
+  if (status.managedBy) {
+    return { ok: false, message: `linux-wallpaperengine was installed by ${status.managedBy}, remove it there.` }
+  }
 
   await stopLwe()
 
@@ -681,12 +742,9 @@ function findWeAssetsDir(): string | undefined {
   }
 
   // Fallback: scan common Steam locations
-  const home = os.homedir()
-  const candidates = [
-    path.join(home, '.steam', 'steam', 'steamapps', 'common', 'wallpaper_engine', 'assets'),
-    path.join(home, '.local', 'share', 'Steam', 'steamapps', 'common', 'wallpaper_engine', 'assets')
-  ]
-  return candidates.find(p => fs.existsSync(p))
+  return getSteamRoots()
+    .map(root => path.join(root, 'steamapps', 'common', 'wallpaper_engine', 'assets'))
+    .find(p => fs.existsSync(p))
 }
 
 function getLweLibDir(): string {
@@ -731,15 +789,19 @@ function getLweBinaryPath(): string {
 
 function buildLweEnvVars(): string[] {
   const vars: string[] = []
+  // a Nix build carries its own closure, host libraries would clash
+  const fromNix = getLweBinaryPath().startsWith('/nix/store/')
 
-  vars.push(`LD_LIBRARY_PATH=${getLweLdLibraryPath()}`)
+  if (fromNix) vars.push('-u', 'LD_LIBRARY_PATH', '-u', 'LD_PRELOAD')
+  else vars.push(`LD_LIBRARY_PATH=${getLweLdLibraryPath()}`)
 
   // CEF bundles its own libEGL.so alongside the LWE binary. LD_LIBRARY_PATH includes the
   // binary's directory so CEF's EGL shadows Mesa's system EGL, breaking Wayland rendering.
   // Force the system EGL via LD_PRELOAD so Mesa's implementation is always used.
-  const systemEgl = ['/lib64/libEGL.so.1', '/usr/lib64/libEGL.so.1', '/usr/lib/libEGL.so.1']
+  const systemEgl = ['/lib64/libEGL.so.1', '/usr/lib64/libEGL.so.1', '/usr/lib/x86_64-linux-gnu/libEGL.so.1',
+    '/usr/lib/libEGL.so.1']
     .find(p => fs.existsSync(p))
-  if (systemEgl) vars.push(`LD_PRELOAD=${systemEgl}`)
+  if (systemEgl && !fromNix) vars.push(`LD_PRELOAD=${systemEgl}`)
 
   const waylandDisplay = getWaylandDisplay()
   if (waylandDisplay) vars.push(`WAYLAND_DISPLAY=${waylandDisplay}`)

+ 15 - 1
src/main/services/steam.service.ts

@@ -1,3 +1,4 @@
+import { execFileSync } from 'child_process'
 import * as fs from 'fs'
 import * as os from 'os'
 import * as path from 'path'
@@ -7,6 +8,7 @@ import { WE_APP_ID, STANDALONE_APP_ID } from '@shared/constants'
 import type { DownloadProgressEvent, WorkshopAuthorInfo } from '@shared/types'
 import { getSteamIdentity } from './config.service'
 import { encodeBigInts, decodeBigInts, type SteamHostResponse } from '../steam-host-protocol'
+import { hostCommand, isFlatpak } from '../utils/flatpak'
 
 // Steam counts a process that called SteamAPI_Init as a running game, which also breaks Steam
 // Game Recording. Like WE's ui32.exe, the connection only lives while the window is shown.
@@ -32,9 +34,21 @@ const STEAM_PID_FILES = [
 const PROCESS_CHECK_TTL_MS = 5000
 let processCheck = { at: 0, alive: false }
 
-// Flatpak Steam writes a pid from its own namespace, hence the /proc scan fallback
+// Flatpak Steam writes a pid from its own namespace, hence the /proc scan fallback (the host is asked from our own Flatpak)
 function steamProcessAlive(): boolean {
   if (Date.now() - processCheck.at < PROCESS_CHECK_TTL_MS) return processCheck.alive
+  if (isFlatpak()) {
+    let hostAlive = false
+    try {
+      const [file, args] = hostCommand('pgrep', ['-x', 'steam'])
+      execFileSync(file, args, { stdio: 'ignore', timeout: 5000 })
+      hostAlive = true
+    } catch {
+      hostAlive = false
+    }
+    processCheck = { at: Date.now(), alive: hostAlive }
+    return hostAlive
+  }
   let alive = false
   for (const file of STEAM_PID_FILES) {
     try {

+ 20 - 19
src/main/services/wallpaper.service.ts

@@ -3,7 +3,8 @@ import { promisify } from 'util'
 import * as os from 'os'
 import * as fs from 'fs'
 import * as path from 'path'
-import { detectDisplayServer, detectDesktopEnv, isCommandAvailable } from '../utils/platform'
+import { detectDisplayServer, detectDesktopEnv } from '../utils/platform'
+import { hostCommand, isHostCommandAvailable } from '../utils/flatpak'
 import type { ScreenTarget, WallpaperBackend, WallpaperEnvironment, WallpaperMeta } from '@shared/types'
 import { getLweStatus, launchLweAsync, type LweLaunchOptions } from './lwe.service'
 import { ensureDependencyInstalled } from './dependency.service'
@@ -40,12 +41,12 @@ export function detectEnvironment(): WallpaperEnvironment {
   } else if (platform === 'darwin') {
     available.push('macos')
   } else {
-    if (isCommandAvailable('swww')) available.push('swww')
-    if (isCommandAvailable('swaybg')) available.push('swaybg')
-    if (isCommandAvailable('feh')) available.push('feh')
-    if (isCommandAvailable('xwallpaper')) available.push('xwallpaper')
+    if (isHostCommandAvailable('swww')) available.push('swww')
+    if (isHostCommandAvailable('swaybg')) available.push('swaybg')
+    if (isHostCommandAvailable('feh')) available.push('feh')
+    if (isHostCommandAvailable('xwallpaper')) available.push('xwallpaper')
     if (desktopEnv === 'gnome') available.push('gsettings')
-    if (desktopEnv === 'kde' && isCommandAvailable('qdbus')) available.push('qdbus')
+    if (desktopEnv === 'kde' && isHostCommandAvailable('qdbus')) available.push('qdbus')
   }
 
   let recommended: WallpaperBackend = 'auto'
@@ -97,39 +98,39 @@ async function applyLinux(imagePath: string, preferredBackend?: WallpaperBackend
 function pickLinuxBackend(): WallpaperBackend | null {
   const de = detectDesktopEnv()
   if (de === 'gnome') return 'gsettings'
-  if (de === 'kde' && isCommandAvailable('qdbus')) return 'qdbus'
+  if (de === 'kde' && isHostCommandAvailable('qdbus')) return 'qdbus'
 
   if (detectDisplayServer() === 'wayland') {
-    if (isCommandAvailable('swww')) return 'swww'
-    if (isCommandAvailable('swaybg')) return 'swaybg'
+    if (isHostCommandAvailable('swww')) return 'swww'
+    if (isHostCommandAvailable('swaybg')) return 'swaybg'
   }
 
-  if (isCommandAvailable('feh')) return 'feh'
-  if (isCommandAvailable('xwallpaper')) return 'xwallpaper'
+  if (isHostCommandAvailable('feh')) return 'feh'
+  if (isHostCommandAvailable('xwallpaper')) return 'xwallpaper'
   return null
 }
 
 async function applyWithBackend(backend: WallpaperBackend, imagePath: string): Promise<void> {
   switch (backend) {
     case 'swww':
-      await execFileAsync('swww', ['img', imagePath, '--transition-type', 'fade'])
+      await execFileAsync(...hostCommand('swww', ['img', imagePath, '--transition-type', 'fade']))
       break
     case 'swaybg':
-      await execFileAsync('swaybg', ['-i', imagePath, '-m', 'fill'])
+      await execFileAsync(...hostCommand('swaybg', ['-i', imagePath, '-m', 'fill']))
       break
     case 'feh':
-      await execFileAsync('feh', ['--bg-fill', imagePath])
+      await execFileAsync(...hostCommand('feh', ['--bg-fill', imagePath]))
       break
     case 'xwallpaper':
-      await execFileAsync('xwallpaper', ['--zoom', imagePath])
+      await execFileAsync(...hostCommand('xwallpaper', ['--zoom', imagePath]))
       break
     case 'gsettings':
-      await execFileAsync('gsettings', [
+      await execFileAsync(...hostCommand('gsettings', [
         'set',
         'org.gnome.desktop.background',
         'picture-uri',
         `file://${imagePath}`
-      ])
+      ]))
       break
     case 'qdbus': {
       const script = `
@@ -141,12 +142,12 @@ async function applyWithBackend(backend: WallpaperBackend, imagePath: string): P
           d.writeConfig('Image', 'file://${imagePath}');
         }
       `
-      await execFileAsync('qdbus', [
+      await execFileAsync(...hostCommand('qdbus', [
         'org.kde.plasmashell',
         '/PlasmaShell',
         'org.kde.PlasmaShell.evaluateScript',
         script
-      ])
+      ]))
       break
     }
     case 'windows':

+ 31 - 0
src/main/utils/flatpak.test.ts

@@ -0,0 +1,31 @@
+import { afterEach, describe, expect, it, vi } from 'vitest'
+
+const savedId = process.env.FLATPAK_ID
+
+async function load(flatpakId?: string): Promise<typeof import('./flatpak')> {
+  vi.resetModules()
+  if (flatpakId) process.env.FLATPAK_ID = flatpakId
+  else delete process.env.FLATPAK_ID
+  return import('./flatpak')
+}
+
+afterEach(() => {
+  if (savedId) process.env.FLATPAK_ID = savedId
+  else delete process.env.FLATPAK_ID
+})
+
+describe('hostCommand', () => {
+  it('runs the program itself outside a Flatpak', async () => {
+    const { hostCommand, hostShell, isFlatpak } = await load()
+    expect(isFlatpak()).toBe(false)
+    expect(hostCommand('kscreen-doctor', ['--outputs'])).toEqual(['kscreen-doctor', ['--outputs']])
+    expect(hostShell('xrandr --query 2>/dev/null')).toBe('xrandr --query 2>/dev/null')
+  })
+
+  it('goes through flatpak-spawn inside one', async () => {
+    const { hostCommand, hostShell, isFlatpak } = await load('io.github.WallpaperEngineLover.we_manager')
+    expect(isFlatpak()).toBe(true)
+    expect(hostCommand('qdbus', ['org.kde.plasmashell'])).toEqual(['flatpak-spawn', ['--host', 'qdbus', 'org.kde.plasmashell']])
+    expect(hostShell('wlr-randr 2>/dev/null')).toBe('flatpak-spawn --host sh -c "wlr-randr 2>/dev/null"')
+  })
+})

+ 38 - 0
src/main/utils/flatpak.ts

@@ -0,0 +1,38 @@
+import { execFileSync } from 'child_process'
+import * as fs from 'fs'
+
+let inside: boolean | undefined
+
+/** True when the app runs inside a Flatpak sandbox */
+export function isFlatpak(): boolean {
+  inside ??= !!process.env.FLATPAK_ID || fs.existsSync('/.flatpak-info')
+  return inside
+}
+
+/** Command and arguments that run a program of the host system, through flatpak-spawn inside a Flatpak */
+export function hostCommand(cmd: string, args: string[] = []): [string, string[]] {
+  return isFlatpak() ? ['flatpak-spawn', ['--host', cmd, ...args]] : [cmd, args]
+}
+
+/** The same for a shell command line */
+export function hostShell(command: string): string {
+  return isFlatpak() ? `flatpak-spawn --host sh -c ${JSON.stringify(command)}` : command
+}
+
+const hostCommandCache = new Map<string, boolean>()
+
+/** Whether the host has the program */
+export function isHostCommandAvailable(cmd: string): boolean {
+  const cached = hostCommandCache.get(cmd)
+  if (cached !== undefined) return cached
+  let found = false
+  try {
+    const [file, args] = hostCommand('sh', ['-c', `command -v ${JSON.stringify(cmd)}`])
+    execFileSync(file, args, { stdio: 'ignore', timeout: 5000 })
+    found = true
+  } catch {
+    found = false
+  }
+  hostCommandCache.set(cmd, found)
+  return found
+}

+ 12 - 4
src/main/utils/paths.ts

@@ -22,13 +22,21 @@ export function getExtraLibraryRoots(): string[] {
   return roots
 }
 
+/** Where Steam keeps its own library on Linux: native, Flatpak Steam, Snap */
+export function getSteamRoots(): string[] {
+  const home = os.homedir()
+  return [
+    path.join(home, '.steam', 'steam'),
+    path.join(home, '.local', 'share', 'Steam'),
+    path.join(home, '.var', 'app', 'com.valvesoftware.Steam', '.local', 'share', 'Steam'),
+    path.join(home, 'snap', 'steam', 'common', '.local', 'share', 'Steam')
+  ]
+}
+
 export function getDefaultWorkshopPath(): string {
   const home = os.homedir()
   if (process.platform === 'linux') {
-    const candidates = [
-      path.join(home, '.steam', 'steam', 'steamapps', 'workshop', 'content', String(WE_APP_ID)),
-      path.join(home, '.local', 'share', 'Steam', 'steamapps', 'workshop', 'content', String(WE_APP_ID))
-    ]
+    const candidates = getSteamRoots().map((root) => path.join(root, 'steamapps', 'workshop', 'content', String(WE_APP_ID)))
     return candidates.find((p) => fs.existsSync(p)) ?? candidates[0]
   }
   if (process.platform === 'win32') {

+ 5 - 4
src/main/utils/platform.ts

@@ -1,4 +1,5 @@
 import { execSync } from 'child_process'
+import { hostShell } from './flatpak'
 
 export type DisplayServer = 'wayland' | 'x11' | 'unknown'
 export type DesktopEnvironment = 'gnome' | 'kde' | 'hyprland' | 'sway' | 'other'
@@ -55,7 +56,7 @@ export function getConnectedScreens(): string[] {
   if (isWayland) {
     // wlr-randr (wlroots compositors: hyprland, sway, etc.)
     try {
-      const output = execSync('wlr-randr 2>/dev/null', { encoding: 'utf8', timeout: 5000 })
+      const output = execSync(hostShell('wlr-randr 2>/dev/null'), { encoding: 'utf8', timeout: 5000 })
       const screens = output
         .split('\n')
         .filter(line => /^[A-Za-z]/.test(line) && !line.startsWith(' '))
@@ -66,7 +67,7 @@ export function getConnectedScreens(): string[] {
 
     // KDE Plasma Wayland: kscreen-doctor
     try {
-      const output = execSync('kscreen-doctor --outputs 2>/dev/null', { encoding: 'utf8', timeout: 5000 })
+      const output = execSync(hostShell('kscreen-doctor --outputs 2>/dev/null'), { encoding: 'utf8', timeout: 5000 })
       // Strip ANSI color/escape codes before parsing
       const clean = output.replace(/\x1b\[[0-9;]*m/g, '')
       const screens = clean
@@ -82,7 +83,7 @@ export function getConnectedScreens(): string[] {
     // GNOME Wayland: gnome-randr or mutter output names via gdbus
     try {
       const output = execSync(
-        "gdbus call --session --dest org.gnome.Mutter.DisplayConfig --object-path /org/gnome/Mutter/DisplayConfig --method org.gnome.Mutter.DisplayConfig.GetCurrentState 2>/dev/null",
+        hostShell("gdbus call --session --dest org.gnome.Mutter.DisplayConfig --object-path /org/gnome/Mutter/DisplayConfig --method org.gnome.Mutter.DisplayConfig.GetCurrentState 2>/dev/null"),
         { encoding: 'utf8', timeout: 5000 }
       )
       const screens = [...output.matchAll(/connector:\s*'([^']+)'/gi)].map(m => m[1])
@@ -92,7 +93,7 @@ export function getConnectedScreens(): string[] {
 
   // X11: use xrandr
   try {
-    const output = execSync('xrandr --query 2>/dev/null', { encoding: 'utf8', timeout: 5000 })
+    const output = execSync(hostShell('xrandr --query 2>/dev/null'), { encoding: 'utf8', timeout: 5000 })
     const screens = output
       .split('\n')
       .filter(line => / connected/i.test(line))

+ 15 - 9
src/renderer/src/components/settings/SettingsView.tsx

@@ -47,7 +47,8 @@ export default function SettingsView() {
   const [distro, setDistro] = useState<LinuxDistro | null>(null)
   const [prebuiltTarget, setPrebuiltTarget] = useState<LwePrebuiltTarget | null>(null)
   const [showSourceBuild, setShowSourceBuild] = useState(false)
-  const sourceBuildVisible = showSourceBuild || prebuiltTarget?.supported === false
+  const engineManaged = prebuiltTarget?.managed === true
+  const sourceBuildVisible = !engineManaged && (showSourceBuild || prebuiltTarget?.supported === false)
   const [uninstalling, setUninstalling] = useState(false)
   const [uninstallMsg, setUninstallMsg] = useState<string | null>(null)
   const [killingLwe, setKillingLwe] = useState(false)
@@ -731,6 +732,9 @@ export default function SettingsView() {
                   {lweStatus.path && (
                     <p className="text-xs text-gray-500">Path: {lweStatus.path}</p>
                   )}
+                  {lweStatus.managedBy && !engineManaged && (
+                    <p className="text-xs text-gray-500">Installed by {lweStatus.managedBy}</p>
+                  )}
                 </>
               ) : (
                 <div className="flex items-center gap-2 text-sm text-yellow-400">
@@ -742,7 +746,7 @@ export default function SettingsView() {
               {prebuiltTarget?.supported ? (
                 <p className="text-xs text-gray-500">Prebuilt build: {prebuiltTarget.label}</p>
               ) : prebuiltTarget && (
-                <p className="text-xs text-yellow-500/80">{prebuiltTarget.reason}</p>
+                <p className={`text-xs ${engineManaged ? 'text-gray-500' : 'text-yellow-500/80'}`}>{prebuiltTarget.reason}</p>
               )}
 
               <div className="flex flex-wrap gap-2">
@@ -766,7 +770,7 @@ export default function SettingsView() {
                           : 'Switch to prebuilt build'}
                   </button>
                 )}
-                {lweStatus.installed && (
+                {lweStatus.installed && !engineManaged && !lweStatus.managedBy && (
                   <button
                     onClick={handleUninstallLwe}
                     disabled={isBusy}
@@ -793,12 +797,14 @@ export default function SettingsView() {
             </div>
           )}
 
-          <button
-            onClick={() => setShowSourceBuild(!sourceBuildVisible)}
-            className="mt-4 text-xs text-gray-400 hover:text-gray-200"
-          >
-            {sourceBuildVisible ? '▾' : '▸'} Build from source
-          </button>
+          {!engineManaged && (
+            <button
+              onClick={() => setShowSourceBuild(!sourceBuildVisible)}
+              className="mt-4 text-xs text-gray-400 hover:text-gray-200"
+            >
+              {sourceBuildVisible ? '▾' : '▸'} Build from source
+            </button>
+          )}
 
           {sourceBuildVisible && (
             <div className="mt-2 space-y-2 rounded-lg bg-white/[0.02] p-3">

+ 4 - 0
src/shared/types.ts

@@ -390,6 +390,8 @@ export interface LweStatus {
   installed: boolean
   path?: string
   version?: string
+  /** A package manager owns the binary, it can't be uninstalled here */
+  managedBy?: string
 }
 
 export type LinuxDistro = 'fedora' | 'arch' | 'debian' | 'unknown'
@@ -401,6 +403,8 @@ export interface LwePrebuiltTarget {
   asset?: string
   label?: string
   reason?: string
+  /** The engine comes with the app (Flatpak) */
+  managed?: boolean
 }
 
 export interface LweInstallProgress {