1
0
mirror of https://github.com/tiyn/wiki.git synced 2025-04-01 14:37:46 +02:00

linux/gtk/qt: added guide to uniform look in qt and gtk

This commit is contained in:
tiyn 2025-03-18 05:29:21 +01:00
parent 269c6abbc5
commit 694a183300
3 changed files with 69 additions and 3 deletions

46
wiki/linux/gtk.md Normal file
View File

@ -0,0 +1,46 @@
# GTK
[GTK](https://gtk.org) is an GUI and widget toolkit.
## Setup
On most linux distributions different GTK versions are installed as a dependency of various
programs that use graphical user interfaces.
### Configurations
GTK has different versions.
For GTK3 and GTK4 configurations can be achieved by creating the file `settings.ini` in the folders
`~/.config/gtk-3.0` and `~/.config/gtk-4.0`.
An example file that enables dark mode, uses the Adwaita theme and sets the default font to
sans-serif of size 12 looks something like the following.
```txt
[Settings]
gtk-application-prefer-dark-theme = true
gtk-icon-theme-name = Adwaita
gtk-font-name = Sans 12
```
For GTK2 an older version of config files has to be used.
The file can be found or created at `~/.config/gtk-2.0/gtkrc-2.0`.
A similar setup to the previous configuration of GTK3 and GTK4 can be achieved by the following.
```txt
gtk-theme-name="AdwaitaDark"
gtk-font-name="Sans 12"
```
#### Achieving a System-Wide Uniform Look
[Qt](/wiki/linux/qt.md) is the other big widget toolkit in use.
An easy way to achieve a uniform look of GTK and Qt is the usage of the Adwaita theme in both
toolkits.
This is also described in the
[official Arch wiki](https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications#Styles_for_both_Qt_and_GTK).
Since it is the default theme on GTK it just has to be set inside as described in the
[configuration section](#configuration).
For setting the same theme for Qt refer to the
[corresponding entry](/wiki/linux/qt.md#achieving-a-system-wide-uniform-look).

View File

@ -8,9 +8,9 @@ It is available for both [X](/wiki/linux/x_window_system.md) and Wayland.
On most linux distributions LightDM can be installed with the `lightdm` package.
Additionally `lightdm-gtk-greeter` and `xorg-server-xephyr` are recommended.
This setup will work with [LightDM-GTK-Greeter](#lightdm-gtk-greeter) which is the default
[greeter](#greeters) but others may be chosen.
If that is the case `lightdm-gtk-greeter` does not have to be installed, but another one.
This setup will work with [LightDM-GTK-Greeter](#lightdm-gtk-greeter) which is the default greeter.
If another greeter is to be chosen `lightdm-gtk-greeter` does not have to be installed, but an
alternative for it.
For a guide on how to set the greeter navigate to the [greeter section](#greeters).
This section will also discuss various other greeters like the
[LightDM-Mini-Greeter](#lightdm-mini-greeter).
@ -67,6 +67,7 @@ If no `greeter-session` is set the default will fall back to the
The [LightDM-GTK-Greeter](https://github.com/Xubuntu/lightdm-gtk-greeter) is the default greeter
for LightDM.
This is the default [greeter](#greeters) of [GTK](/wiki/linux/gtk.md) but others may be chosen.
### LightDM-Mini-Greeter

View File

@ -25,3 +25,22 @@ To make this config apply for all Qt applications the following line needs to be
```sh
export QT_QPA_PLATFORMTHEME="qt6ct"
```
Afterwards `qt6ct` can be used to enable the dark mode or change other configurations.
#### Achieving a System-Wide Uniform Look
[GTK](/wiki/linux/gtk.md) is the other big widget toolkit in use.
An easy way to achieve a uniform look of GTK and Qt is the usage of the Adwaita theme in both
toolkits.
This is also described in the
[official Arch wiki](https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications#Styles_for_both_Qt_and_GTK).
A simple way to achieve this in Qt is the installation of
[adwaita-qt6](https://github.com/FedoraQt/adwaita-qt) which is also available as an
[AUR](/wiki/linux/package_manager.md#installing-an-aur-program-with-a-specific-version) package.
After the installation it can be selected by `qt6ct` as described in the
[configuration section](#configuration).
For setting the same theme for GTK refer to the
[corresponding entry](/wiki/linux/gtk.md#achieving-a-system-wide-uniform-look).