5

Since I upgraded to Ubuntu 18.04, Okular doesn't follow the Adwaita-dark or Arc themes when I set them with the Gnome tweak tool. Is there any way to fix this? All I really want is for Okular to use dark colors for its menus and toolbars.

Edit: When I try

GTK2_RC_FILES=Adwaita:dark okular

from the terminal, I get a bunch of errors like

(okular:16699): Gtk-WARNING **: 22:58:15.581: Theme parsing error: gtk.css:137:54: Using one color stop with linear-gradient() is deprecated.
(okular:16699): Gtk-WARNING **: 22:58:15.587: Theme parsing error: gtk.css:1839:9: Expected a string.
(okular:16699): Gtk-WARNING **: 22:58:15.590: Theme parsing error: gtk.css:2913:17: Using Pango syntax for the font: style property is deprecated; please use CSS syntax

I've also tried downloading systemsettings and kde-config-gtk-style and activating the themes there, with no response.

  • 2
    You may want to read something like https://wiki.archlinux.org/index.php/Uniform_look_for_Qt_and_GTK_applications because Okular is a qt application. – DK Bose Jun 07 '18 at 03:34
  • @DKBose Thanks, I tried looking it over. I was at least able to get some errors at the terminal. It seems like the themes haven't adapted to the latest version of gtk. –  Jun 07 '18 at 04:20

1 Answers1

7

What worked for me was:

sudo apt-get install qt5-style-plugins

This is taken from the ArchLinux documentation. It also recommends setting the QT_QPA_PLATFORMTHEME=gtk2 environment variable, but I did not need that.

See also this other AskUbuntu question, this solution applies to all KDE applications.

  • Perfect, thank you. Both were necessary for me. –  Jun 07 '18 at 15:32
  • 5
    I had to add the environment variable to /etc/environment rather than .bashrc for this to work. – stebu92 Dec 20 '18 at 16:01
  • Does not change a thing. Are you sure the KDE applications are taking settings from that application? – Luís de Sousa Sep 24 '19 at 06:39
  • 2
    This works on Debian + i3 too ! I had to set the QT_QPA_PLATFORMTHEME=gtk2 but without reboot I don't think it has an effect. To make sure this works, just run QT_QPA_PLATFORMTHEME=gtk2 okular from a terminal and if it's your theme you're good ! When the user successfully logs in [...] PAM may instruct the DM to read the variables from /etc/environment. src – Samuel Prevost Aug 08 '20 at 20:53
  • Works on Fedora as well, but the package name there is qt5-qtstyleplugins – nico Nov 18 '21 at 10:04
  • This worked for me to make @SamuelPrevost's suggestion in comments permanent, Ubuntu 22.04LTS. – jay.sf Oct 04 '22 at 06:54