You are not logged in.

#1 2024-04-28 19:08:21

BelDot
Member
Registered: 2024-04-28
Posts: 21

[SOLVED] Problems with setting GTK theme

I've been using Arch Linux for a while and I'm pretty good with it. I wanted to change GTK theme to be more appropiate with the general look of the system, but stumbled upon some problems.

For some reason, setting a theme through settings.ini in ~/.config/gtk-3.0 or through lxappearance doesn't change it at all. Setting it with gsettings doesn't do much either. The only way I found to change the theme is by manually changing the environment variable GTK_THEME, which isn't good, because I don't know how to set Arc-Darker for example. I think that settings.ini, gsettings and lxappearance should change this variable automatically, but they don't, and I don't how to fix it.

Also changing font works, but setting to Bold or Italic doesn't work. Other settings as cursor theme, icon theme and some additional settings work as they should.

Last edited by BelDot (2024-04-30 19:00:47)

Offline

#2 2024-04-28 21:31:52

seth
Member
Registered: 2012-09-03
Posts: 52,241

Re: [SOLVED] Problems with setting GTK theme

https://wiki.archlinux.org/title/GTK#GTK_3_and_GTK4
What's actually the relevant client? (nb the " libadwaita-based GTK 4" part)

Online

#3 2024-04-29 11:42:23

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

What do you mean? Are you talking about libadwaita or GTK-4 applications? I use apps that use GTK 3, not GTK 4.

Offline

#4 2024-04-29 15:09:29

seth
Member
Registered: 2012-09-03
Posts: 52,241

Re: [SOLVED] Problems with setting GTK theme

Anything that uses https://archlinux.org/packages/extra/x86_64/libadwaita/ will (afaiu) prevent you from using styles that are not adwaita.
What "apps" specifically? Snap/Flatpak/Docker/s?

Online

#5 2024-04-29 18:45:05

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

I use libreoffice and galculator, both of them are built on GTK-3. Also file dialog in most programs is also built on GTK-3. But when I tried to remove libadwaita, it didn't say that these apps were depending on it, only overskride (which I don't use) and zenity (which is dependency of steam) use libadwaita as a dependency. And I've installed libadwaita-without-adwaita-git, as advised in GTK article, but it didn't help.

Again, the only way for me for now to change the theme is by manually changing the environment variable.

Offline

#6 2024-04-29 22:01:26

seth
Member
Registered: 2012-09-03
Posts: 52,241

Re: [SOLVED] Problems with setting GTK theme

LO is only very limitedly a GTK client, but galculator parses ~/.config/gtk-3.0/settings.ini for me and takes the theme from the "gtk-theme-name" key.
What is your desktop environment/windowmanager and the output of

printenv

Online

#7 2024-04-30 07:28:30

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

I use xmonad as my window manager, no DE. Here's my printenv (I've changed GTK_THEME through .bash_profile script):

SHELL=/usr/bin/bash
WINDOWID=48234505
COLORTERM=rxvt-xpm
GTK_THEME=Arc:dark
GTK_MODULES=canberra-gtk-module
XDG_SEAT=seat0
PWD=/home/BelDot
LOGNAME=BelDot
XDG_SESSION_DESKTOP=xmonad
XDG_SESSION_TYPE=x11
XAUTHORITY=/run/user/1000/lyxauth
QT_STYLE_OVERRIDE=adwaita-dark
MOTD_SHOWN=pam
GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc
HOME=/home/BelDot
LANG=en_US.UTF-8
XDG_SESSION_CLASS=user
TERM=rxvt-unicode-256color
USER=BelDot
COLORFGBG=15;default;0
DISPLAY=:0
SHLVL=1
XDG_VTNR=2
XDG_SESSION_ID=1
XDG_RUNTIME_DIR=/run/user/1000
DEBUGINFOD_URLS=https://debuginfod.archlinux.org 
XDG_DATA_DIRS=/home/BelDot/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share:/usr/share
PATH=/sbin:/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/var/lib/flatpak/exports/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl:/home/BelDot/.cargo/bin
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
MAIL=/var/spool/mail/BelDot
_=/sbin/printenv

Offline

#8 2024-04-30 07:35:40

