Libreoffice enviromental variables GTK Theme

After a few hours of googeling I could not find a permanent solution for the appearance of libreoffice. Libreoffice does pickup the dark theme of my OS, which has not a great readability. So I was searching for a solution. When I execute libreoffice via terminal with the command:

sudo GTK_THEME=Breeze libreoffice --calc

Which gives me the libreoffice I would prefer.

I don’t want to write the command every time, so I added the environmental variables to
Which does not have an effect on libreoffice it is just using the dark theme from the OS.
Only when I execute the command

sudo libreoffice --calc 

I can see a change, but the text in the first line is invisible, except when I hover over it with the mouse and the lines between the fields are black. (If i open the screenshot app the text becomes visible)

Why are the added env variables are not taking effect without sudo, and why is the first command so different from the others? How do I get the result from the first one?

You shouldn’t be running libreoffice with sudo. In addition to being a generally bad idea, it will make your theming more complicated.

Try getting things to match without sudo.

You should also go through your home directory and make sure nothing it owned by root.


Ok, thank you. I checked, libreoffice-calc.desktop, it is not on root level. I tried sudo, because nothing else made any change, but you are right I still have a lot to learn and I would also be happier without root.

Is changing your system theme temporarily to a light theme out of the question?

Your are right it would be a simple solution, but if there is a permanent way with env variables, i would prefer it.

1 Like

There is a simple and permanent solution, but on my system it looks awful when I do it.

Tools > Options > Personalisation > Preinstalled Themes

If it works for you, then great! It’s poorly implemented on my system. :person_shrugging:

I am guessing this worked because your root user does not have a GTK theme set. That is to say, what you actually want to do is unset the GTK theme.

Give this a try:

GTK_THEME="" libreoffice --calc

That is a good strategy, however make sure you set it in ~/.local/share/applications instead of /usr/share/applications or it will be overwritten on every update.

Create the directory first if it does not exist:

mkdir -p ~/.local/share/applications/

Copy over the desktop file:

cp /usr/share/applications/libreoffice-calc.desktop ~/.local/share/applications/libreoffice-calc.desktop

Open it up with your editor and change the Exec= line so it looks like this:

Exec=env GTK_THEME="" libreoffice --calc

It does look bad on my system to.

I am sorry I forgot some information.

I added Exec=env GTK_THEME=Breeze..... to .local/applications/libreoffice-calc.desktop, but this does not have any effect, only when I execute the .desktop file with root permissions, as shown above, i get the black lines and the invisible text.

I will try the empty quotes when i am back from work, i will copy the entry of the files maybe i have a misspelling

How are you testing this? Running libreoffice from the CLI it doesn’t use the desktop.

That is an entry of the libreoffice-calc.desktop in the .lcoal/… directory.

[Desktop Action NewDocument]
Exec=libreoffice --calc
Name[en_GB]=New Spreadsheet
Name=New Spreadsheet

[Desktop Entry]
Comment[en_GB]=Perform calculations, analyze information and manage lists in spreadsheets.
Comment=Perform calculations, analyze information and manage lists in spreadsheets.
Exec=env GTK_THEME=Breeze libreoffice --calc
Keywords=Accounting;Stats;OpenDocument Spreadsheet;Chart;Microsoft Excel;Microsoft Works;OpenOffice Calc;ods;xls;xlsx;
Name[en_GB]=LibreOffice Calc
Name=LibreOffice Calc

You are right.

sudo libreoffice --calc

Does not care about the Environmental variables.

Maybe I haven’t set up my system incorrectly, it seems as if it does not care about the .local directories.

Just to clarify a couple points:

  • If you launch the application from the command line, it bypasses the .desktop file and just runs the binary. The .desktop files are typically used by application launchers and that sort of thing. From the command line you would need to manually specify the environment variables you want if they are different than the defaults.
  • The ~/.local directory is specific to your user. Other users on the machine (including root, for example if you run a command with sudo) do not use these files. They will have their own respective ~/.local directories.

Did you try launching the application with GTK_THEME unset?

That is something I did not know. I always thought clicking on the icon and starting the program is the same as typing the name in the command line.
sudo is a different user than my user and has different directories, that is something I did know. But I did not know that it does not have a GTK-Theme connected to it.

I tried the empty GTK_THEME=“”, but no change, still the same black theme

In that case you are providing a theme to this application through something else besides this environment variable.

Perhaps you have settings in your config directory (for example, ~/.config/gtk-3.0/settings.ini, and so on) that are being applied, or you have a theme engine or similar which has added settings somewhere. Test by creating a new user, log in as them, and see how the application looks when the new user opens it.

1 Like

It should, that’s how I fixed the theme problem of a gtk4 application, I modified the desktop file in the .local/share/applications directory :

Exec=env GTK_THEME=Rose-Pine gnote %u

There is a line gtk-application-prefer-dark-theme=true if I change it to false and log out and back in, the value is back to true. So I guess there is something above overruling my edit.

I created a new user and used the Breeze Global Theme, so libreoffice is light but the same problem environmental variables are ignored.

I use Endeavoruos with the KDE Plasma desktop maybe the problem is coming from there

Libreoffice in particular will only sometimes use GTK, and generally doesn’t on Plasma. Does it work if you run env SAL_USE_VCLPLUGIN=gtk3 GTK_THEME="Adwaita" libreoffice
(or replace Adwaita with some other GTK theme you have and prefer)

1 Like

This seems to work, so what is the equivalent for the Breeze theme?

Does env SAL_USE_VCLPLUGIN=gtk3 GTK_THEME=Breeze libreoffice work?

Edit: probably not, it looks like the Breeze GTK theme uses the system color scheme. You would probably need to find a breeze-like GTK theme (e.g., though it’s very old and I don’t know if that’s an issue, or maybe or kvantum theme (e.g., to use with env QT_STYLE_OVERRIDE=kvantum libreoffice).

1 Like

You may need to install breeze-gtk and kde-gtk-config, and change a few settings, to theme a GTK app with Breeze. See this article here for some specific details about that:


Breeze is the default Qt style of KDE Plasma. It can be installed with the breeze package and the breeze-gtk package for GTK 2 and GTK 3.

Once installed, you can use one of the many GTK configuration tools to change the GTK theme.

If running KDE Plasma, install kde-gtk-config, log-out and log-in again, and then go to System Settings > Appearance > Application Style > Configure GNOME/GTK Application Style…. Fonts, icon themes, cursors, and widget styles set in System Settings affect GTK settings automatically; only the GTK theme should be set manually using the previously mentioned module.

No, but this would have been too easy and I guess you are right it is using the system color scheme.

I installed breeze-gtk and with


I get what I wanted.

I still have one question, if Breeze is a Qt style, why is


not working? libreoffice offers support for kf6, gtk3/4, qt5/6, gen, according to or am i missing something?

I have still so much to learn about linux.