Use Kvantum on Linux to use custom themes for Qt applications (and fix Qt5 themes on GNOME)

Some Qt applications look out of place in Gnome (and other Gtk-based desktop environments). In order to be able to choose the themes used by Qt applications on Linux systems, make some settings and better integrate with Gnome/Gtk, you can Kwantum try it. This is the SVG-based theme engine for Qt4 and Qt5, KDE and LXQt.
Using it, you can not only set Qt4 and Qt5 themes to almost match your current Gtk theme (as long as your current Gtk theme has a Kvantum theme available), but you can also configure some settings related to Qt themes.

The idea behind Kvantum-use SVG images to style Qt widgets-from QuantumStyle, no longer developed, but with the QSvgStyle. I found QSvgStyle to be more difficult to use than Kvantum because it only comes with a built-in theme.

kvantum active theme configuration settings
Kvantum event theme configuration
kvantum active theme configuration settings
Kvantum event theme configuration

In addition to allowing you to change Qt 4 and Qt 5 styles, Kvantum also has the following features:

  • Built-in Kvantum themes, such as Adapta (and Dark), Ambiance, Ark (and Dark variants), Ubuntu Communitheme/Yaru, Gnome, Oxygen, Simplicity, etc. (a total of 30 themes)
  • Allow installation of additional Kvantum themes
  • Configure active themes: set toolbar button styles, change UI icons and button sizes, enable or disable composite effects or translucent windows, respect dark theme options, completely remove icons from the menu, etc.
  • Assign themes to specific applications
  • A preview tool is provided, which is somewhat similar to the gtk3-widget-factory tool, so you can view the current Kvantum theme and the modifications you have made

This is Kvantum, which contains some popular themes, such as Ambiance, Communitheme and the default Gnome (Adwaita) theme:Kwantum atmosphereKe WantongKvantum Gnome AdwaitaIt is worth mentioning that Kvantum and other similar tools cannot change the Qt theme of applications installed from Snap, Flatpak or AppImage binaries.

Install and use Kvantum

You can find Kvantum installation instructions for some Linux distributions. Here. On Fedora, you can install Kvantum from the repository using the following methods:

sudo dnf install kvantum

Arch Linux / Manjaro users can install Kvantum in the following ways:

sudo pacman -S kvantum-qt5

Solvant OS also has Kvantum in its repository. You can install it using the following command:

sudo eopkg install kvantum

Ubuntu 20.04, 19.10 and 19.04 / Debian Buster and higher: Starting from Ubuntu 19.04 (Disco Dingo) / Debian Buster, Kvantum is available in the official Ubuntu repository. So if you use Ubuntu 20.04, 19.10, 19.04, Pop! _OS 20.04, 19.10 or 19.04 or Debian Buster and later, you can install Kvantum from the repository using the following methods:

sudo apt install qt5-style-kvantum qt5-style-kvantum-themes

Users who want to install Kvantum in a simple way can use Ubuntu 18.04 and Linux Mint 19. * (And other Ubuntu-based Linux distributions, such as Elementary OS 5 or Pop!_OS 18.04) to use PPA. PPA also provides updated Kvantum packages for Ubuntu 19.10 or 19.04. Add it and install Kvantum using the following command:

sudo add-apt-repository ppa:papirus/papirus
sudo apt update
sudo apt install qt5-style-kvantum qt5-style-kvantum-themes

You can also build Kvantum from source code. To install the latest Kvantum from source in Debian, Ubuntu or Linux Mint (any version), you can compile from source. To do this, follow the steps below. step 1: download Latest source of Kvantum
You can Download the latest Kvantum Publish, or get the latest Kvantum code through Git:

git clone https://github.com/tsujan/Kvantum

Step 2: Install build dependencies

sudo apt install g++ cmake libx11-dev libxext-dev qtbase5-dev libqt5svg5-dev libqt5x11extras5-dev libqt4-dev qttools5-dev-tools libkf5windowsystem-dev

Step 3: Compile Kvantum
Navigate to the folder where the Kvantum source (or clone Git repository) was extracted from the terminal (use cd /path/to/folder) And use the following command to compile the application:

mkdir build && cd build
cmake ..
make

Step 4: Install Kvantum
To install Kvantum, run the following command (in the same folder):

sudo make install

This will build and install Kvantum for Qt 5, which is enough because most applications today use Qt 5. If you want to build it for Qt4, use the same instructions as above, but add -DENABLE_QT4=ON after that cmake .. The command in step 3.

Get the Qt5 application to use Kvantum

No matter how you install Kvantum, you need to export it to be able to use it on a GTK-based desktop computer QT_STYLE_OVERRIDE=kvantum. You can add this to your ~/.profile By running the following command:

echo "export QT_STYLE_OVERRIDE=kvantum" >> ~/.profile

After that, log out and log in again. To apply Kvantum system-wide (not limited to your users), you can add export QT_STYLE_OVERRIDE=kvantum In /etc/environment Instead ~/.profile.
For desktop environments like KDE and LXQt, it is much easier to use Kvantum-choose Kvantum under Widget Style and Color Scheme, that’s all.
Now all you have to do is run Kvantum and select the theme you want to use, then adjust the settings as needed.

How to remove Kvantum completely

If you want to uninstall Kvantum installed from source code, please open the terminal first, and then navigate to the folder you extracted (in build Folder from Kvantum/Kvantum Directory (if you have followed our instructions) and built the source code-for example cd Kvantum/Kvantum/buildAnd then run the following command:

sudo make uninstall

If you have installed Kvantum from the repository, just use the Linux distribution’s package manager to remove it.
No matter which Kvantum installation method is used, the export file needs to be deleted QT_STYLE_OVERRIDE=kvantum Your line ~/.profile file. For this, please open ~/.profile Use a text editor, such as Gedit:

gedit ~/.profile

And delete QT_STYLE_OVERRIDE=kvantum OK from this file, then save it, log out and log in again.

Source

Sidebar