diff --git a/README.md b/README.md index 132539a..0770103 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Rosenrot -Rosenrot is a small browser forked from an earlier version of [rose](https://github.com/mini-rose/rose). It has some additional quality of life improvements tailored to my (@NunoSempere) tastes and setup, and detailed installation instructions for Ubuntu 20.04. +Rosenrot is a small browser forked from an earlier version of [rose](https://github.com/mini-rose/rose). It has some additional quality of life improvements tailored to my (@NunoSempere) tastes and setup, and detailed installation instructions for Debian 12. ![](https://raw.githubusercontent.com/NunoSempere/rosenrot-browser/master/images/7-hello-world-search.png) @@ -8,7 +8,7 @@ Rosenrot is a small browser forked from an earlier version of [rose](https://git ### Installation and usage -You can see detailed instructions [here](./user-scripts/ubuntu-20.04/install-with-dependencies.sh), for Ubuntu 20.04 in particular—though they should generalize easily to other distributions. Or a video installing rosenrot in a fresh Ubuntu 20.04 virtual machine [here](https://video.nunosempere.com/w/t3oAvJLPHTSAMViQ6zbwTV). +You can see detailed instructions [here](./user-scripts/debian-12/install-with-dependencies.sh), for Debian 12 in particular—though they should generalize easily to other distributions. The general steps are to install dependencies, and then @@ -26,7 +26,7 @@ make install rose ``` -You can also create a rose.desktop file so that it will show up in your desktop environment. You can see this documented [here](./user-scripts/ubuntu-20.04/install-with-dependencies.sh). +You can also create a rose.desktop file so that it will show up in your desktop environment. You can see this documented [here](./user-scripts/debian-12/install-with-dependencies.sh). ## Features @@ -50,6 +50,7 @@ You can see some screenshots in the [images](./images) folder. ### Relationship with [rose](https://github.com/mini-rose/rose) - Rose is a small browser based on webkit2gtk. Previously, it described itself as aiming to be a "basement for creating your own browser using [the] gtk and webkit libraries". It has since diverged into a more featureful small browser with lua bindings, and rebased its history. You can see the original, minimal version [here](https://github.com/NunoSempere/rosenrot-browser/blob/a45d1c70f58586fed97df70650e5d066b73d0a0d/rose.c). +- The current version offers compilation with both GTK3 and GTK4, and an up to date version of webkit. - Rosenrot is my (@NunoSempere's) fork from that earlier minimal rose. It has accumulated quality of life features and, honestly, cruft, that I like, like a "readability" plugin that simplifies annoying websites like [Matt Levine's Money Stuff newsletter](https://www.bloomberg.com/opinion/articles/2022-10-18/matt-levine-s-money-stuff-credit-suisse-was-a-reverse-meme-stock). It also incorporates ad-blocking. - Rosenrot is also a song by the German hardcore rock band [Rammstein](https://www.youtube.com/watch?v=af59U2BRRAU). @@ -62,6 +63,7 @@ You can see some screenshots in the [images](./images) folder. - Anecdotically, surf feels slower, though I haven't tested this rigorously. - surf has a larger community, with patches and modifications. - surf is more opinionated, but also less amateurish. +- Like rosenrot until very recently, it [uses](https://git.suckless.org/surf/file/config.mk.html#l15) an obsolete & deprecated version of [webkit](https://blogs.gnome.org/mcatanzaro/2023/03/21/webkitgtk-api-for-gtk-4-is-now-stable/) - My recommendation would be to use rosenrot, and if you find some feature missing, either look how surf does it and import it to rose, or move to surf. - But then again, I've built rosenrot to cater to my own tastes, so I'd say that. @@ -80,4 +82,15 @@ The "architecture" of the application looks as follows: Specific to my own system: -- [ ] At some point, I tried to install libsoup-3 and borked some unknown installation option/paths. So now I need to run rose with `GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/ /bin/rose` (or put `export GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/` in my .bashrc). This won't affect new users though, just double checked on a fresh machine. +## webkit2gtk-4.0 vs webkit2gtk-4.1 vs webkit2gtk-6.0 + +See [this blog post](https://blogs.gnome.org/mcatanzaro/2023/03/21/webkitgtk-api-for-gtk-4-is-now-stable/) for details. webkit2gtk-4.0 is deprecated, webkit2gtk-4.1 is the current [stable](https://webkitgtk.org/reference/webkit2gtk/stable/index.html) release and uses GTK3. webkit2gtk-6.0 is the current [unstable](https://webkitgtk.org/reference/webkitgtk/unstable/index.html) release, and uses GTK4. + +Migration instructions for migration to webkit2gtk-6 and GTK4 can be seen [here](https://github.com/WebKit/WebKit/blob/ed1422596dce5ff012e64a38faf402ac1674fc7e/Source/WebKit/gtk/migrating-to-webkitgtk-6.0.md) and [here](https://docs.gtk.org/gtk4/migrating-3to4.html). + +Rosenrot is currently on the stable webkit2gtk-4.1 release using GTK3. It has plans to eventually migrate to webkit2gtk-6.0 eventually but not soon. + +## Ubuntu 20.04 + +A previous version of this repository was based on Ubuntu 20.04. You can still see documentation for that distribution [here](https://git.nunosempere.com/open.source/rosenrot/src/commit/8a1e0be30df52d5a21109297fd5bbc20efec1b3b), particularly a video installing rosenrot in a fresh Ubuntu 20.04 virtual machine [here](https://video.nunosempere.com/w/t3oAvJLPHTSAMViQ6zbwTV). However, that uses the webkit2gtk-4.0 library. Instead, I recommend adapting the Debian 12 instructions. + diff --git a/TODO.md b/TODO.md index bf02638..b54933c 100644 --- a/TODO.md +++ b/TODO.md @@ -14,6 +14,7 @@ - Instructions for GTK-4 [here](https://docs.gtk.org/gtk4/migrating-3to4.html) - [ ] Update to webkit2gtk-4.1 - [ ] Prepare for GTK-3 to GTK-4 transition + - [ ] Understand wtf is going on with signals and events: . - [ ] Remove webkit2gtk-4.1 and download webkit2gtk-6.0 - [ ] Attempt to compile - [ ] Change README and point to last Ubuntu 20.04 commit diff --git a/config.h b/config.h index 7513012..01ee91e 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,8 @@ #include #include // Previously: #include -// But GTK now discourages including the individual headers +// But GTK3 discourages including the individual headers +// In GTK4, the location also changes to // Key user config #define WIDTH 1920 // 960 for half-width, 1920 for full width @@ -107,23 +108,23 @@ static struct { * */ /* Old controls: { - { CTRL, KEY(h), goback }, - { CTRL, KEY(l), goforward }, - { CTRL, KEY(r), refresh }, + { CTRL, KEY(h), goback }, + { CTRL, KEY(l), goforward }, + { CTRL, KEY(r), refresh }, { CTRL | SFT, KEY(R), refresh_force }, { CTRL | SFT, KEY(H), back_to_home }, - { CTRL, KEY(equal), zoomin }, - { CTRL, KEY(minus), zoomout }, - { CTRL, KEY(0), zoom_reset }, - { ALT, KEY(h), prev_tab }, + { CTRL, KEY(equal), zoomin }, + { CTRL, KEY(minus), zoomout }, + { CTRL, KEY(0), zoom_reset }, + { ALT, KEY(h), prev_tab }, { CTRL, KEY(k), hide_searchbar }, - { ALT, KEY(l), next_tab }, - { CTRL, KEY(w), close_tab }, - { 0x0, KEY(F11), toggle_fullscreen }, - { CTRL, KEY(e), show_searchbar }, - { CTRL, KEY(f), show_finder }, - { CTRL, KEY(n), finder_next }, - { CTRL | SFT, KEY(N), finder_prev }, + { ALT, KEY(l), next_tab }, + { CTRL, KEY(w), close_tab }, + { 0x0, KEY(F11), toggle_fullscreen }, + { CTRL, KEY(e), show_searchbar }, + { CTRL, KEY(f), show_finder }, + { CTRL, KEY(n), finder_next }, + { CTRL | SFT, KEY(N), finder_prev }, { CTRL, KEY(p), prettify } }; */ diff --git a/makefile b/makefile index 286231d..084f15f 100644 --- a/makefile +++ b/makefile @@ -51,7 +51,7 @@ build: $(SRC) $(PLUGINS) $(CONFIG) sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} + # Compile rosenrot GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/ - $(CC) $(WARNINGS) $(OPTIMIZED_SOME) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) $(COMPILETIME_DEPRECATION_WARNINGS) -o rose $(LIBS) $(ADBLOCK) + $(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) $(COMPILETIME_DEPRECATION_WARNINGS) -o rose $(LIBS) $(ADBLOCK) fast: $(SRC) $(PLUGINS) $(CONFIG) rm -f *.gcda diff --git a/rose b/rose index 8a51275..f3c043b 100755 Binary files a/rose and b/rose differ diff --git a/rose.c b/rose.c index b30a502..b2478c4 100644 --- a/rose.c +++ b/rose.c @@ -17,7 +17,7 @@ static struct { enum { _SEARCH, _FIND, _HIDDEN } entry_mode; -} bar; // top bar. +} bar; static int num_tabs = 0; /* Utils */ @@ -179,11 +179,9 @@ WebKitWebView* create_new_webview() void notebook_create_new_tab(GtkNotebook* notebook, const char* uri) { if (num_tabs < MAX_NUM_TABS || MAX_NUM_TABS == 0) { - GdkScreen* screen = gtk_window_get_screen(GTK_WINDOW(window)); WebKitWebView* view = create_new_webview(); - gtk_widget_set_visual(GTK_WIDGET(window), rgba_visual); g_signal_connect(view, "load_changed", G_CALLBACK(handle_signal_load_changed), notebook); g_signal_connect(view, "create", G_CALLBACK(handle_signal_create_new_tab), notebook); @@ -381,13 +379,14 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook) GdkModifierType event_state = 0; gdk_event_get_state(event, &event_state); - /* + int debug_shortcuts = 0; + if(debug_shortcuts){ printf("Keypress state: %d\n", event_state); - if(event->key.state & GDK_CONTROL_MASK){ + if(event_state & GDK_CONTROL_MASK){ printf("Keypress state is: CONTROL\n"); } printf("Keypress value: %d\n", event_keyval); - */ + } for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++) if ((event_state & shortcut[i].mod || shortcut[i].mod == 0x0) && event_keyval == shortcut[i].key) @@ -400,6 +399,9 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook) - - https://docs.gtk.org/gdk3/struct.EventButton.html */ + /* + This API is deprecated in GTK4 :( + */ return 0; } diff --git a/user-scripts/.old/ubuntu-20.04/README.md b/user-scripts/.old/ubuntu-20.04/README.md new file mode 100644 index 0000000..2b1a61a --- /dev/null +++ b/user-scripts/.old/ubuntu-20.04/README.md @@ -0,0 +1 @@ +This uses the libwebkit2gtk-4.0 api. It is deprecated. See the debian version for how to use the -4.1 version instead. Package names might vary. diff --git a/user-scripts/ubuntu-20.04/install-with-dependencies.sh b/user-scripts/.old/ubuntu-20.04/install-with-dependencies.sh similarity index 100% rename from user-scripts/ubuntu-20.04/install-with-dependencies.sh rename to user-scripts/.old/ubuntu-20.04/install-with-dependencies.sh diff --git a/user-scripts/ubuntu-20.04/rose-GIO_MODULE_DIR.desktop b/user-scripts/.old/ubuntu-20.04/rose-GIO_MODULE_DIR.desktop similarity index 100% rename from user-scripts/ubuntu-20.04/rose-GIO_MODULE_DIR.desktop rename to user-scripts/.old/ubuntu-20.04/rose-GIO_MODULE_DIR.desktop diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-1.png b/user-scripts/.old/ubuntu-20.04/rose-images/rose-1.png similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-1.png rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-1.png diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-2.png b/user-scripts/.old/ubuntu-20.04/rose-images/rose-2.png similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-2.png rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-2.png diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png b/user-scripts/.old/ubuntu-20.04/rose-images/rose-desktop-icon.png similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-desktop-icon.png diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-homepage-1.6-zoom.png b/user-scripts/.old/ubuntu-20.04/rose-images/rose-homepage-1.6-zoom.png similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-homepage-1.6-zoom.png rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-homepage-1.6-zoom.png diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-homepage-2.png b/user-scripts/.old/ubuntu-20.04/rose-images/rose-homepage-2.png similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-homepage-2.png rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-homepage-2.png diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png b/user-scripts/.old/ubuntu-20.04/rose-images/rose-homepage.png similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-homepage.png rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-homepage.png diff --git a/user-scripts/ubuntu-20.04/rose-images/rose-src.txt b/user-scripts/.old/ubuntu-20.04/rose-images/rose-src.txt similarity index 100% rename from user-scripts/ubuntu-20.04/rose-images/rose-src.txt rename to user-scripts/.old/ubuntu-20.04/rose-images/rose-src.txt diff --git a/user-scripts/ubuntu-20.04/rose.desktop b/user-scripts/.old/ubuntu-20.04/rose.desktop similarity index 100% rename from user-scripts/ubuntu-20.04/rose.desktop rename to user-scripts/.old/ubuntu-20.04/rose.desktop diff --git a/user-scripts/ubuntu-20.04/rose.sh b/user-scripts/.old/ubuntu-20.04/rose.sh similarity index 100% rename from user-scripts/ubuntu-20.04/rose.sh rename to user-scripts/.old/ubuntu-20.04/rose.sh