Xfce Forum

Sub domains
 

You are not logged in.

#1 2025-11-28 14:58:17

codemonkey
Member
Registered: 2025-11-28
Posts: 2
LinuxFirefox 145.0

Apps don't follow system theme when using xfconf

Hello,

First of all, thank you for supporting this project, I've used xfce for many years now and I really love it.

I have a script that modifies the system theme using xfconf. It uses the following command:

xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita-dark"

In the past, this would change the theme of various applications like VSCode, Obisidian, and Thunar. However, in the recent months it has stopped working for VSCode and Obsidian (it still works fine for Thunar). Even if I logout and log back in, or reboot my machine, the apps are still not following the system theme.

One strange thing that I've noticed is that if I have a xfce4-appearance-settings window open when the script runs, the apps follow the system theme. If I change the system theme using the UI, it also works.

I'll try to post some relevant logs that have been requested in the past, let me know if you need any other information from me.

# After changing theme a few times, in different ways
❯ cat .xsession-errors
(empty file)
❯ xfce4-about --version
xfce4-about 4.20.2 (Xfce 4.20)
❯ gtk-launch --version
3.24.51
❯ XFSETTINGSD_DEBUG=1 xfsettingsd --replace --no-daemon
xfce4-settings(xsettings): _XSETTINGS_S0 registered on screen 0
xfce4-settings(xsettings): 30 settings changed (serial=0, len=1204)
xfce4-settings(xsettings): resource manager (xft) changed (len=122)
xfce4-settings(pointers): initialized xi 2.4
xfce4-settings(pointers): [SynPS/2 Synaptics TouchPad] Changed device property libinput_Tapping_Enabled
xfce4-settings(keyboards): initialized xkb 1.0
xfce4-settings(keyboards): set auto repeat on
xfce4-settings(keyboards): set key repeat (delay=500, rate=50)
xfce4-settings(keyboards): set numlock on
xfce4-settings(accessibility): AccessXKeys disabled
xfce4-settings(accessibility): stickykeys disabled
xfce4-settings(accessibility): slowkeys disabled
xfce4-settings(accessibility): bouncekeys disabled
xfce4-settings(accessibility): mousekeys disabled
xfce4-settings(keyboard-shortcuts): 10 shortcuts loaded
xfce4-settings(keyboard-layout): set compose: to ""
xfce4-settings(displays): Detected CRTC 63.
xfce4-settings(displays): Detected CRTC 62.
xfce4-settings(displays): Detected CRTC 64.
xfce4-settings(displays): Detected output 65 eDP-1.
xfce4-settings(displays): Detected output 71 DP-1-2.
xfce4-settings(displays): Applying the only matching display profile: 9e8494e9-aa7b-4cd0-ba1f-f948d160abae
xfce4-settings(displays): CRTC 62 assigned to eDP-1.
xfce4-settings(displays): CRTC 62, output list[0] -> 65.
xfce4-settings(displays): CRTC 63 assigned to DP-1-2.
xfce4-settings(displays): CRTC 63, output list[0] -> 71.
xfce4-settings(displays): Total 2 active output(s).
xfce4-settings(displays): Normalized CRTC 63: size=2560x1440, pos=1920x0.
xfce4-settings(displays): Normalized CRTC 62: size=1920x1080, pos=0x154.
xfce4-settings(displays): min_h = 200, min_w = 320, max_h = 16384, max_w = 16384, prev_h = 1440, prev_w = 4480, prev_hmm = 382, prev_wmm = 1186, h = 1440, w = 4480, hmm = 382, wmm = 1186.
xfce4-settings(displays): Configuring CRTC 63.
xfce4-settings(displays): Configuring CRTC 62.
xfce4-settings(displays): Configuring CRTC 64.
xfce4-settings(fontconfig): monitoring 52 paths
xfce4-settings(workspaces): 2 desktop names set from xfconf
xfce4-settings(xsettings): 30 settings changed (serial=1, len=1200) <------- changing through UI
xfce4-settings(xsettings): 30 settings changed (serial=2, len=1204) <------- changing through UI
xfce4-settings(xsettings): 30 settings changed (serial=3, len=1200) <------- changing through script, with UI open
xfce4-settings(xsettings): 30 settings changed (serial=4, len=1204) <------- changing through script, with UI open
xfce4-settings(xsettings): 30 settings changed (serial=5, len=1200) <------- changing through script, UI closed

Last edited by codemonkey (2025-11-28 15:09:07)

Offline

#2 2025-11-28 15:14:07

eriefisher
Wanderer
From: ON, Canada
Registered: 2008-10-25
Posts: 814
LinuxFirefox 145.0

Re: Apps don't follow system theme when using xfconf

My guess would be that neither of these applications follow GTK theming. I'm sure they have some form of theming, maybe unique to them.


I AM CANADIAN!
Siduction
Debian Sid
Xfce 4.20 with Wayland/Labwc

Offline

#3 2025-11-28 17:45:36

Misko_2083
Member
Registered: 2015-10-13
Posts: 229
Website
LinuxFirefox 140.0

Re: Apps don't follow system theme when using xfconf

xfconf writes the value successfully (check with xfconf-query -c xsettings -p /Net/ThemeName)
And emits a notification signal to subscribed apps.

It could be a number of things, toolkity timing, applications are not ready to receive notification, applications only detect theme at startup...

