Guide: Xfce global dark mode in Qubes 4.0 / 4.1

For my fedora-36-minimal’s nautilus this doesn’t work. Any idea?

How do you guys deal with the blinding white flash that various programs produce when creating new windows or tabs? Some examples of when this sometimes happens:

  • Starting Firefox, Thunderbird, or Chrom[e|ium]
  • Opening a new tab in Firefox or Chrom[e|ium]
  • Loading new pages and refreshing the current page in Firefox and Chrom[e|ium]
  • Opening a new reply window in Thunderbird.

Some of these still happen even when using every possible dark mode option + Dark Reader + Dark New Tab (though these do help somewhat). From what I can tell, this has been an unsolved problem as far back as 15+ years now. Every few years, I’m tempted to try implementing a global dark theme again only to run into this problem again. At least if I use the default global light themes everywhere, I don’t get blinded by these inevitable white flashes. I’d guess that trying to use dark themes and getting occasionally blinded is worse for one’s eyes than just consistently using light themes with low blue light. It’s also a lot less of a hassle, since trying to use global dark themes feels like playing whack-a-mole as it seems like there’s always some new thing cropping up that doesn’t automatically follow the global theme and doesn’t come with its own dark theme option.

I use the standard xfce, and I don’t remember seeing white flashes when starting apps.

I use Nordic-darker for both windows manager and desktop in dom0, and Memories (different dark theme) in appVMs.

edit: I see what you mean now. I also get it with Thunderbird, but it’s very fast, I don’t get it with Brave.

I know it’s coming, so I close my eyes for a second.

I too am interested in a more sophisticated method. :wink:

I do. Same (short) duration as with Betterbird/Thunderbird.

Strange, this doesn’t seem to change anything for me in Debian 11 minimal. I was able to follow all other steps, so everything in the VM is correctly dark themed except for LibreOffice. I wonder if any of these might explain my lack of expected results:

  • I used --no-install-recommends when installing libreoffice-kf5
  • I don’t have the entire libreoffice base installed, just libreoffice-calc and libreoffice-writer

FWIW, I was able to darken Thunderbird without extensions on Debian 11 minimal by doing the following:

  1. Edit > Settings > Add-ons and Themes > Themes > Enable “Dark.”
  2. Edit > Settings > General > Language & Appearance > Fonts & Colors > Colors… > Uncheck “Use system colors,” set “Text” to a light color, and set “Background” to a dark color.
  3. View > Message Body As > Select either “Plain Text” or “Simple HTML.”

Everything should be dark-themed now.


For Chrom[e|ium] users, there is now an experimental flag that allows you to force global dark mode across all arbitrary web page contents without any extensions:

  1. In the address bar, navigate to chrome://flags.
  2. In the search bar, enter “dark.”
  3. Next to “Auto Dark Mode for Web Contents,” select “Enabled with selective inversion of non-image elements” (or your desired choice).
  4. Relaunch.

This seems to remove some of the flicker or white flashes that I still occasionally experienced with the “Dark Reader” extension.

If you still have a light theme in Chrom[e|ium] itself at the top where the tabs are:

  1. Follow the general OS dark theme steps already described in the OP of this thread.
  2. Settings > Appearance > Theme > Select “Use GTK+.”

If you enabled dark mode correctly for the VM, then using GTK+ will also apply it to Chrom[e|ium] itself.

I was able to fix this by adding SAL_USE_VCLPLUGIN=kf5 to /etc/environment in the template.

1 Like

Another tip I came across: With a dark theme in LibreOffice, some of the toolbar icons become illegible, but installing libreoffice-style-breeze fixes this by replacing the icons with nicer ones that work well with the dark theme.

1 Like

Bump?

Sorry, not have any wiser answer then “it works for me”. But… I just use gtk-application-prefer-dark-theme=1 and nothing else for minimals since I just want them to be dark, without installing anything unnecessary in them.

1 Like

How does one do this?

Example:

  1. Open a terminal emulator in dom0.
  2. Type sudo vim /etc/environment. Press Enter.
  3. Press i.
  4. Type QT_QPA_PLATFORMTHEME=gtk2.
  5. Press Escape.
  6. Type :x. Press Enter.
1 Like

I’m a few months late, but since I don’t think this ever got addressed here:

Open a terminal in your AppVM and type:
gsettings set org.gnome.desktop.interface color-scheme "prefer-dark"
(That’ll sort out libreoffice, nautilus/files and standard gnome apps like calculator.)

1 Like

Edit: Thanks @Fom for the tip. Now I see that you’re responding on Nautilus issue which doesn’t need to install any extra package. Great!

Hoping something like this makes it easy into qubes by default.

I don’t like the idea of installing inside of dom0. Too risky for a non technical user like me

Installing what exactly in dom0? You don’t seem to reply on any specific post, so it’s unclear.

TL;DR, this is great work, but a lot of things need to be done manually.
is there a well thought solution that can change the basic themes to the dark and back automatically?

Instead, for people like me who work on the computer around the clock, a light theme is required in the daytime, and a dark theme at night. I think this could be triggered from dom0. It is ok to wait a few minutes for the script to change all themes in all VMs one by one.

across all available VMs, run this for light theme
gsettings set org.gnome.desktop.interface gtk-theme “Adwaita”

this for dark
gsettings set org.gnome.desktop.interface gtk-theme “Adwaita-dark”

I’ve figured out some details towards a scripting workaround. Some specifics are per KDE.

create a global theme switcher that runs on dom0 that will

  • switch to dark/light wallpaper (i prefer plain color)
  • change dom0 terminal’s color scheme at runtime
  • get a list of running vms and change their gnome theme

some hints for dark.sh:

lookandfeeltool -a org.kde.breezedark.desktop
./change-kde-wallpaper-color.sh 50,50,100
ln -sf $HOME/.config/alacritty/tokyo-night.yaml $HOME/.config/alacritty/alacritty-theme.yaml
sleep 0.5
touch $HOME/.config/alacritty/alacritty.yml
for i in `./get-all-running-vms.sh `; do ./change-dark.sh $i; done

get-all-running-vms.sh:

qvm-ls --running --raw-data|grep AppVM |cut -f 1 -d\|

change-kde-wallpaper-color.sh:

color=$1

qdbus  org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript 'string:
var Desktops = desktops();

for (i=0;i<Desktops.length;i++) {
        d = Desktops[i];
        d.wallpaperPlugin = "org.kde.color";
        d.currentConfigGroup = Array("Wallpaper",
                                    "org.kde.color",
                                    "General");
        d.writeConfig("Color", "'${color}'");
}'

sleep 1
kquitapp5 plasmashell
kstart5 plasmashell > /dev/null 2>&1

can switch to dark without dealing with manual settings. I think a better tool can be integrated to dom0.

1 Like

Can you help me with fedora 38 and QT? It looks like there is no gtk2 so probably we need other set of packages.