-
-
Notifications
You must be signed in to change notification settings - Fork 106
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
Adding custom.css #370
Conversation
There was a problem hiding this 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! :)
src/ui/WebView.cpp
Outdated
@@ -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)) { |
There was a problem hiding this comment.
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?
src/ui/WebView.cpp
Outdated
@@ -171,6 +175,9 @@ namespace wfl::ui | |||
{ | |||
auto const webContext = webkit_web_view_get_context(*this); | |||
|
|||
std::string configDir = Glib::get_user_config_dir(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use auto
src/ui/WebView.cpp
Outdated
@@ -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"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also auto
There was a problem hiding this comment.
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.
src/ui/WebView.cpp
Outdated
} | ||
|
||
std::string WebView::loadCssContent(const std::string& cssFilePath) { | ||
std::ifstream cssFile(cssFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use auto
src/ui/WebView.cpp
Outdated
|
||
std::string WebView::loadCssContent(const std::string& cssFilePath) { | ||
std::ifstream cssFile(cssFilePath); | ||
std::string cssContent((std::istreambuf_iterator<char>(cssFile)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use auto
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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};
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
should be fine now! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
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:
custom.css
to~/.config/whatsapp-for-linux
* { color: red !important }