quality of life tweaks, particularly around x.com

This commit is contained in:
NunoSempere 2024-07-20 17:25:54 -04:00
parent a0f79388e9
commit 1c9fbe1122
6 changed files with 11 additions and 6 deletions

View File

@ -4,7 +4,7 @@
// Key user config // Key user config
#define WIDTH 1920 // 960 for half-width, 1920 for full width #define WIDTH 1920 // 960 for half-width, 1920 for full width
// #define HEIGHT 1080 // #define HEIGHT 1080
#define HEIGHT 1000 #define HEIGHT 990
#define BAR_SIZE 960 #define BAR_SIZE 960
// More user config // More user config

View File

@ -35,7 +35,7 @@ int libre_redirect(const char* uri, char* output)
// previously: "https://old.reddit.com", "https://teddit.nunosempere.com", // previously: "https://old.reddit.com", "https://teddit.nunosempere.com",
// https://github.com/redlib-org/redlib-instances/blob/main/instances.md // https://github.com/redlib-org/redlib-instances/blob/main/instances.md
"https://vitalik.eth.limo", "https://vitalik.eth.limo",
"https://invidious.nerdvpn.de", "https://invidious.private.coffee",
"https://search.nunosempere.com", "https://search.nunosempere.com",
"https://scribe.rip", "https://scribe.rip",
"https://translate.riverside.rocks", "https://translate.riverside.rocks",

View File

@ -1,7 +1,7 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#define STYLE_N 7831 + 1000 #define STYLE_N 8048 + 1000
void read_style_js(char* string) void read_style_js(char* string)
{ {

View File

@ -1,5 +1,5 @@
#pragma once #pragma once
#define STYLE_N 7831 + 1000 #define STYLE_N 8048 + 1000
void read_style_js(char* string); void read_style_js(char* string);

View File

@ -1,8 +1,10 @@
// Inspired by the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/> // 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 // Main part of the code: switch on the domain and select the corresponding style
var styles = null; var styles = null;
console.log(document.domain); // console.log(document.domain);
switch (document.domain) { switch (document.domain) {
case "forum.effectivealtruism.org": case "forum.effectivealtruism.org":
styles = ` styles = `
@ -98,6 +100,7 @@ switch (document.domain) {
`; `;
break; break;
case "twitter.com": case "twitter.com":
case "x.com":
styles = ` styles = `
/* hide promoted tweets */ /* hide promoted tweets */
:has(meta[property="og:site_name"][content="Twitter"]) :has(meta[property="og:site_name"][content="Twitter"])
@ -114,7 +117,7 @@ switch (document.domain) {
display: none !important; display: none !important;
} }
[data-testid^="sidebarColumn"] { [data-testid^="sidebarColumn"] {
display: none; display: none !important;
} }
/* Hide DMs v2 */ /* Hide DMs v2 */
@ -181,6 +184,7 @@ switch (document.domain) {
`; `;
break; break;
default: default:
console.log(`Domain: ${document.domain}`)
console.log("No custom style"); console.log("No custom style");
} }

View File

@ -91,6 +91,7 @@ void handle_signal_load_changed(WebKitWebView* self, WebKitLoadEvent load_event,
redirect_if_annoying(self, webkit_web_view_get_uri(self)); redirect_if_annoying(self, webkit_web_view_get_uri(self));
break; break;
case WEBKIT_LOAD_FINISHED: { case WEBKIT_LOAD_FINISHED: {
set_custom_style(self);
/* Add gtk tab title */ /* Add gtk tab title */
const char* webpage_title = webkit_web_view_get_title(self); const char* webpage_title = webkit_web_view_get_title(self);
const int max_length = 25; const int max_length = 25;