rosenrot-browser

A hackable browser based on Webkitgtk
Log | Files | Refs | README

commit 1c9fbe1122a98022dc416651a106cead26ee2faa
parent a0f79388e98a323471463ee9bbfeed74c525eb33
Author: NunoSempere <nuno.semperelh@protonmail.com>
Date:   Sat, 20 Jul 2024 17:25:54 -0400

quality of life tweaks, particularly around x.com

Diffstat:
Mconfig.h | 2+-
Mplugins/libre_redirect/libre_redirect.c | 2+-
Mplugins/style/style.c | 2+-
Mplugins/style/style.h | 2+-
Mplugins/style/style.js | 8++++++--
Mrosenrot.c | 1+
6 files changed, 11 insertions(+), 6 deletions(-)

diff --git 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 @@ -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 @@ -1,7 +1,7 @@ #include <stdio.h> #include <stdlib.h> #include <string.h> -#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 @@ -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 @@ -1,8 +1,10 @@ // Inspired by the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/> +// 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 @@ -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;