Skip to content

fix: Preserve saved theme preference across sessions#186

Open
onedge wants to merge 1 commit intoMaciek-roboblog:mainfrom
onedge:fix/preserve-saved-theme
Open

fix: Preserve saved theme preference across sessions#186
onedge wants to merge 1 commit intoMaciek-roboblog:mainfrom
onedge:fix/preserve-saved-theme

Conversation

@onedge
Copy link

@onedge onedge commented Feb 10, 2026

Summary

  • Fixed a bug where saved theme preferences were not properly preserved across sessions
  • Resolved an issue where the theme would fallback to auto-detection mode when the --theme option was not explicitly provided in the CLI, ignoring the saved preference in last_used.json

Changes

Modified: src/claude_monitor/core/settings.py

  • Simplified the theme auto-detection condition
  • Before: theme == "auto" OR (theme not provided in CLI AND not clearing config) → auto-detect
  • After: Only auto-detect when theme == "auto"
  • This ensures saved theme preferences (light/dark/classic) persist across sessions

Problem Context

When a user runs claude-monitor --theme dark, the preference is saved to last_used.json. On the next run with just claude-monitor (without theme option), the saved dark theme should be used. However, the previous logic would switch to auto-detection mode simply because the theme was not provided in the CLI arguments.

Test Plan

  • Run claude-monitor --theme dark to save dark theme
  • Run claude-monitor (without options) to verify dark theme persists
  • Run claude-monitor --theme auto to verify auto-detection still works
  • Verify theme preference is saved in ~/.claude-monitor/last_used.json

Summary by CodeRabbit

Release Notes

  • Refactoring
    • Simplified automatic theme detection logic. Theme will now only automatically detect when explicitly set to "auto" mode, providing more predictable behavior.

@coderabbitai
Copy link

coderabbitai bot commented Feb 10, 2026

📝 Walkthrough

Walkthrough

The conditional gating for automatic theme detection in load_with_last_used has been simplified. The logic now triggers automatic theme detection only when the theme explicitly equals "auto", instead of also triggering when theme is not CLI-provided and config is not being cleared.

Changes

Cohort / File(s) Summary
Theme Detection Logic Simplification
src/claude_monitor/core/settings.py
Simplified conditional logic for automatic theme detection; restricted to explicit "auto" theme value only, removing dependency on CLI-provided fields and clear_config status.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A theme once tangled in many a way,
Now flows with clarity bright as day!
When "auto" is chosen, the magic is clear—
No hidden conditions to cloud your cheer! 🎨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: Preserve saved theme preference across sessions' accurately describes the main change: preventing saved theme preferences from being overwritten when the CLI is invoked without explicit theme options.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

No actionable comments were generated in the recent review. 🎉

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant