opencode
opencode copied to clipboard
fix(desktop): detect system dark mode on Linux
Problem
On Linux, the desktop app ignores the system dark mode setting. The app always shows light theme even when the system is set to dark mode.
Root cause: WebKitGTK (used by Tauri on Linux) doesn't properly report prefers-color-scheme to CSS/JavaScript. It always returns light regardless of system settings.
Solution
- Detect the system color scheme in Rust using
gsettings(GNOME) with GTK theme fallback - Inject
data-color-schemeattribute via initialization script before page load - Add CSS selector
html[data-color-scheme="dark"]to apply dark theme
Changes
-
packages/tauri/src-tauri/src/lib.rs- Adddetect_linux_color_scheme()function -
packages/ui/src/styles/theme.css- Add dark theme selector fordata-color-schemeattribute
Testing
Tested on Fedora 42 with GNOME dark mode enabled.
A few things in flux atm, desktop guys requested I didn't merge PRs quite yet, they should be ready for contributions soon tho
Ill have them review