Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding custom.css #370

Merged
merged 5 commits into from
Apr 10, 2024
Merged

Adding custom.css #370

merged 5 commits into from
Apr 10, 2024

Conversation

myyc
Copy link
Contributor

@myyc myyc commented Apr 9, 2024

since this was a highly requested feature i thought of implementing it. i think some of the code might belong to the utils but i guess you should decide instead. to test it:

  • add custom.css to ~/.config/whatsapp-for-linux
  • fill it with * { color: red !important }

Copy link
Owner

@xeco23 xeco23 left a comment

Choose a reason for hiding this comment

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

Thanks a lot for this! :)

@@ -195,6 +202,10 @@ namespace wfl::ui

webkit_web_view_set_zoom_level(*this, util::Settings::getInstance().getValue<double>("general", "zoom-level", 1.0));

if (cssFileExists(cssFilePath)) {
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please move the brace to the next line?

@@ -171,6 +175,9 @@ namespace wfl::ui
{
auto const webContext = webkit_web_view_get_context(*this);

std::string configDir = Glib::get_user_config_dir();
Copy link
Owner

Choose a reason for hiding this comment

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

Please use auto

@@ -171,6 +175,9 @@ namespace wfl::ui
{
auto const webContext = webkit_web_view_get_context(*this);

std::string configDir = Glib::get_user_config_dir();
std::string cssFilePath = configDir + "/" + WFL_NAME + "/custom.css";
Copy link
Owner

Choose a reason for hiding this comment

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

Also auto

Copy link
Owner

Choose a reason for hiding this comment

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

Also, maybe we can rename the file as web.css in case we want to introduce a custom app.css for gtk as well.

}

std::string WebView::loadCssContent(const std::string& cssFilePath) {
std::ifstream cssFile(cssFilePath);
Copy link
Owner

Choose a reason for hiding this comment

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

Please use auto


std::string WebView::loadCssContent(const std::string& cssFilePath) {
std::ifstream cssFile(cssFilePath);
std::string cssContent((std::istreambuf_iterator<char>(cssFile)),
Copy link
Owner

Choose a reason for hiding this comment

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

Please use auto

Copy link
Contributor Author

@myyc myyc Apr 9, 2024

Choose a reason for hiding this comment

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

i have no idea what "auto" is, i'm not a c++ developer, this is very improvised. do you mean the auto keyword to declare the variables?

Copy link
Owner

Choose a reason for hiding this comment

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

Never mind then. I'll merge it and modify your changes when I have some time.

Copy link
Owner

Choose a reason for hiding this comment

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

It's supposed to be i.e. auto cssFile = std::ifstream{cssFilePath};

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah i think my last commit broke more than it fixed, if you want i can reverse some of the changes

Copy link
Owner

Choose a reason for hiding this comment

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

Would be nice to revert the changes with auto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i'll do that

@myyc
Copy link
Contributor Author

myyc commented Apr 10, 2024

should be fine now!

Copy link
Owner

@xeco23 xeco23 left a comment

Choose a reason for hiding this comment

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

LGTM!

@xeco23 xeco23 merged commit f1b27fc into xeco23:master Apr 10, 2024
3 checks passed
@xeco23 xeco23 mentioned this pull request Apr 10, 2024
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.

2 participants