How to run a script when switching Light/Dark mode?

I’m using GNOME 43 on Debian 12 and I use custom themes for the shell, the icons, and the legacy apps. I would like them to automatically change when I switch to Light/Dark mode, but when I do so: GNOME only change the theme for the “GTK4” apps.

So I’ve made a script that change all the themes, but currently I can only use it with a custom shortcut.

I would like to automatically run it when I switch to Light/Dark mode from System Menu or Settings ?
Is it possible to change what theme switching do in order to include my script so that it would be run when I click on the switch button ?

L. :footprints:

You can’t change the preferred color scheme for applications that have no support for that option—which is only available to applications using libadwaita (GTK4), libhandy (GTK3), or any application with custom styling that is also using the settings portal.

On top of that, GNOME only changes the settings portal, so you can’t call random scripts.

My strong recommendation is to file bugs/contribute to the applications you use so that they support the light/dark style preference, instead of hacking your way around with scripts that will, inevitably, break.

You can try the Legacy (GTK3) Theme Scheme Auto Switcher GNOME Shell extension.

This :point_up_2:

This :point_up_2:

And I also have immersive-dark-mode if you like to avoid extensions.

This topic was automatically closed 45 days after the last reply. New replies are no longer allowed.