From 1c9fbe1122a98022dc416651a106cead26ee2faa Mon Sep 17 00:00:00 2001 From: NunoSempere Date: Sat, 20 Jul 2024 17:25:54 -0400 Subject: [PATCH] quality of life tweaks, particularly around x.com --- config.h | 2 +- plugins/libre_redirect/libre_redirect.c | 2 +- plugins/style/style.c | 2 +- plugins/style/style.h | 2 +- plugins/style/style.js | 8 ++++++-- rosenrot.c | 1 + 6 files changed, 11 insertions(+), 6 deletions(-) diff --git a/config.h b/config.h index 7fb8d22..93f89cc 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ // Key user config #define WIDTH 1920 // 960 for half-width, 1920 for full width // #define HEIGHT 1080 -#define HEIGHT 1000 +#define HEIGHT 990 #define BAR_SIZE 960 // More user config diff --git a/plugins/libre_redirect/libre_redirect.c b/plugins/libre_redirect/libre_redirect.c index b6835fc..3317481 100644 --- a/plugins/libre_redirect/libre_redirect.c +++ b/plugins/libre_redirect/libre_redirect.c @@ -35,7 +35,7 @@ int libre_redirect(const char* uri, char* output) // previously: "https://old.reddit.com", "https://teddit.nunosempere.com", // https://github.com/redlib-org/redlib-instances/blob/main/instances.md "https://vitalik.eth.limo", - "https://invidious.nerdvpn.de", + "https://invidious.private.coffee", "https://search.nunosempere.com", "https://scribe.rip", "https://translate.riverside.rocks", diff --git a/plugins/style/style.c b/plugins/style/style.c index df9ad0c..90f4d18 100644 --- a/plugins/style/style.c +++ b/plugins/style/style.c @@ -1,7 +1,7 @@ #include #include #include -#define STYLE_N 7831 + 1000 +#define STYLE_N 8048 + 1000 void read_style_js(char* string) { diff --git a/plugins/style/style.h b/plugins/style/style.h index a7097f4..7f581a2 100644 --- a/plugins/style/style.h +++ b/plugins/style/style.h @@ -1,5 +1,5 @@ #pragma once -#define STYLE_N 7831 + 1000 +#define STYLE_N 8048 + 1000 void read_style_js(char* string); diff --git a/plugins/style/style.js b/plugins/style/style.js index 6680ec2..593b033 100644 --- a/plugins/style/style.js +++ b/plugins/style/style.js @@ -1,8 +1,10 @@ // Inspired by the Stylus app: +// NOTE: This file is moved to /opt/rosenrot, so editing it here doesn't have direct effects on the runtime!! + // Main part of the code: switch on the domain and select the corresponding style var styles = null; -console.log(document.domain); +// console.log(document.domain); switch (document.domain) { case "forum.effectivealtruism.org": styles = ` @@ -98,6 +100,7 @@ switch (document.domain) { `; break; case "twitter.com": + case "x.com": styles = ` /* hide promoted tweets */ :has(meta[property="og:site_name"][content="Twitter"]) @@ -114,7 +117,7 @@ switch (document.domain) { display: none !important; } [data-testid^="sidebarColumn"] { - display: none; + display: none !important; } /* Hide DMs v2 */ @@ -181,6 +184,7 @@ switch (document.domain) { `; break; default: + console.log(`Domain: ${document.domain}`) console.log("No custom style"); } diff --git a/rosenrot.c b/rosenrot.c index 0284c7b..f2ef868 100644 --- a/rosenrot.c +++ b/rosenrot.c @@ -91,6 +91,7 @@ void handle_signal_load_changed(WebKitWebView* self, WebKitLoadEvent load_event, redirect_if_annoying(self, webkit_web_view_get_uri(self)); break; case WEBKIT_LOAD_FINISHED: { + set_custom_style(self); /* Add gtk tab title */ const char* webpage_title = webkit_web_view_get_title(self); const int max_length = 25;