seth
Member
Registered: 2012-09-03
Posts: 52,241

Re: [SOLVED] Problems with setting GTK theme

The XDG_DATA_DIRS don't affect gtk here and everything else looks utterly unsuspicious

GTK_THEME= strace galculator 2>&1 | grep -i settings
pacman -Qs portal

Online

#9 2024-04-30 07:43:53

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

GTK_THEME=strace galculator 2>&1 | grep -i settings

Doesn't output anything, changing strace with Arc (as I've looked up, I don't have strace theme) doesn't output anything either.

[BelDot@bel ~]$ pacman -Qs portal
local/xdg-desktop-portal 1.18.4-1
    Desktop integration portals for sandboxed apps
local/xdg-desktop-portal-gtk 1.15.1-2
    A backend implementation for xdg-desktop-portal using GTK

Do I need to manually export GTK-3 path to XDG_DATA_DIRS, so it could pick up the theme from ~/.config/gtk-3.0/settings.ini?

Offline

#10 2024-04-30 07:51:19

seth
Member
Registered: 2012-09-03
Posts: 52,241

Re: [SOLVED] Problems with setting GTK theme

The blank between "=" and "strace" is intentional, you want to unset that variable.

Online

#11 2024-04-30 07:57:50

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

Searched for "strace" and understood that it's an utility, not a theme lol. I didn't have it, that's why there was no output.
After installing strace:

[BelDot@bel ~]$ GTK_THEME= strace galculator 2>&1 | grep -i settings
writev(3, [{iov_base="$\0\1\0\20\0\6\0\r\0\0\0_XSETTINGS_S0\0\0\0", iov_len=28}, {iov_base=NULL, iov_len=0}, {iov_base="", iov_len=0}], 3) = 28
access("/usr/share/gtk-3.0/.ini", F_OK) = 0
openat(AT_FDCWD, "/usr/share/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 5
read(5, "[Settings]\ngtk-icon-theme-name ="..., 4096) = 95
access("/etc/gtk-3.0/settings.insettingsi", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/xdg/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)
access("/home/BelDot/.config/gtk-3.0/settings.ini", F_OK) = 0
openat(AT_FDCWD, "/home/BelDot/.config/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 5
read(5, "[Settings]\ngtk-cursor-theme-name"..., 4096) = 476
read(6, "libdconfsettings.so: gsettings-b"..., 150) = 150
newfstatat(AT_FDCWD, "/usr/lib/gio/modules/libdconfsettings.so", {st_mode=S_IFREG|0755, st_size=55248, ...}, 0) = 0
access("/usr/share/themes/Arc-Darker/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)

Offline

#12 2024-04-30 08:23:01

seth
Member
Registered: 2012-09-03
Posts: 52,241

Re: [SOLVED] Problems with setting GTK theme

openat(AT_FDCWD, "/home/BelDot/.config/gtk-3.0/settings.ini", O_RDONLY|O_CLOEXEC) = 5
access("/usr/share/themes/Arc-Darker/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)

It reads your settings ini and afterwards tries to access Arc-Darker (that there's no settings.ini for the theme is pretty normal and not a concern)

The result of the above invocation though was *NOT* that you used galculator w/ the Arc-Darker theme?

GTK_THEME= strace galculator 2>&1 | grep -iE '(settings|themes)'

nb. that "Arc-Darker" is NOT "Arc-Dark" and is NOT a really "dark theme" but one w/ inverted menu- and toolbars etc.
Some parts are gonna be white on black, but the majority is black on white.

Online

#13 2024-04-30 12:02:21

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

Yeah, I forgot that Arc-Darker isn't actually a dark theme. I've decided to unset GTK_THEME and the problem with themes has gone, now I can change them normally.

But I still can't set Bold or Italic font. Is it possible for GTK to override Bold or Italic font over default?

Offline

#14 2024-04-30 14:30:42

seth
Member
Registered: 2012-09-03
Posts: 52,241

Online

#15 2024-04-30 19:00:01

BelDot
Member
Registered: 2024-04-28
Posts: 21

Re: [SOLVED] Problems with setting GTK theme

The topic helped me, thank you very much for help! Will mark it as solved now.
Arch community is the best! smile

Offline

Board footer

Powered by FluxBB