Skip to content

Instantly share code, notes, and snippets.

@siddhpant
Last active March 25, 2022 12:14
Show Gist options
  • Save siddhpant/a2fb56b3aeb1274fcc293467508f2175 to your computer and use it in GitHub Desktop.
Save siddhpant/a2fb56b3aeb1274fcc293467508f2175 to your computer and use it in GitHub Desktop.
Force light theme on Libreoffice
#!/bin/bash
# Exit when any command fails
set -e
# Check for sudo/root
if [ "$EUID" -ne 0 ]
then echo "Run this script with superuser privileges!"
echo "This is because it needs access to /usr/lib/libreoffice/program/soffice"
exit 1
fi
# Make backup
echo "Moving previous config to /usr/lib/libreoffice/program/soffice.bak"
mv /usr/lib/libreoffice/program/soffice /usr/lib/libreoffice/program/soffice.bak
# Append the string
sed -e '/export LC_ALL/a\' -e '\n# Force Adwaita light theme\nexport GTK_THEME=Adwaita:light' /usr/lib/libreoffice/program/soffice.bak > /usr/lib/libreoffice/program/soffice
# Copy perms from original file
sudo chmod --reference=/usr/lib/libreoffice/program/soffice.bak /usr/lib/libreoffice/program/soffice
sudo chown --reference=/usr/lib/libreoffice/program/soffice.bak /usr/lib/libreoffice/program/soffice
# Yay!
echo "Done! If you encounter any problems, restore from the previous config."
@siddhpant
Copy link
Author

You must run this everytime libreoffice is updated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment