fix(kodi): patch stremio CEF to support HiDPI scaling via env var
CI / check (push) Failing after 12m18s
CI / build-and-cache (push) Has been skipped
CI / Check OpenClaw Changes (push) Has been skipped
CI / Build & Push OpenClaw Image (push) Has been skipped

The beta.13 clap parser ignores unknown --force-device-scale-factor flags
and CEF Args::new() starts empty, so CLI flags never reach the CEF subprocess.
Patch src/webview/mod.rs to read STREMIO_FORCE_DEVICE_SCALE_FACTOR and pass
it to CEF via append_switch_with_value. Remove failed GTK4/master branch
build attempt (requires GTK 4.22 not yet in nixpkgs).
This commit is contained in:
2026-05-12 08:48:50 -07:00
parent 71685f9419
commit da21505667
6 changed files with 71 additions and 160 deletions
@@ -1,27 +0,0 @@
# This file documents the approach taken to build stremio-linux-shell
# from master branch with a Rust version compatible with nixpkgs nixos-25.11
# Approach: Create a patched version of Cargo.toml with older dependencies
# that are compatible with Rust 1.91
# The master branch currently (261f46f) requires:
# - gtk4 0.11.3 (requires Rust 1.92)
# - libadwaita 0.9.1 (requires Rust 1.92)
# - webkit6 0.6.1 (requires Rust 1.92)
# We need to pin these to older versions that work with Rust 1.91:
# - gtk4 0.11.2 (last version before 1.92 requirement)
# - libadwaita 0.9.0
# - webkit6 0.6.0
# However, this requires patching Cargo.toml, which is complex.
# The cleaner solution is to use nixpkgs-unstable which has Rust 1.94+.
# Currently, the flake.nix overlays use nixpkgs-unstable for stremio-linux-shell
# which should work, but there are native build dependencies that need to be installed.
# Build dependencies needed for native GTK4 build:
# - pkg-config (for finding libraries)
# - glib, cairo, pango, gdk-pixbuf (buildInputs)
# - wrapGAppsHook4 (for GTK4 wrapping)
# - nodejs (for server.js)
-100
View File
@@ -1,100 +0,0 @@
{
lib,
rustPlatform,
fetchFromGitHub,
pkg-config,
wrapGAppsHook4,
nodejs,
libepoxy,
mpv,
gtk4,
libadwaita,
webkitgtk_6_0,
atk,
glib,
cairo,
pango,
gdk-pixbuf,
libsoup_3,
libnotify,
libsecret,
}:
let
src = fetchFromGitHub {
owner = "Stremio";
repo = "stremio-linux-shell";
rev = "261f46fdf155c9352bd1b2a8ce1ee232b36c9286";
hash = "sha256-7kfUUjqXIXL1TrSse2AKCjGXHWKcTrDEeXtsFpIiKHc=";
};
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "stremio-linux-shell";
version = "1.0.0-beta.13.master";
src = src;
cargoHash = "sha256-yqrPtvF59ii/UTHAcCa9DDqTe6czG722mxzCPB6UoG0=";
nativeBuildInputs = [
pkg-config
wrapGAppsHook4
nodejs
];
buildInputs = [
libepoxy
mpv
gtk4
libadwaita
webkitgtk_6_0
atk
glib
cairo
pango
gdk-pixbuf
libsoup_3
libnotify
libsecret
];
env.GETTEXT_DIR = "${src}/po";
env.GETTEXT_DOMAIN = "stremio";
env.SERVER_PATH = "\${out}/share/stremio/server.js";
postInstall = ''
mkdir -p $out/share/applications
cp data/com.stremio.Stremio.desktop $out/share/applications/com.stremio.Stremio.desktop
mkdir -p $out/share/metainfo
cp data/com.stremio.Stremio.metainfo.xml $out/share/metainfo/com.stremio.Stremio.metainfo.xml
mkdir -p $out/share/dbus-1/services
cp data/com.stremio.Stremio.service $out/share/dbus-1/services/com.stremio.Stremio.service
mkdir -p $out/share/icons/hicolor/128x128/apps
cp data/icons/com.stremio.Stremio.svg $out/share/icons/hicolor/128x128/apps/com.stremio.Stremio.svg
mkdir -p $out/share/stremio
cp data/server.js $out/share/stremio/server.js
mv $out/bin/stremio-linux-shell $out/bin/stremio
'';
meta = {
description = "Stremio Linux Shell - Freedom to Stream (GTK4/libadwaita/WebKitGTK master branch)";
longDescription = ''
Stremio Linux Shell - a modern, GTK4/libadwaita-based media center client.
This version uses WebKitGTK instead of CEF/winit from the beta.13 version.
Note: This is built from the master branch which is a complete rewrite.
Requires Rust 1.92+ to build due to GTK4 0.11.3 dependencies.
'';
homepage = "https://stremio.com";
sourceProvenance = [ lib.sourceTypes.fromSource ];
license = lib.licenses.gpl3Only;
maintainers = with lib.maintainers; [ ];
platforms = [ "x86_64-linux" "aarch64-linux" ];
mainProgram = "stremio";
};
})
@@ -0,0 +1,20 @@
--- a/src/webview/mod.rs 2026-05-11 22:00:57.261117297 -0700
+++ b/src/webview/mod.rs 2026-05-11 22:09:44.824475918 -0700
@@ -56,6 +56,17 @@
let args = Args::new();
+
+ // Pass --force-device-scale-factor to CEF if the environment variable is set.
+ // This is the standard Chromium flag for HiDPI display scaling.
+ if let Ok(scale) = std::env::var("STREMIO_FORCE_DEVICE_SCALE_FACTOR") {
+ if let Some(cmd) = args.as_cmd_line() {
+ cmd.append_switch_with_value(
+ Some(&CefString::from("force-device-scale-factor")),
+ Some(&CefString::from(scale.as_str())),
+ );
+ }
+ }
let (sender, receiver) = unbounded::<WebViewEvent>();
SENDER.get_or_init(|| sender);