Skip to content

feat: add runtime theme switching via Window menu (issue #339)#384

Open
shresthbhargava wants to merge 3 commits into
fougue:developfrom
shresthbhargava:feature/light-mode-theme
Open

feat: add runtime theme switching via Window menu (issue #339)#384
shresthbhargava wants to merge 3 commits into
fougue:developfrom
shresthbhargava:feature/light-mode-theme

Conversation

@shresthbhargava

Copy link
Copy Markdown
  • Add themeName property to AppModuleProperties (persisted in settings)
  • Add CommandSwitchTheme command in commands_window
  • Wire command into Window menu in mainwindow
  • Read saved theme at startup in main.cpp
  • Closes Query: light mode #339

- Add themeName property to AppModuleProperties (persisted in settings)
- Add CommandSwitchTheme command in commands_window
- Wire command into Window menu in mainwindow
- Read saved theme at startup in main.cpp
- Closes fougue#339
@HuguesDelorme

Copy link
Copy Markdown
Member

Thanks for this proposal.
Your PR is providing a new command in the Window menu, so it's directly accessible to the user.
As such, from an user point of view, I would expect the theme to be applied without restarting the application.
A fair compromise would be to allow the user to edit the theme from the Tools->Option dialog(instead of a command).
The new option would include a note in its description that the theme will be effective at next application restart(have a look to the language option for an example)

@shresthbhargava

Copy link
Copy Markdown
Author

Thanks for this proposal. Your PR is providing a new command in the Window menu, so it's directly accessible to the user. As such, from an user point of view, I would expect the theme to be applied without restarting the application. A fair compromise would be to allow the user to edit the theme from the Tools->Option dialog(instead of a command). The new option would include a note in its description that the theme will be effective at next application restart(have a look to the language option for an example)

Thanks for the feedback.
I understand the concern regarding user expectations for runtime theme switching.

I’ll rework the implementation to move the theme selection into the Tools → Options dialog and apply the change on next application restart.

- Remove CommandSwitchTheme window menu command
- Make themeName property visible in Tools->Options dialog
- Add restart-required note in themeName description
- Theme preference persists via settings system automatically
@shresthbhargava

Copy link
Copy Markdown
Author

Updated — theme setting is now in the Tools→Options dialog with a note that restart is required, similar to the language setting.

Comment thread src/app/commands_window.h
static constexpr std::string_view Name = "next-doc";
};


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this empty line


#include <cassert>


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove these empty lines

Comment thread src/app/mainwindow.cpp
this->addCommand<CommandLeftSidebarWidgetToggle>(this->widgetPageDocuments()->widgetLeftSideBar());
this->addCommand<CommandMainWidgetToggleFullscreen>();
this->addCommand<CommandSwitchMainWidgetMode>();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this empty line

Comment thread src/app/mainwindow.cpp
fnAddAction(menu, CommandMainWidgetToggleFullscreen::Name);
menu->addSeparator();
fnAddAction(menu, CommandSwitchMainWidgetMode::Name);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this empty line

PropertyEnum<ActionOnDocumentFileChange> actionOnDocumentFileChange{ this, textId("actionOnDocumentFileChange") };
PropertyBool linkWithDocumentSelector{ this, textId("linkWithDocumentSelector") };
PropertyBool forceOpenGlFallbackWidget{ this, textId("forceOpenGlFallbackWidget") };
PropertyString themeName{ this, textId("themeName") };

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type should be PropertyEnumeration and the enum defined in app_module_properties.cpp or elsewhere. Have a look at how viewCubeCorner is implemented.
Being an enumeration is better than a string that requires error-prine user typing.

@HuguesDelorme HuguesDelorme force-pushed the develop branch 2 times, most recently from 85391f0 to 7827fc9 Compare June 3, 2026 14:45
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.

Query: light mode

2 participants