The gsettings command can change things on the fly in the dconf, assuming that’s where the setting actually resides. It’s a pain to do, but that means it’s possible to write a script that makes the necessary change(s) and that can then be assigned to a keyboard combo.
For example, I have one that toggles a Cinnamon panel between the top and the bottom of its screen (I won’t get into why) and currently have it bound to Ctrl-Alt-Space.
It’s currently a hack that uses a couple of hardcoded values that I pulled from the dconf by observing what it was set to with the panel in each location. If it finds the first value it changes it to the second, and vice versa.
(In the unlikely event I come to change the layout to something it doesn’t recognise, it bails out, doing nothing.)
Anyway, you could probably do something similar to toggle the dark/light mode.
gsettings didn’t work in my case. Which is why i guess it’s libadwaita. Btw, i’m on XFCE.
edit: though, toggling light/dark via gsettings might work.
editedit: it didn’t. But GTK_THEME= did. Which is kinda troublesome still, since you can’t switch session variable content for the current session. Needs a wrapper script now.
The
gsettings
command can change things on the fly in the dconf, assuming that’s where the setting actually resides. It’s a pain to do, but that means it’s possible to write a script that makes the necessary change(s) and that can then be assigned to a keyboard combo.For example, I have one that toggles a Cinnamon panel between the top and the bottom of its screen (I won’t get into why) and currently have it bound to Ctrl-Alt-Space.
It’s currently a hack that uses a couple of hardcoded values that I pulled from the dconf by observing what it was set to with the panel in each location. If it finds the first value it changes it to the second, and vice versa.
(In the unlikely event I come to change the layout to something it doesn’t recognise, it bails out, doing nothing.)
Anyway, you could probably do something similar to toggle the dark/light mode.
gsettings didn’t work in my case. Which is why i guess it’s libadwaita. Btw, i’m on XFCE.
edit: though, toggling light/dark via gsettings might work.
editedit: it didn’t. But GTK_THEME= did. Which is kinda troublesome still, since you can’t switch session variable content for the current session. Needs a wrapper script now.