Dark mode in Debian 10 VM

Thanks! I think i made the settings.ini file by accident with sudo privilege. Now everythings work fine.

It is the third day I try to set a dark theme in debian-10 template.

I tried to install it changing the theme in Gnome Tweaks (works well in Fedora, but not in Debian).
I tried to install all possible Gnome packages.
I tried this:

 cd ~/.config/
 mkdir gtk-3.0
 cd gtk-3.0/
 touch settings.ini

Add the following lines to settings.ini

 [Settings]
 gtk-application-prefer-dark-theme=1

when I open the file again it shows

gtk-application-prefer-dark-theme=0

I tried that

Works for some time, but then suddenly drops to =0 again.

Reinstalled debian-10 template, tried on other PC with Qubes 4.0 and every time it ignores my changes. Gnome Settings does not start, Gnome Tweaks no effect, dconf-editor no effect.

Any ideas?

Seems like starting Gnome Tweaks drops it to zero. It is strange because the file always has u+rw permissions and changes in Gnome Tweaks have no effect on interface.

In Fedora everything works as expected.

Hi @tvori-dobro I feel your pain. A couple of conclusions I reached after struggling with this for months:

  • If you have gnome-settings daemon running (e.g. Fedora) the config files are ignored (best case) or interfere (worst case) with the settings you make in gnome-tweaks. … so if you want to use gnome settings daemon and gnome tweaks, it’s probably best to just delete the settings.ini and the .gtkrc-2.0

  • I found that my qubes work best without gnome settings daemon (e.g. Debian, Debian-minimal). In that case set the DPI in /etc/X11/Xresources/x11-common using Xft.dpi: in the template … and make sure your qubes have both: ~/.config/gtk-3.0/settings.ini and ~/gtkrc-2.0. Mine look like this:

settings.ini

[Settings]
gtk-font-name=Ubuntu 10
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=Adwaita

.gtkrc-2.0

include "/usr/share/themes/Adwaita-dark/gtk-2.0/gtkrc"
style "user-font"
{
         font_name="Ubuntu"
}
widget_class "*" style "user-font"
gtk-font-name="Ubuntu 10"
gtk-theme-name="Adwaita-dark"
gtk-icon-theme-name="Adwaita"

I put these files in the /etc/skel of the template so they get created automatically if I create a new qube based on that template.

To make sure QT apps look good too: in the template install qt5-style-plugins, gtk2-engines-murrine and gnome-themes-standard. Then in /etc/environment add these two lines:

QT_QPA_PLATFORMTHEME=gtk2
QT_SCALE_FACTOR=1

Perhaps the community documentation could get an update with this new information? (if you have the time and will, ofc!)

I tagged you reply as a task, but it’ll take some time. What I forgot in my reply is how to make sure QT apps look good too: in the template install qt5-style-plugins, gtk2-engines-murrine and gnome-themes-standard. Then in /etc/environment add these two lines:

QT_QPA_PLATFORMTHEME=gtk2
QT_SCALE_FACTOR=1

Edited your reply to add this. Hope you don’t mind :slight_smile:

Ofc! And only if you feel like it :slight_smile:

1 Like

Hi Sven, does changing the font and font size work for you?

I’m fighting with this too now, currently in Debian 11. Dark mode works, via the gtk-application-prefer-dark-theme setting, but not setting the font or font size.

I have the same settings.ini content as yours, except also the gtk-application-prefer-dark-theme=1 line, so:

[Settings]
gtk-application-prefer-dark-theme=1
gtk-font-name=Ubuntu 8
gtk-theme-name=Adwaita-dark
gtk-icon-theme-name=Adwaita

For me, the first line does control the dark theme (I can switch it on and off successfully), but the other lines, and in particular gtk-font-name does not take / is not applied at all.

Applications like Firefox and GEdit still have (relatively) huge font size.

Any hints about how to debug this further are much welcome.

I have ensured the gnome-settings-daemon is completely removed also, just in case.

Yes works in general in Debian 11 (minimal) as I described including firefox-esr. Don’t know about Gedit. Also my Debian 11 qubes are in-place upgrades from Debian 10. So it could be that there is a difference when one uses the Debian 11 template from the repo – maybe?

Thanks, that’s great to know, then I know I should keep trying :smiley:

