dillo-plus icon indicating copy to clipboard operation
dillo-plus copied to clipboard

User reader mode CSS

Open wwp opened this issue 9 months ago • 0 comments

Hi,

it was so nice to discover dillo+ and its enhancements! I noticed that it's not currently possible to use a custom style_reader_mode.css (in ~/.dillo/), whereas it sounds to me as pertinent as being able to use a custom style.css.

The following trivial patch does it:

--- src/styleengine.cc-orig	2024-07-31 10:07:15.000000000 +0200
+++ src/styleengine.cc	2025-03-05 15:41:31.633144102 +0100
@@ -1069,10 +1069,15 @@
 
 void StyleEngine::buildReaderModeStyle () {
    Dstr *style;
+   char *reader_mode_filename = dStrconcat(dGethomedir(), "/.dillo/style_reader_mode.css", NULL);
    const char *sys_reader_mode_filename = DILLO_SYSCONF "style_reader_mode.css";
 
-   if ((style = a_Misc_file2dstr(sys_reader_mode_filename))) {
+   if ((style = a_Misc_file2dstr(reader_mode_filename))) {
+      CssParser::parse (NULL,NULL,cssContext,style->str, style->len,CSS_ORIGIN_USER);
+      dStr_free (style, 1);
+   } else if ((style = a_Misc_file2dstr(sys_reader_mode_filename))) {
       CssParser::parse (NULL,NULL,cssContext,style->str, style->len,CSS_ORIGIN_USER);
       dStr_free (style, 1);
    }
+   dFree (reader_mode_filename);
 }

Are you willing to bring this feature in further dillo+ releases?

Regards,

wwp avatar Mar 05 '25 14:03 wwp