Compare commits

..

7 Commits

27 changed files with 92 additions and 83 deletions

0
.gitignore vendored
View File

View File

@ -45,7 +45,27 @@ You can also create a rose.desktop file so that it will show up in your desktop
You can see some screenshots in the [images](./images) folder.
## Comparisons
## Similar projects
Here are some similar projects that I could find (minimalist, mostly based on webkit):
- [Surf](https://git.suckless.org/surf/). Suckless community. Similar goals, higher coding standards, less actively maintained.
- [Rose](https://github.com/mini-rose/rose-browser). Lua integrations, supports compilation with GTK4. Every now and then, the developer nukes the git history and tries some different approach.
- [Epiphany](https://gitlab.gnome.org/GNOME/epiphany). GNOME. Clean browser, distributed via flathub, aimed at nontechnical users. Seems actively maintained.
- [Vimb](https://github.com/fanglingsu/vimb). Reasonably actively maintained, vim keybindings.
- [Nyxt](https://github.com/atlas-engineer/nyxt). Emphasis on sophisticated key bindings.
- [Wyeb](https://github.com/jun7/wyeb)
- [Luakit](https://github.com/luakit/luakit)
- ~~[Qutebrowser](https://github.com/qutebrowser/qutebrowser). More actively maintained. I don't understand the tech stack.~~ [Based](https://github.com/qutebrowser/qutebrowser/blob/main/doc/faq.asciidoc) on [Chromium](https://wiki.qt.io/QtWebEngine)
Here are other projects I haven't checked out as much: [netsurf](https://www.netsurf-browser.org/), [uzbl](https://www.uzbl.org/), [edbrowse](https://github.com/CMB/edbrowse),
Here are projects with their own rendering engines which could appeal to users of rosenrot:
- [lynx](https://lynx.invisible-island.net/) (links, elinks), [w3m](https://w3m.sourceforge.net/): command line browsers.
- [dillo](https://github.com/dillo-browser/dillo/). Has its own rendering engine, and no javascript.
- [Ladybird](https://github.com/SerenityOS/serenity/tree/master/Ladybird). SerenityOS. Uses its own html and javascript engine. Compiling it on a mainstream Linux distribution, and documenting instructions could be an interesting project, but the few times I've tried that I've failed.
- [servo](https://github.com/servo/servo). Firefox/Mozilla. An in-development browser engine written in Rust, meant to replace Gecko. Could be extremely cool once it is ready, but it has been many years in development.
### Relationship with [rose](https://github.com/mini-rose/rose)
@ -80,15 +100,13 @@ The "architecture" of the application looks as follows:
![](https://raw.githubusercontent.com/NunoSempere/rosenrot-browser/master/images/0-architecture.png)
Specific to my own system:
## 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.
Rosenrot is currently on the stable webkit2gtk-4.1 release using GTK3, and has removed deprecated webkit apis. It has plans to eventually migrate to webkit2gtk-6.0 eventually but not soon, because the GTK4 rewrite seems onerous.
## Ubuntu 20.04

15
TODO.md
View File

@ -3,24 +3,25 @@
## Quality of life:
- [ ] Document creating new applications, e.g., as in [Asana for Linux](https://git.nunosempere.com/NunoSempere/asana-for-linux)
- [ ] Add list of similar projects: <https://github.com/qutebrowser/qutebrowser#similar-projects>
- [x] Compare against rose
- [x] Compare against surf
- [ ] Set [`webkit_web_context_set_sandbox_enabled`](<https://webkitgtk.org/reference/webkit2gtk/2.36.8/WebKitWebContext.html#webkit-web-context-set-sandbox-enabled>), as recommended [here](<https://blogs.gnome.org/mcatanzaro/2022/11/04/stop-using-qtwebkit/>)
- [ ] Use something other than Whatsapp as an example syslink.
- [ ] Fix bug about distorted audio. Maybe related to [this pipewire issue](<https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/1547>)?
- [ ] Upgrade to GTK-4 / Webkitgtk 6.0? Will take a fair amount of time, since these are not available on Ubuntu 20.04.
- [ ] Upgrade to GTK-4 / Webkitgtk 6.0? Will take a fair amount of time, since GTK4 redesigns the application model somewhat.
- Instructions for webkit-6.0 [here](https://github.com/WebKit/WebKit/blob/ed1422596dce5ff012e64a38faf402ac1674fc7e/Source/WebKit/gtk/migrating-to-webkitgtk-6.0.md)
- 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: <https://docs.gtk.org/gtk4/migrating-3to4.html#stop-using-gtkwidget-event-signals>. <https://github.com/mini-rose/rose-browser/blob/288bf060d095c4895946669ae50d14193168b69c/src/window.c#L42>
- [ ] Remove webkit2gtk-4.1 and download webkit2gtk-6.0
- [ ] Attempt to compile
- [ ] Change README and point to last Ubuntu 20.04 commit
# Previously done
- ~~[ ] Set [`webkit_web_context_set_sandbox_enabled`](<https://webkitgtk.org/reference/webkit2gtk/2.36.8/WebKitWebContext.html#webkit-web-context-set-sandbox-enabled>), as recommended [here](<https://blogs.gnome.org/mcatanzaro/2022/11/04/stop-using-qtwebkit/>)~~. Irrelevant with upgrade to libsoup3.
- [x] Update to webkit2gtk-4.1
- [x] Change README and point to last Ubuntu 20.04 commit
- [x] Add list of similar projects: <https://github.com/qutebrowser/qutebrowser#similar-projects>
- [x] Add comparisons against rose & surf
- [x] Compare against rose
- [x] Compare against surf
- [x] ~~Doesn't work with when Spanish is selected as the language, for some reason~~ => Previously misdiagnosed. The real issue was that it freezes when interacting with [Espanso](https://espanso.org/) substitutions, which I had set-up automatically on my machine when using words containing an ñ, like my own name, Nuño.
- [x] Add css for js alerts
- [x] Add custom alert whose css can be customized

View File

@ -43,7 +43,7 @@ To remove plugins completely;
"enable-smooth-scrolling", false, \
"default-charset", "utf-8"
/* CACHE */
#define DATA_DIR "/home/nuno/.cache/rose"
#define DATA_DIR "/home/nuno/.cache/rosenrot"
#define DATA_MANAGER_OPTS "base-cache-directory", DATA_DIR, "base-data-directory", DATA_DIR
// GTK

View File

@ -1,6 +1,6 @@
MIT License
Copyright (c) 2022-2023 Nuño Sempere
Copyright (c) 2022-2024 Nuño Sempere
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -2,9 +2,9 @@
CC=gcc # other options: tcc, clang, zig cc
WARNINGS=-Wall
DEBUG=#'-g'
COMPILETIME_DEPRECATION_WARNINGS=#-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED # turns out that webkit2gtk-4.1 is using some deprecated stuff, lol
OPTIMIZED_SOME=-O3
OPTIMIZED_MORE=-Ofast -march=native -funit-at-a-time -flto # binary will not be compatible with other computers, but may be much faster
# COMPILETIME_DEPRECATION_WARNINGS=#-DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED # turns out that webkit2gtk-4.1 is using some deprecated stuff, lol
# Dependencies
DEPS='webkit2gtk-4.1'
@ -12,7 +12,7 @@ INCS=`pkg-config --cflags ${DEPS}`
LIBS=`pkg-config --libs ${DEPS}`
# Code
SRC=rose.c
SRC=rosenrot.c
CONFIG=config.h
## Plugins
@ -31,9 +31,9 @@ FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
# Change hardcoded paths when building
## Data dirs
USER=`whoami`
DEFAULT_DATA_DIR=/home/nuno/.cache/rose
CURRENT_DATA_DIR=/home/$(USER)/.cache/rose
## dir
DEFAULT_DATA_DIR=/home/nuno/.cache/rosenrot
USER_DATA_DIR=/home/$(USER)/.cache/rosenrot
## Startup image dir
DEFAULT_DIR=/home/nuno/Documents/workspace/rosenrot
CURRENT_DIR=`pwd`
@ -42,57 +42,59 @@ build: $(SRC) $(PLUGINS) $(CONFIG)
cd plugins/readability/ && sh recompute_READABILITY_N.sh
cd plugins/style && sh recompute_STYLE_N.sh
# Make cache
mkdir -p $(CURRENT_DATA_DIR)
mkdir -p $(USER_DATA_DIR)
# Hardcode cache path
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
sed -i "s|$(DEFAULT_DATA_DIR)|$(CURRENT_DATA_DIR)|g" {} +
sed -i "s|$(DEFAULT_DATA_DIR)|$(USER_DATA_DIR)|g" {} +
# Hardcode git repository path
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} +
# Compile rosenrot
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) $(COMPILETIME_DEPRECATION_WARNINGS) -o rose $(LIBS) $(ADBLOCK)
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
install: rosenrot
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
cp -f rosenrot /usr/bin
mkdir -p /usr/share/themes/rosenrot
cp style.css /usr/share/themes/rosenrot/
cp rosenrot-mklink /usr/bin
sudo mkdir -p /usr/bin/rosenrot-browser
sudo cp rosenrot /usr/bin/rosenrot-browser/twitter # custom twitter tweaks
uninstall:
rm -r /usr/share/themes/rosenrot
rm /usr/bin/rosenrot
rm /usr/bin/rosenrot-mklink
rm $(DATA_DIR)
clean:
rm rosenrot
rm $(DATA_DIR)
format: $(SRC) $(PLUGINS)
$(FORMATTER) $(SRC) $(PLUGINS) $(rosenrot.h)
lint:
clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.1'` -o rosenrot `pkg-config --libs 'webkit2gtk-4.1'`
## A few more commands:
fast: $(SRC) $(PLUGINS) $(CONFIG)
rm -f *.gcda
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) -fprofile-generate $(INCS) $(PLUGINS) $(SRC) -o rose $(LIBS) $(ADBLOCK)
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) -fprofile-generate $(INCS) $(PLUGINS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
@echo "Now use the browser for a while to gather some profiling data"
sleep 2
./rose
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) -fprofile-use $(INCS) $(PLUGINS) $(SRC) -o rose $(LIBS) $(ADBLOCK)
./rosenrot
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) -fprofile-use $(INCS) $(PLUGINS) $(SRC) -o rosenrot $(LIBS) $(ADBLOCK)
rm -f *.gcda
lint:
clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.1'` -o rose `pkg-config --libs 'webkit2gtk-4.1'`
inspect: build
GTK_DEBUG=interactive ./rose
install: rose
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
cp -f rose /usr/bin
mkdir -p /usr/share/themes/rose
cp style.css /usr/share/themes/rose/
cp rose-mklink /usr/bin
sudo mkdir -p /usr/bin/rose-browser
sudo cp rose /usr/bin/rose-browser/twitter # custom twitter tweaks
uninstall:
rm -r /usr/share/themes/rose
rm /usr/bin/rose
rm /usr/bin/rose-mklink
rm $(DATA_DIR)
clean:
rm rose
rm $(DATA_DIR)
format: $(SRC) $(PLUGINS)
$(FORMATTER) $(SRC) $(PLUGINS) $(rose.h)
GTK_DEBUG=interactive ./rosenrot
diagnose_deprecations:
G_ENABLE_DIAGNOSTIC=1 ./rose
G_ENABLE_DIAGNOSTIC=1 ./rosenrot
view-gtk3-version:
dpkg -l libgtk-3-0

4
plugins/plugins.h Normal file
View File

@ -0,0 +1,4 @@
#include "libre_redirect/libre_redirect.h"
#include "readability/readability.h"
#include "shortcuts/shortcuts.h"
#include "style/style.h"

Binary file not shown.

View File

@ -1,7 +1,7 @@
#!/bin/sh
test "$1" = "--help" || test -z "$1" && {
printf "%s\n" "usage: rose-mklink <alias> <url>" \
printf "%s\n" "usage: rosenrot-mklink <alias> <url>" \
"Create a /usr/bin link to a website."
exit
}
@ -12,6 +12,6 @@ test -z "$2" || {
exit 1
}
printf "#!/bin/sh\n\nrose %s" "$2" > /usr/bin/$1
printf "#!/bin/sh\n\nrosenrot %s" "$2" > /usr/bin/$1
chmod +x /usr/bin/$1
}

View File

@ -1,12 +1,10 @@
#include "config.h"
#include "plugins/libre_redirect/libre_redirect.h"
#include "plugins/readability/readability.h"
#include "plugins/shortcuts/shortcuts.h"
#include "plugins/style/style.h"
#include <stdlib.h>
#include <string.h>
#include <webkit2/webkit2.h>
#include "config.h"
#include "plugins/plugins.h"
/* Global declarations */
static GtkNotebook* notebook;
static GtkWindow* window;
@ -399,9 +397,7 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook)
- <https://docs.gtk.org/gdk3/union.Event.html>
- https://docs.gtk.org/gdk3/struct.EventButton.html
*/
/*
This API is deprecated in GTK4 :(
*/
// This API is deprecated in GTK4 :(
return 0;
}
@ -414,7 +410,7 @@ int main(int argc, char** argv)
gtk_css_provider_load_from_path(css, "/usr/share/themes/rose/style.css", NULL);
gtk_style_context_add_provider_for_screen(gdk_screen_get_default(), GTK_STYLE_PROVIDER(css), 800);
/* Initialize GTK objects. These are declared as static globals */
/* Initialize GTK objects. These are declared as static globals at the top of this file */
// Notebook
notebook = GTK_NOTEBOOK(gtk_notebook_new());
gtk_notebook_set_show_tabs(notebook, false);

View File

@ -1 +0,0 @@
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.

View File

@ -21,5 +21,5 @@ sudo make install
cd -
# Debian desktop icon
chmod +x rose.desktop
sudo cp rose.desktop /usr/share/applications
chmod +x rosenrot.desktop
sudo cp rosenrot.desktop /usr/share/applications

View File

@ -1,9 +0,0 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose.sh %u
Name=Rose
Comment=Minimalistic browser
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png

View File

@ -1,3 +0,0 @@
#!/bin/sh
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/ /bin/rose "$1"

View File

@ -6,4 +6,4 @@ Terminal=false
Exec=/bin/rose %u
Name=Rose
Comment=Minimalistic browser
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/debian-12/rose-images/rose-desktop-icon.png

View File

@ -0,0 +1 @@
Code in this directory refers to a previous version of rosenrot which used the libwebkit2gtk-4.0 api. It is deprecated. See the debian folder for how to use the -4.1 version instead. Package names might vary.

View File

Before

Width:  |  Height:  |  Size: 625 KiB

After

Width:  |  Height:  |  Size: 625 KiB

View File

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB

View File

Before

Width:  |  Height:  |  Size: 739 KiB

After

Width:  |  Height:  |  Size: 739 KiB

View File

Before

Width:  |  Height:  |  Size: 102 KiB

After

Width:  |  Height:  |  Size: 102 KiB

View File

Before

Width:  |  Height:  |  Size: 142 KiB

After

Width:  |  Height:  |  Size: 142 KiB

View File

Before

Width:  |  Height:  |  Size: 474 KiB

After

Width:  |  Height:  |  Size: 474 KiB