Skip to content

feat(windows): add 'Follow system theme' option for dark mode#10815

Open
BenJule wants to merge 8 commits into
bambulab:masterfrom
BenJule:feat/auto-dark-mode-windows
Open

feat(windows): add 'Follow system theme' option for dark mode#10815
BenJule wants to merge 8 commits into
bambulab:masterfrom
BenJule:feat/auto-dark-mode-windows

Conversation

@BenJule
Copy link
Copy Markdown

@BenJule BenJule commented May 20, 2026

Summary

Closes #10800.

On macOS, BambuStudio already follows the system dark/light theme automatically via EVT_SYS_COLOUR_CHANGED. On Windows this event handler was guarded with #ifndef __WINDOWS__, so theme changes were silently ignored and users had to toggle dark mode manually in Preferences.

This PR adds a "Follow system theme" checkbox directly below the existing "Enable dark mode" toggle in Preferences → Other. When checked:

  • The manual "Enable dark mode" checkbox is disabled (grayed out)
  • The current Windows system theme is applied immediately
  • Any subsequent system theme changes (e.g. switching in Windows Settings → Personalisation → Colors) are detected via WM_SYSCOLORCHANGE and the UI updates automatically

When unchecked, behavior is unchanged — the manual toggle controls dark mode as before.

Implementation

File Change
GUI_Utils.hpp EVT_SYS_COLOUR_CHANGED now calls update_dark_config() + on_sys_color_changed() on Windows when dark_mode_follow_system == "1"
GUI_App.cpp dark_mode() returns check_dark_mode() (system appearance) instead of stored config when follow-system is active; on startup, syncs config from system if follow-system is active
MainFrame.cpp on_sys_color_changed() calls force_colors_update() and update_ui_from_settings() on all platforms for a full UI refresh
Preferences.hpp/.cpp New m_dark_mode_follow_system_checkbox; "Follow system theme" checkbox with immediate apply + mutual exclusion with manual toggle

The stored config key is dark_mode_follow_system ("0" by default, "1" when enabled) — fully backwards compatible.

Test plan

  • Windows: enable "Follow system theme" → manual toggle grays out, current system theme applied
  • Windows: switch system between light/dark in Settings → Personalisation → Colors → app follows without restart
  • Windows: disable "Follow system theme" → manual toggle re-enabled, theme stays at last value
  • Windows: restart with "Follow system theme" enabled → correct theme applied on launch
  • macOS/Linux: no change in behavior, existing auto-follow still works
  • Preferences dialog dark mode updates correctly when toggling follow-system

@BenJule BenJule force-pushed the feat/auto-dark-mode-windows branch from 45fc24a to 5bf2121 Compare May 21, 2026 08:31
BenJule added 8 commits May 21, 2026 10:52
The upstream build_all.yml only listed 'main' as a push trigger.
BenJule/BambuStudio uses 'master' as its default branch, so CI never
fired on fork-local pushes. Adding 'master' alongside 'main' makes
the full multi-platform build run when master is updated.
… locale files

The fila_manager web page was hardcoded in Chinese (lang="zh") with no
internationalization support. This commit adds a lightweight i18n system:

- Add locales/en.json and locales/zh_CN.json with all UI strings
- Add t(key) / tf(key, n) translation helpers loaded at startup
- Apply translations via data-i18n / data-i18n-placeholder attributes in HTML
- Replace all hardcoded Chinese strings in index.js with t() calls
- Language is resolved from the ?lang= URL parameter passed by C++
… strings

Two printer status strings shown during calibration used the misspelling
"percision" instead of "precision". Also fix lang="zh-CN" in
NozzleListTable.html (the table content is set by C++ at runtime).

All .po and .pot msgid entries updated to match the corrected source strings.
- 'Problem occured' → 'Problem occurred' (MediaPlayCtrl.cpp)
- 'When enable spiral vase mode' → 'When enabling ...' (SelectMachine.cpp, SyncAmsInfoDialog.cpp)
- 'connectors is out of object' → 'connectors are out of object' (GLGizmoAdvancedCut.cpp)
- 'Error:Detecting ...' → 'Error: Detecting ...' with spacing fixes (GLGizmoText.cpp)

Update all corresponding msgid entries in BambuStudio.pot and all 18 .po locale files.
Fix missing spaces after 'Warning:', 'Error:', and 'Tip:' prefixes,
missing spaces after sentence-ending periods and commas, and several
grammar issues in strings that appear to originate from machine
translation:

- GLGizmoText.cpp: fix 9 Warning: strings (space + grammar)
  - 'Warning:create text fail.' → 'Warning: Text creation failed.'
  - 'Warning:text normal is error.' → 'Warning: Text normal has an error.'
  - 'Warning:Due to font upgrades,previous...' → proper spacing
  - 'reedit it will ok' → 'reedit it to fix the issue'
  - 'dragging text' → 'drag the text' (imperative form)
- GLGizmoMeasure.cpp: fix 3 Warning: strings + 'two different mesh' → 'meshes'
- GLGizmoSVG.cpp: fix 'Tip:If...' + missing comma + 'svg file' → 'SVG file'
- PlaterWorker.hpp: 'error occured' → 'error occurred'
- DeviceManager.cpp: missing spaces after period/comma + '(PLA...)' spacing
- BindDialog.cpp: 'device.Before', 'termsand', 'Use(collectively)' spacing
- ConfigManipulation.cpp: missing spaces after comma and period
- AMSSetting.cpp: missing space after '1 minute.'
- Preferences.cpp: 'tab.If change value' → 'tab. If you change this value'

Update all msgid entries in BambuStudio.pot and all 18 .po locale files.
- AuxiliaryDialog.cpp: 'Auxiliaryies' → 'Auxiliaries' (dialog title)
- FanControl.cpp: 'print qulity' → 'print quality'
- GLGizmoFlatten.cpp: 'too small,The' → 'too small. The' (comma → period)
- Monitor.cpp: 'Assistant(HMS)' → 'Assistant (HMS)' (space before parenthesis)
- AMSSetting.cpp: 'during  printing' → 'during printing' (double space)
- AMSDryControl.cpp + uiAmsHumidityPopup.cpp: 'Left Time' → 'Remaining Time'
- Plater.cpp: 'attrited' → 'worn' (non-standard word)

Update all corresponding msgid entries in BambuStudio.pot and all 18 .po
locale files.
On macOS, BambuStudio already auto-follows the system dark/light theme
via EVT_SYS_COLOUR_CHANGED. On Windows this handler was guarded with
#ifndef __WINDOWS__, so theme changes were silently ignored.

Changes:
- GUI_Utils.hpp: EVT_SYS_COLOUR_CHANGED now fires on Windows when
  'dark_mode_follow_system' is enabled; calls update_dark_config() and
  on_sys_color_changed() to refresh the UI
- GUI_App.cpp dark_mode(): if follow-system is enabled, query
  check_dark_mode() (system appearance) instead of the stored config;
  on startup, sync dark_color_mode config from system if follow-system
  is enabled
- MainFrame.cpp on_sys_color_changed(): call force_colors_update() and
  update_ui_from_settings() on all platforms (previously skipped on
  Windows), so a system-triggered theme change gets a full UI refresh
- Preferences.hpp/.cpp: add 'Follow system theme' checkbox below the
  manual 'Enable dark mode' toggle; when checked the manual toggle is
  disabled and the current system state is applied immediately

Resolves feature request bambulab#10800.
@BenJule BenJule force-pushed the feat/auto-dark-mode-windows branch from 5bf2121 to 770f7d2 Compare May 21, 2026 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto Dark Mode: Follow Windows 11 System Theme

1 participant