Ah, well, I tried an in-place upgrade from Debian 10 before as well, and changed to a fresh template to see if that would help :slight_smile: … so the problem has to be something else. Hmm.

(Btw, also now confirmed that file is actually read, with strace:

$ strace gedit 2>&1 | grep settings.ini
access("/usr/share/gtk-3.0/settings.ini", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/gtk-3.0/settings.ini", 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/user/.config/gtk-3.0/settings.ini", F_OK) = 0
openat(AT_FDCWD, "/home/user/.config/gtk-3.0/settings.ini", O_RDONLY) = 10

)

Just a short update: Unfortunately haven’t solved the problem yet, so has had to retreat to Fedora as a base image, as I couldn’t work effectively with huge fonts taking up all the screen estate :confused: (not that fedora is bad, but the change causes some trouble to my usual workflow).

If anybody else get this to work and has some further tips about things influencing the outcome here, I’m much interested.

This is Qubes 4.1 fully darkened on an external full HD display. \ö/

Thank you — and all the commentators here and here — so much for your hard work! (For me, now, it was just a couple of hours. :wink: )

Summary for all users

  • dom0 darkened with ›Q‹ panel click-pop-up/System Tools/Appearance and /Window Manager. With Style ›Bluebird‹ and in dom0 Terminal setting the same background color as desktop, dom0 Terminal kind of floats on the desktop, I like it …
  • Fedora 34 VMs (as ›browser‹, orange, in the screenshot) darkened with gnome-tweak-tools, »Tweaks« in dom0 applications list.
  • Debian 11 VMs (as ›encryption‹, purple, in the screenshot) with /etc/environment, settings.ini and gtkrc-2.0 files/settings.
  • Background colors and fonts of Gedit and Terminal are, of course, adjustable within the apps itselves.

[So, fortunately, you/we all can avoid a nightmare called KDE (I know what I’m talking about).]

Have a nice one!

[Edit: See new user guide.]

3 Likes

Now we just need to figure out how to change the Networkmanager applet background.

Ha, yes. I didn’t pay attention because of the big relief. (;

This is a known issue (#2846) and will hopefully be possible in a future release.

Ah, thanks.

Xjeanjean on Microsoft Github / Qubes issue #2846 is right: Changing trayicon_mode in /etc/qubes/guid.conf doesn’t do anything in 4.1. White background remains, the enigmatic black border remains.

If anybody has hints how to darken Firefox Websites just with userChrome.css and userContent.css; no add-ons, of course — would be nice! I can’t find anything useful.

(Mozilla Thunderbird ist darkened.)

Nice! Would it be possible for someone here to volunteer to update the community guide on dark-themes? That way the solution would be more accessible.

1 Like

Hey.

The Xfce global dark mode guide/summary is already there, and @sven has at least seen it.

As Sven’s obviously the dark mode expert — »struggling with this for months« —, I’m not sure about changing it into a wiki post. He can tweak it anyway, and wiki post would mean everybody with trust level 1+ could edit?

I have issues with this on Debian 12. The distro theme can change by using documented methods, but applications such as Chrome and firefox, xfce4-settings-manager etc do not get updated when the documented commands are issued.

I have compared fedora-XX-xfce template with debian-YY template with respect to their xfce initializations. While doing this I had installed some packages, but apparently one undocumented thing appears to be essential:

xfsettingsd --replace

Maybe other users can try this. I can switch between dark/light themes (including apps like firefox et al) by using from dom0

./change-light vm-name
./change-dark vm-name

change-light:

qvm-run $1 gsettings set org.gnome.desktop.interface gtk-theme "Adwaita" 2> /dev/null
qvm-run $1 xfconf-query -c xsettings -p /Net/ThemeName  -s Adwaita 2> /dev/null
qvm-run $1 gsettings set org.gnome.desktop.interface color-scheme prefer-light  2> /dev/null

similarly change-dark:

qvm-run $1 gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" 2>/dev/null
qvm-run $1 xfconf-query -c xsettings -p /Net/ThemeName -s Adwaita-dark 2>/dev/null
qvm-run $1 gsettings set org.gnome.desktop.interface color-scheme prefer-dark 2>/dev/null

1 Like

this is excellent, thanks a lot

  • using qvm-run --all for all running qubes,
  • right now thinking about putting it in context with redshift, if sunset is true or something, for more automation :>