aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNunoSempere <nuno.sempere@protonmail.com>2023-02-08 14:29:36 +0100
committerNunoSempere <nuno.sempere@protonmail.com>2023-02-08 14:29:36 +0100
commitc10b7632ebcedff280c4be1357977ae26eff4eaa (patch)
treebe358891123250b81faa644d81f348233b4937de
parent2db650d7cc0600a0ccdc5ba31ad3a97b3b74a6ea (diff)
feat: add possibility of launching many tabs at once.
also, personalize this: - enable extensions - change to my css - change relative paths. fix various bugs: - set the zoom level in notebook_append, not in notebook_init - have a handly debug option for valgrind
-rwxr-xr-xbuild.sh5
-rw-r--r--config.h2
-rw-r--r--plugins/readability/readability.c2
-rw-r--r--plugins/stand_in/stand_in.c.old (renamed from plugins/stand_in/stand_in.c)0
-rw-r--r--plugins/style/style.c2
-rw-r--r--rose.c28
-rw-r--r--style.css19
-rwxr-xr-xuser-scripts/ubuntu-20.04/rose.desktop2
-rw-r--r--user-scripts/valgrind-notes.md9
9 files changed, 54 insertions, 15 deletions
diff --git a/build.sh b/build.sh
index 561d03d..3518b0a 100755
--- a/build.sh
+++ b/build.sh
@@ -2,9 +2,10 @@
CC=clang
SRC=rose.c
-REQS=./plugins/*/*.c
# REQS=./plugins/stand_in/stand_in.c
+REQS=./plugins/*/*.c
DEPS='webkit2gtk-4.0'
+DEBUG= #'-g'
INCS=`pkg-config --cflags ${DEPS}`
LIBS=`pkg-config --libs ${DEPS}`
@@ -13,4 +14,4 @@ LIBS=`pkg-config --libs ${DEPS}`
WYEBAB='-L/usr/lib/wyebrowser/adblock.so'
# cp -f config.def.h config.h
-$CC $INCS $REQS $SRC -o rose $LIBS $WYEBAB
+$CC $DEBUG $INCS $REQS $SRC -o rose $LIBS $WYEBAB
diff --git a/config.h b/config.h
index ae87a76..970823e 100644
--- a/config.h
+++ b/config.h
@@ -20,7 +20,7 @@
#define GTK "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
#define ROSE_HOMEPAGE true
-#define HOME ROSE_HOMEPAGE ? "file:///home/loki/Documents/core/software/fresh/C/rose-browser/rose-bud-personal/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png" : "https://lite.duckduckgo.com/html"
+#define HOME ROSE_HOMEPAGE ? "file:///home/loki/Documents/core/software/fresh/C/rose-browser/rose-browser/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png" : "https://lite.duckduckgo.com/html"
#define SEARCH "https://lite.duckduckgo.com/html/?q=%s"
#define CACHE_DIR "/home/loki/.cache/rose"
diff --git a/plugins/readability/readability.c b/plugins/readability/readability.c
index d7d1ed9..0ae9d44 100644
--- a/plugins/readability/readability.c
+++ b/plugins/readability/readability.c
@@ -4,7 +4,7 @@
#define READABILITY_N 84251 + 1
void read_readability_js(char* string){
- FILE *fp=fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rose-bud-personal/plugins/readability/readability.js", "r");
+ FILE *fp=fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rose-browser/plugins/readability/readability.js", "r");
if (!fp) { // fp is NULL, fopen failed
fprintf(stderr, "Failed to open file\n");
string=NULL;
diff --git a/plugins/stand_in/stand_in.c b/plugins/stand_in/stand_in.c.old
index dbcc7e8..dbcc7e8 100644
--- a/plugins/stand_in/stand_in.c
+++ b/plugins/stand_in/stand_in.c.old
diff --git a/plugins/style/style.c b/plugins/style/style.c
index dc2da8a..7e8ddf0 100644
--- a/plugins/style/style.c
+++ b/plugins/style/style.c
@@ -4,7 +4,7 @@
#define STYLE_N 794 + 1
void read_style_js(char* string){
- FILE *fp=fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rose-bud-personal/plugins/style/style.js", "r");
+ FILE *fp=fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rose-browser/plugins/style/style.js", "r");
if (!fp) { // fp is NULL, fopen failed
fprintf(stderr, "Failed to open file\n");
string=NULL;
diff --git a/rose.c b/rose.c
index c23a00d..4f668d6 100644
--- a/rose.c
+++ b/rose.c
@@ -21,9 +21,9 @@
// #include "plugins/stand_in/stand_in.h"
-int LIBRE_REDIRECT_ENABLED = false;
-int READABILITY_ENABLED = false;
-int CUSTOM_STYLE_ENABLED = false;
+int LIBRE_REDIRECT_ENABLED = true;
+int READABILITY_ENABLED = true;
+int CUSTOM_STYLE_ENABLED = true;
// to enable plugins,
// 1. Enable them:
@@ -210,6 +210,7 @@ void notebook_append(GtkNotebook *notebook, const char *uri)
load_uri(view, (uri) ? uri : HOME);
gtk_notebook_set_current_page(notebook, n);
gtk_notebook_set_tab_label_text(notebook, GTK_WIDGET(view), "-" );
+ webkit_web_view_set_zoom_level(view, ZOOM);
}
void show_bar(GtkNotebook *notebook)
@@ -413,8 +414,9 @@ void notebook_init(GtkNotebook *notebook, const char *uri)
notebook_append(notebook, uri);
}
-void setup(GtkNotebook *notebook, const char *uri)
+void setup(GtkNotebook *notebook, int argc, char **argv)
{
+ // Define GTK entities
window = GTK_WINDOW(gtk_window_new(0));
notebook = GTK_NOTEBOOK(gtk_notebook_new());
bar = GTK_HEADER_BAR(gtk_header_bar_new());
@@ -422,19 +424,31 @@ void setup(GtkNotebook *notebook, const char *uri)
search = GTK_ENTRY(gtk_entry_new_with_buffer(search_buf));
gtk_window_set_default_size(window, WIDTH, HEIGHT);
window_init(notebook);
- notebook_init(notebook, uri);
+
+ // Initialize with first uri
+ char *first_uri = argc > 1 ? argv[1] : NULL;
+ notebook_init(notebook, first_uri);
g_object_set(gtk_settings_get_default(), GTK, NULL);
+ // More GTK stuff
gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(notebook));
gtk_widget_show_all(GTK_WIDGET(window));
gtk_widget_hide(GTK_WIDGET(bar));
- webkit_web_view_set_zoom_level(notebook_get_webview(notebook), ZOOM);
+
+ // Deal with more uris, if this is necessary.
+ if(argc > 2){
+ gtk_notebook_set_show_tabs(notebook, true);
+ for(int i = 2; i<argc; i++){
+ notebook_append(notebook, argv[i]);
+ }
+ }
}
int main(int argc, char **argv)
{
GtkNotebook *notebook;
gtk_init(NULL, NULL);
- setup(notebook, argc > 1 ? argv[1] : NULL);
+ setup(notebook, argc, argv);
gtk_main();
+ // this point is never reached, since gtk_main(); never exits.
}
diff --git a/style.css b/style.css
index 45805d7..c7c07b6 100644
--- a/style.css
+++ b/style.css
@@ -10,7 +10,10 @@
margin: 0px;
outline-color: @Lavender;
color: @Text;
- border-bottom-color: @Base;
+ border-color: white;
+ font-size: 16px;
+ /*@Base; */
+ /* border-bottom-color: @Base; */
}
window, notebook, headerbar {
@@ -20,11 +23,21 @@ window, notebook, headerbar {
tabs {
background-color: @Base;
padding: 3px;
+ outline-color: white;
+ border-color: @Base;
}
tab {
background-color: @Base;
+ margin: 2px 5px 2px 0px;
+ padding: 5px;
+ border-style: solid;
+ /*border-color: white;
+ border-bottom-color: white;
+ outline-color: white;
margin: 5px;
+ padding-left: 10px;
+ padding-right: 10px; */
}
entry {
@@ -33,5 +46,7 @@ entry {
}
entry:focus {
- box-shadow: none;
+ background-color: @Surface0;
+ padding-left: 10px;
+
}
diff --git a/user-scripts/ubuntu-20.04/rose.desktop b/user-scripts/ubuntu-20.04/rose.desktop
index 42e7f43..213beb8 100755
--- a/user-scripts/ubuntu-20.04/rose.desktop
+++ b/user-scripts/ubuntu-20.04/rose.desktop
@@ -6,4 +6,4 @@ Terminal=false
Exec= /usr/bin/rose
Name=Rose
Comment=Minimalistic browser
-Icon=/home/loki/Documents/core/software/fresh/C/rose-browser/rose-bud-personal/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
+Icon=/home/loki/Documents/core/software/fresh/C/rose-browser/rose-browser/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
diff --git a/user-scripts/valgrind-notes.md b/user-scripts/valgrind-notes.md
new file mode 100644
index 0000000..1fa2e1d
--- /dev/null
+++ b/user-scripts/valgrind-notes.md
@@ -0,0 +1,9 @@
+In case you arrive at a segmentation fault when working on rose, you can use valgrind.
+
+To do this, you can compile rose with the `DEBUG` value in `build.sh` set to `-g`
+
+and then:
+
+```
+valgrind --track-origins=yes ./rose
+```