How do I switch to dark mode on Linux?

Discussions related to using VirtualBox on Linux hosts.
Post Reply
TOWF
Posts: 21
Joined: 17. Jul 2023, 16:04
Primary OS: Ubuntu other
VBox Version: OSE Debian
Guest OSses: a lot
Location: Stupidity land
Contact:

How do I switch to dark mode on Linux?

Post by TOWF »

How do I switch to dark mode on Linux? There's no option in the settings for dark mode, and the light mode is burning my eyes.

OS: Ubuntu 24.10 x64
Desktop Environment: GNOME
-TOWF
birdie
Posts: 490
Joined: 2. May 2010, 14:19
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux, other Unixes
Location: Artem S. Tashkinov
Contact:

Re: How do I switch to dark mode on Linux?

Post by birdie »

Create or change your existing shortcut to:

Code: Select all

env GTK_THEME=Adwaita:dark VirtualBox
This will force the UI to be dark.

Tested and works in Fedora 42/the official VirtualBox 7.1.6 build.
Attachments
virtualbox dark in Linux.png
virtualbox dark in Linux.png (186.54 KiB) Viewed 12961 times
thegripmaster
Posts: 3
Joined: 28. Oct 2024, 18:49

Re: How do I switch to dark mode on Linux?

Post by thegripmaster »

This is what worked for my Fedora 43 running GNOME. This should work in Ubuntu as well. This assumes you pinned the virtualbox app to your dock.

Code: Select all

cp /usr/share/applications/virtualbox.desktop ~/.local/share/applications/
sed -i -E 's/^Exec=VirtualBox(&|$| )/Exec=env GTK_THEME=Adwaita:dark VirtualBox\1/' "$HOME/.local/share/applications/virtualbox.desktop"
update-desktop-database ~/.local/share/applications/
thegripmaster
Posts: 3
Joined: 28. Oct 2024, 18:49

Re: How do I switch to dark mode on Linux?

Post by thegripmaster »

There is actually an easier way that I found

Edit your ~/.config/gtk-3.0/settings.ini

Change
gtk-application-prefer-dark-theme=0
to
gtk-application-prefer-dark-theme=1

Close and open VBox. But this will turn all your GTK 3 applications to dark as well.
liar666
Posts: 5
Joined: 3. Dec 2020, 19:32

Re: How do I switch to dark mode on Linux?

Post by liar666 »

Hello,

None of the solutions presented here or on the web (QT_QPA_PLATFORMTHEME=qt6ct, etc.) work with VBox 7.2.6r172322 (Qt6.8.2 on xcb) which seems to be the lastest version available...

LMDE7 + i3wm here

All other QT apps (VLC, KeepassXC) are in dark mode as requested.

Any help appreciated.
liar666
Posts: 5
Joined: 3. Dec 2020, 19:32

Re: How do I switch to dark mode on Linux?

Post by liar666 »

OK found the solution !!!!

Code: Select all

env XDG_CURRENT_DESKTOP=gtk3 /usr/lib/virtualbox/VirtualBox

MANY thanks to https://github.com/VirtualBox/virtualbo ... 3210665358
Post Reply