I'd try to re-emit a notification signal for the "gtk-theme-name" property (using g_object_notify) right after xfcon-query.
You can make a small app for this in C.

Depending on the distribution, some build dependencies are needed:

Debian / Ubuntu / Xubuntu
sudo apt update
sudo apt install build-essential pkg-config libgtk-3-dev

Fedora / RHEL / CentOS
sudo dnf install gcc make pkgconfig gtk3-devel

Arch / Manjaro
sudo pacman -S base-devel pkg-config gtk3

openSUSE
sudo zypper install gcc make pkg-config gtk3-devel

Then save next as gtk3-theme-refresh.c

#include <gtk/gtk.h>

int main(int argc, char **argv) {
    gtk_init(&argc, &argv);

    // Access default settings to trigger any subscribers
    GtkSettings *settings = gtk_settings_get_default();
    if (!settings) {
        g_printerr("Failed to get default GtkSettings.\n");
        return 1;
    }
    g_object_notify(G_OBJECT(settings), "gtk-theme-name");

    return 0;
}

Then compile it from the same folder:

gcc gtk3-theme-refresh.c -o gtk3-theme-refresh $(pkg-config --cflags --libs gtk+-3.0)

Now the binary gtk3-theme-refresh can be used.

In a script I would try something like next:

#!/bin/bash
# Set the theme via xfconf
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita-dark"

# Give it a second to propagate (optional)
sleep 1

# Refresh running GTK3 apps
./gtk3-theme-refresh

Last edited by Misko_2083 (2025-11-28 20:07:25)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

#4 Yesterday 15:11:56

codemonkey
Member
Registered: 2025-11-28
Posts: 2
LinuxFirefox 145.0

Re: Apps don't follow system theme when using xfconf

Misko_2083 wrote:

xfconf writes the value successfully (check with xfconf-query -c xsettings -p /Net/ThemeName)
And emits a notification signal to subscribed apps.

It could be a number of things, toolkity timing, applications are not ready to receive notification, applications only detect theme at startup...

I'd try to re-emit a notification signal for the "gtk-theme-name" property (using g_object_notify) right after xfcon-query.
You can make a small app for this in C.

Depending on the distribution, some build dependencies are needed:

Debian / Ubuntu / Xubuntu
sudo apt update
sudo apt install build-essential pkg-config libgtk-3-dev

Fedora / RHEL / CentOS
sudo dnf install gcc make pkgconfig gtk3-devel

Arch / Manjaro
sudo pacman -S base-devel pkg-config gtk3

openSUSE
sudo zypper install gcc make pkg-config gtk3-devel

Then save next as gtk3-theme-refresh.c

#include <gtk/gtk.h>

int main(int argc, char **argv) {
    gtk_init(&argc, &argv);

    // Access default settings to trigger any subscribers
    GtkSettings *settings = gtk_settings_get_default();
    if (!settings) {
        g_printerr("Failed to get default GtkSettings.\n");
        return 1;
    }
    g_object_notify(G_OBJECT(settings), "gtk-theme-name");

    return 0;
}

Then compile it from the same folder:

gcc gtk3-theme-refresh.c -o gtk3-theme-refresh $(pkg-config --cflags --libs gtk+-3.0)

Now the binary gtk3-theme-refresh can be used.

In a script I would try something like next:

#!/bin/bash
# Set the theme via xfconf
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita-dark"

# Give it a second to propagate (optional)
sleep 1

# Refresh running GTK3 apps
./gtk3-theme-refresh

Thank you for the idea. Unfortunately it doesn't seem to work on my system.

My current workaround is to open the appearance dialogue before making any changes. I also need to modify the /general/theme setting for it to work:

#!/bin/bash

# Change the system theme
xfce4-appearance-settings & pid=$!; sleep 1
xfconf-query -c xsettings -p /Net/ThemeName -s "Adwaita"
xfconf-query -c xfwm4 -p /general/theme -s "Adwaita"
kill "$pid"

Let me know if you have any other ideas, otherwise I can close this issue as it seems to be very specific to my configuration

Offline

#5 Today 02:55:39

Misko_2083
Member
Registered: 2015-10-13
Posts: 229
Website
LinuxFirefox 140.0

Re: Apps don't follow system theme when using xfconf

These are all Electron-based apps.
Electron stopped monitoring the XSettings daemon directly,
and now listens only to GSettings signals, which xfconf does not trigger unless the appearance dialog is open.

#!/bin/bash
theme="Adwaita-dark"

# XFCE / XSettings
xfconf-query -c xsettings -p /Net/ThemeName -s "$theme"

# Electron-based (VSCode, Obsidian)
# gsettings set org.gnome.desktop.interface gtk-theme "$theme"
gsettings set org.gnome.desktop.interface color-scheme 'prefer-dark'

Values for color-sheme can be: default, prefer-dark, prefer-light. VSCode respects this on newer builds.

Last edited by Misko_2083 (Today 03:08:57)


Do you want to exit the Circus?
https://www.youtube.com/watch?v=ZJwQicZHp_c

Offline

Registered users online in this topic: 0, guests: 1
[Bot] ClaudeBot

Board footer

Powered by FluxBB
Modified by Visman

[ Generated in 0.009 seconds, 7 queries executed - Memory usage: 591.36 KiB (Peak: 608.2 KiB) ]