NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
16.43k stars 12.93k forks source link

`libreoffice-qt` requires SAL_USE_VCLPLUGIN to be set to kf5 for KDE Plasma 6 #295015

Open NovaViper opened 3 months ago

NovaViper commented 3 months ago

Describe the bug

With the release of KDE Plasma 6, libreoffice-qt no longer uses the Breeze theme from KDE but instead defaults to the default QT theme (which doesn't match up with the system at all and results in a really bad color clash when using dark themes). As I found here, setting export SAL_USE_VCLPLUGIN=kf5 in the terminal and then running libreoffice from the same terminal session makes libreoffice use the Breeze theme again. This would be a temporary fix until Libreoffice updates to QT6.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Enable Plasma 6 and install libreoffice-qt
  2. Launch libreoffice
  3. Bug occurs

Expected behavior

Libreoffice should be using the Breeze theme that KDE comes with, and when switching between dark and light mode, should also have its theme switched aswell.

Screenshots

Without using the fix image

After applying the fix image

Additional context

Add any other context about the problem here.

Notify maintainers

@raskin

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

❯ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.7.9, NixOS, 24.05 (Uakari), 24.05.20240310.73d699a`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.18.1`
 - nixpkgs: `/nix/store/s7bsyr7jjqask1p6afmsxyfzady49nmk-source`

Add a :+1: reaction to issues you find important.

K900 commented 3 months ago

We can build Libreoffice with the Qt6 plugin, but it's broken in the current stable release, so we just need to wait for the next one.

nixos-discourse commented 1 month ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/libreoffice-standard-gtk-installing-instead-of-libreoffice-qt-on-nixos-unstable/45573/4

nixos-discourse commented 1 month ago

This issue has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/libreoffice-standard-gtk-installing-instead-of-libreoffice-qt-on-nixos-unstable/45573/8

doronbehar commented 1 month ago

We need to investigate why libreoffice won't detect the correct VCLPLUGIN to use? Relevant link:

https://wiki.documentfoundation.org/Development/Environment_variables

Perhaps we should also modify the libreoffice/wrapper.nix to include that variable, if kdeIntegration is set. Possible patch to apply:

diff --git i/pkgs/applications/office/libreoffice/wrapper.nix w/pkgs/applications/office/libreoffice/wrapper.nix
index 013a2ee5575e..fa433c7714da 100644
--- i/pkgs/applications/office/libreoffice/wrapper.nix
+++ w/pkgs/applications/office/libreoffice/wrapper.nix
@@ -18,6 +18,7 @@
 # Configuration options for the wrapper
 , extraMakeWrapperArgs ? []
 , dbusVerify ? stdenv.isLinux
+, vcplugin ? null
 , dbus
 }:

@@ -25,6 +26,17 @@ let
   inherit (unwrapped) version;
   major = lib.versions.major version;
   minor = lib.versions.minor version;
+  vcplugin' = if builtins.isNull vcplugin then
+    if unwrapped.kdeIntegration then
+      "KF5"
+    else
+      null
+  else
+    if builtins.isString vcplugin then
+      vcplugin
+    else
+      throw "vcplugin argument of libreoffice wrapper is not a string"
+  ;

   makeWrapperArgs = builtins.concatStringsSep " " ([
     "--set" "GDK_PIXBUF_MODULE_FILE" "${librsvg}/${gdk-pixbuf.moduleDir}.cache"
@@ -36,6 +48,8 @@ let
     "--prefix" "GST_PLUGIN_SYSTEM_PATH_1_0" ":"
       "${lib.makeSearchPath "lib/girepository-1.0" unwrapped.gst_packages}"
     "--suffix" "PATH" ":" "${lib.makeBinPath [ coreutils gnugrep ]}"
+  ] ++ lib.optionals (builtins.isString vcplugin') [
+    "--set" "SAL_USE_VCLPLUGIN" vcplugin'
   ] ++ lib.optionals unwrapped.kdeIntegration [
     "--prefix" "QT_PLUGIN_PATH" ":" "${
       lib.makeSearchPath