You are not logged in.

#1 2024-05-27 23:08:01

Ghost-Order
Member
Registered: 2019-12-18
Posts: 22

[SOLVED] setting dark theme in gtk3 permanently

I'm trying to set a dark theme to all my gtk3 applications, reading here I understood that I need to create a ~/.config/gtk-3.0/settings.ini file to customize gtk3 at the user level, so I created it and added these 3 lines:

[Settings]
gtk-theme-name = Adwaita:Dark
gtk-application-prefer-dark-theme = true

and then I ran:

gsettings set org.gnome.desktop.interface gtk-theme Adwaita:Dark

However it doesn't work as I would like, it works only if I switch to a tty and manually start a new x session running startx but it doesn't work with my default x session that ligthdm loads for me when I log in, I already tried rebooting and it's the same, I also tried wrapping the theme name in quotes but it doesn't the issue persists

This is a little confusing to me because if I run:

gsettings get org.gnome.desktop.interface Adwaita:Dark

I get the correct theme I'm setting in settings.ini: 'Adwaita:Dark'

So I feel I'm close but I'm lacking some pieces of information.

Last edited by Ghost-Order (2024-05-28 23:12:45)

Offline

#2 2024-05-28 05:11:16

jl2
Member
From: 47° 18' N 8° 34' E
Registered: 2022-06-01
Posts: 1,258

Re: [SOLVED] setting dark theme in gtk3 permanently

The wiki says (I oversaw it multiple times when I had the same issue) :

Note: If not using the according XDG Desktop Portal, you might have to set the environment variable ADW_DISABLE_PORTAL=1 for theme set via GSettings to be picked up. See https://gitlab.gnome.org/GNOME/libadwai … 63f81011ef


Why I run Arch? To "BTW I run Arch" the guy one grade younger.
And to let my siblings and cousins laugh at Arsch Linux...

Upload longer text output like this

Offline

#3 2024-05-28 23:08:46

Ghost-Order
Member
Registered: 2019-12-18
Posts: 22

Re: [SOLVED] setting dark theme in gtk3 permanently

In my case ADW_DISABLE_PORTAL=1 didn't helped but I found the solution.

First I need to found how to tell lightdm about my style config, reading the lightdm page there is precisely a section about my issue, basically I need a couple of files

~/.xprofile
~/.config/zsh/.zshenv

The env variables indicated here:

GTK_THEME=Adwaita:dark
GTK2_RC_FILES=/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc
QT_STYLE_OVERRIDE=Adwaita-Dark

have to be set in the .zshenv file and then inside ~/.xprofile I need to source it:

[ -f ~/.config/zsh/.zshenv ] && . ~/.config/zsh/.zshenv

Just by doing this my gtk3 apps now respect the theme I set, which in this case is Adwaita:Dark

In the case of qt apps some of them (like pcmanfm-qt) respect the QT_STYLE_OVERRIDE=Adwaita-Dark env variable but some others don't like keepassxc and qbitorrent don't, I had to install adwaita-qt5-git and adwaita-qt6-git respectively and also in the case of keepassxc I had to manually go to view > theme > classic(platform-native) for it to apply the just installed theme.

Last edited by Ghost-Order (2024-05-28 23:12:29)

Offline

Board footer

Powered by FluxBB