Compare commits
11 Commits
8a1e0be30d
...
da776bebc4
Author | SHA1 | Date | |
---|---|---|---|
da776bebc4 | |||
ce1ad43ac2 | |||
d9d18bf7f3 | |||
4663cb3a70 | |||
bb9d791a62 | |||
8907cbb063 | |||
0f940a7460 | |||
641b4055c2 | |||
97032cd83c | |||
3bf48009d1 | |||
79ff9e86f5 |
21
README.md
|
@ -1,6 +1,6 @@
|
||||||
# Rosenrot
|
# 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)
|
![](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
|
### 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
|
The general steps are to install dependencies, and then
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ make install
|
||||||
rose
|
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
|
## Features
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@ You can see some screenshots in the [images](./images) folder.
|
||||||
### Relationship with [rose](https://github.com/mini-rose/rose)
|
### 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).
|
- 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 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).
|
- 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.
|
- Anecdotically, surf feels slower, though I haven't tested this rigorously.
|
||||||
- surf has a larger community, with patches and modifications.
|
- surf has a larger community, with patches and modifications.
|
||||||
- surf is more opinionated, but also less amateurish.
|
- 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.
|
- 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.
|
- 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:
|
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.
|
||||||
|
|
||||||
|
|
10
TODO.md
|
@ -9,7 +9,15 @@
|
||||||
- [ ] 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/>)
|
- [ ] 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.
|
- [ ] 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>)?
|
- [ ] 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 these are not available on Ubuntu 20.04.
|
||||||
|
- 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
|
# Previously done
|
||||||
|
|
||||||
|
|
52
config.h
|
@ -1,5 +1,8 @@
|
||||||
#include <gdk/gdkkeysyms.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <gdk/gdk.h>
|
||||||
|
// Previously: #include <gdk/gdkkeysyms.h>
|
||||||
|
// But GTK3 discourages including the individual headers
|
||||||
|
// In GTK4, the location also changes to <gdk/gdkenums.h>
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -14,7 +17,7 @@
|
||||||
#define MAX_NUM_TABS 8 // set to 0 or false if you want unlimited tabs, or look at the relevant rose.c code.
|
#define MAX_NUM_TABS 8 // set to 0 or false if you want unlimited tabs, or look at the relevant rose.c code.
|
||||||
#define ROSE_HOMEPAGE false
|
#define ROSE_HOMEPAGE false
|
||||||
#define SEARCH "https://lite.duckduckgo.com/html/?q=%s" // "https://search.nunosempere.com/search?q=%s"
|
#define SEARCH "https://lite.duckduckgo.com/html/?q=%s" // "https://search.nunosempere.com/search?q=%s"
|
||||||
#define HOME ROSE_HOMEPAGE ? "file:///home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png" : "https://search.nunosempere.com/"
|
#define HOME ROSE_HOMEPAGE ? "file:///home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-homepage.png" : "https://search.nunosempere.com/"
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
#define LIBRE_REDIRECT_ENABLED true
|
#define LIBRE_REDIRECT_ENABLED true
|
||||||
|
@ -40,14 +43,8 @@ To remove plugins completely;
|
||||||
"enable-smooth-scrolling", false, \
|
"enable-smooth-scrolling", false, \
|
||||||
"default-charset", "utf-8"
|
"default-charset", "utf-8"
|
||||||
/* CACHE */
|
/* CACHE */
|
||||||
#define CACHE_DIR "/home/loki/.cache/rose"
|
#define DATA_DIR "/home/nuno/.cache/rose"
|
||||||
#define CACHE \
|
#define DATA_MANAGER_OPTS "base-cache-directory", DATA_DIR, "base-data-directory", DATA_DIR
|
||||||
"base-cache-directory", CACHE_DIR, "base-data-directory", CACHE_DIR, \
|
|
||||||
"disk-cache-directory", CACHE_DIR, "dom-cache-directory", CACHE_DIR, \
|
|
||||||
"hsts-cache-directory", CACHE_DIR, "indexeddb-directory", CACHE_DIR, \
|
|
||||||
"itp-directory", CACHE_DIR, "local-storage-directory", CACHE_DIR, \
|
|
||||||
"offline-application-cache-directory", CACHE_DIR, \
|
|
||||||
"service-worker-registrations-directory", CACHE_DIR
|
|
||||||
|
|
||||||
// GTK
|
// GTK
|
||||||
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
||||||
|
@ -79,6 +76,7 @@ typedef enum {
|
||||||
#define SFT 1 << 0
|
#define SFT 1 << 0
|
||||||
#define CTRL 1 << 2
|
#define CTRL 1 << 2
|
||||||
#define ALT 1 << 3
|
#define ALT 1 << 3
|
||||||
|
// reference: <https://github.com/GNOME/gtk/blob/7ea7d5c3906ccd231b04654101bb742f157d82f6/gdk/gdkenums.h#L140>
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
unsigned mod;
|
unsigned mod;
|
||||||
|
@ -88,8 +86,8 @@ static struct {
|
||||||
{ CTRL, KEY(h), goback },
|
{ CTRL, KEY(h), goback },
|
||||||
{ CTRL, KEY(j), goforward },
|
{ CTRL, KEY(j), goforward },
|
||||||
{ CTRL, KEY(r), refresh },
|
{ CTRL, KEY(r), refresh },
|
||||||
{ CTRL | SFT, KEY(R), refresh_force },
|
{ CTRL, KEY(R), refresh_force },
|
||||||
{ CTRL | SFT, KEY(H), back_to_home },
|
{ CTRL, KEY(H), back_to_home },
|
||||||
{ CTRL, KEY(equal), zoomin },
|
{ CTRL, KEY(equal), zoomin },
|
||||||
{ CTRL, KEY(minus), zoomout },
|
{ CTRL, KEY(minus), zoomout },
|
||||||
{ CTRL, KEY(0), zoom_reset },
|
{ CTRL, KEY(0), zoom_reset },
|
||||||
|
@ -102,7 +100,7 @@ static struct {
|
||||||
{ CTRL, KEY(semicolon), hide_bar },
|
{ CTRL, KEY(semicolon), hide_bar },
|
||||||
{ CTRL, KEY(f), show_finder },
|
{ CTRL, KEY(f), show_finder },
|
||||||
{ CTRL, KEY(n), finder_next },
|
{ CTRL, KEY(n), finder_next },
|
||||||
{ CTRL | SFT, KEY(N), finder_prev },
|
{ CTRL, KEY(N), finder_prev },
|
||||||
{ CTRL, KEY(p), prettify }
|
{ CTRL, KEY(p), prettify }
|
||||||
};
|
};
|
||||||
/* ^ For controls more akin to normal browsers */
|
/* ^ For controls more akin to normal browsers */
|
||||||
|
@ -110,23 +108,23 @@ static struct {
|
||||||
* <https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkkeysyms.h> */
|
* <https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkkeysyms.h> */
|
||||||
|
|
||||||
/* Old controls: {
|
/* Old controls: {
|
||||||
{ CTRL, KEY(h), goback },
|
{ CTRL, KEY(h), goback },
|
||||||
{ CTRL, KEY(l), goforward },
|
{ CTRL, KEY(l), goforward },
|
||||||
{ CTRL, KEY(r), refresh },
|
{ CTRL, KEY(r), refresh },
|
||||||
{ CTRL | SFT, KEY(R), refresh_force },
|
{ CTRL | SFT, KEY(R), refresh_force },
|
||||||
{ CTRL | SFT, KEY(H), back_to_home },
|
{ CTRL | SFT, KEY(H), back_to_home },
|
||||||
{ CTRL, KEY(equal), zoomin },
|
{ CTRL, KEY(equal), zoomin },
|
||||||
{ CTRL, KEY(minus), zoomout },
|
{ CTRL, KEY(minus), zoomout },
|
||||||
{ CTRL, KEY(0), zoom_reset },
|
{ CTRL, KEY(0), zoom_reset },
|
||||||
{ ALT, KEY(h), prev_tab },
|
{ ALT, KEY(h), prev_tab },
|
||||||
{ CTRL, KEY(k), hide_searchbar },
|
{ CTRL, KEY(k), hide_searchbar },
|
||||||
{ ALT, KEY(l), next_tab },
|
{ ALT, KEY(l), next_tab },
|
||||||
{ CTRL, KEY(w), close_tab },
|
{ CTRL, KEY(w), close_tab },
|
||||||
{ 0x0, KEY(F11), toggle_fullscreen },
|
{ 0x0, KEY(F11), toggle_fullscreen },
|
||||||
{ CTRL, KEY(e), show_searchbar },
|
{ CTRL, KEY(e), show_searchbar },
|
||||||
{ CTRL, KEY(f), show_finder },
|
{ CTRL, KEY(f), show_finder },
|
||||||
{ CTRL, KEY(n), finder_next },
|
{ CTRL, KEY(n), finder_next },
|
||||||
{ CTRL | SFT, KEY(N), finder_prev },
|
{ CTRL | SFT, KEY(N), finder_prev },
|
||||||
{ CTRL, KEY(p), prettify }
|
{ CTRL, KEY(p), prettify }
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
|
|
31
makefile
|
@ -1,13 +1,13 @@
|
||||||
|
|
||||||
# C compiler
|
# C compiler
|
||||||
CC=gcc # other options: tcc, clang, zig cc
|
CC=gcc # other options: tcc, clang, zig cc
|
||||||
WARNINGS=-Wall
|
WARNINGS=-Wall
|
||||||
DEBUG= #'-g'
|
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_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
|
OPTIMIZED_MORE=-Ofast -march=native -funit-at-a-time -flto # binary will not be compatible with other computers, but may be much faster
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
DEPS='webkit2gtk-4.0'
|
DEPS='webkit2gtk-4.1'
|
||||||
INCS=`pkg-config --cflags ${DEPS}`
|
INCS=`pkg-config --cflags ${DEPS}`
|
||||||
LIBS=`pkg-config --libs ${DEPS}`
|
LIBS=`pkg-config --libs ${DEPS}`
|
||||||
|
|
||||||
|
@ -29,12 +29,12 @@ STYLE_BLUEPRINT=webkit
|
||||||
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
FORMATTER=clang-format -i -style=$(STYLE_BLUEPRINT)
|
||||||
|
|
||||||
# Change hardcoded paths when building
|
# Change hardcoded paths when building
|
||||||
## Cache
|
## Data dirs
|
||||||
USER=`whoami`
|
USER=`whoami`
|
||||||
DEFAULT_CACHE_DIR=/home/loki/.cache/rose
|
DEFAULT_DATA_DIR=/home/nuno/.cache/rose
|
||||||
CURRENT_CACHE_DIR=/home/$(USER)/.cache/rose
|
CURRENT_DATA_DIR=/home/$(USER)/.cache/rose
|
||||||
## dir
|
## dir
|
||||||
DEFAULT_DIR=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot
|
DEFAULT_DIR=/home/nuno/Documents/workspace/rosenrot
|
||||||
CURRENT_DIR=`pwd`
|
CURRENT_DIR=`pwd`
|
||||||
|
|
||||||
build: $(SRC) $(PLUGINS) $(CONFIG)
|
build: $(SRC) $(PLUGINS) $(CONFIG)
|
||||||
|
@ -42,16 +42,16 @@ build: $(SRC) $(PLUGINS) $(CONFIG)
|
||||||
cd plugins/readability/ && sh recompute_READABILITY_N.sh
|
cd plugins/readability/ && sh recompute_READABILITY_N.sh
|
||||||
cd plugins/style && sh recompute_STYLE_N.sh
|
cd plugins/style && sh recompute_STYLE_N.sh
|
||||||
# Make cache
|
# Make cache
|
||||||
mkdir -p $(CURRENT_CACHE_DIR)
|
mkdir -p $(CURRENT_DATA_DIR)
|
||||||
# Hardcode cache path
|
# Hardcode cache path
|
||||||
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
||||||
sed -i "s|$(DEFAULT_CACHE_DIR)|$(CURRENT_CACHE_DIR)|g" {} +
|
sed -i "s|$(DEFAULT_DATA_DIR)|$(CURRENT_DATA_DIR)|g" {} +
|
||||||
# Hardcode git repository path
|
# Hardcode git repository path
|
||||||
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
find $(CURRENT_DIR) -type f -not -path "*.git*" -not -path "*makefile*" -exec \
|
||||||
sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} +
|
sed -i "s|$(DEFAULT_DIR)|$(CURRENT_DIR)|g" {} +
|
||||||
# Compile rosenrot
|
# Compile rosenrot
|
||||||
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
|
GIO_MODULE_DIR=/usr/lib/x86_64-linux-gnu/gio/modules/
|
||||||
$(CC) $(WARNINGS) $(OPTIMIZED_SOME) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) -o rose $(LIBS) $(ADBLOCK)
|
$(CC) $(WARNINGS) $(OPTIMIZED_MORE) $(DEBUG) $(INCS) $(PLUGINS) $(SRC) $(COMPILETIME_DEPRECATION_WARNINGS) -o rose $(LIBS) $(ADBLOCK)
|
||||||
|
|
||||||
fast: $(SRC) $(PLUGINS) $(CONFIG)
|
fast: $(SRC) $(PLUGINS) $(CONFIG)
|
||||||
rm -f *.gcda
|
rm -f *.gcda
|
||||||
|
@ -64,7 +64,7 @@ fast: $(SRC) $(PLUGINS) $(CONFIG)
|
||||||
rm -f *.gcda
|
rm -f *.gcda
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.0'` -o rose `pkg-config --libs 'webkit2gtk-4.0'`
|
clang-tidy $(SRC) $(PLUGINS) -- -Wall -O3 `pkg-config --cflags 'webkit2gtk-4.1'` -o rose `pkg-config --libs 'webkit2gtk-4.1'`
|
||||||
|
|
||||||
inspect: build
|
inspect: build
|
||||||
GTK_DEBUG=interactive ./rose
|
GTK_DEBUG=interactive ./rose
|
||||||
|
@ -75,17 +75,24 @@ install: rose
|
||||||
mkdir -p /usr/share/themes/rose
|
mkdir -p /usr/share/themes/rose
|
||||||
cp style.css /usr/share/themes/rose/
|
cp style.css /usr/share/themes/rose/
|
||||||
cp rose-mklink /usr/bin
|
cp rose-mklink /usr/bin
|
||||||
|
sudo mkdir -p /usr/bin/rose-browser
|
||||||
sudo cp rose /usr/bin/rose-browser/twitter # custom twitter tweaks
|
sudo cp rose /usr/bin/rose-browser/twitter # custom twitter tweaks
|
||||||
|
|
||||||
uninstall:
|
uninstall:
|
||||||
rm -r /usr/share/themes/rose
|
rm -r /usr/share/themes/rose
|
||||||
rm /usr/bin/rose
|
rm /usr/bin/rose
|
||||||
rm /usr/bin/rose-mklink
|
rm /usr/bin/rose-mklink
|
||||||
rm $(CACHE_DIR)
|
rm $(DATA_DIR)
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm rose
|
rm rose
|
||||||
rm $(CACHE_DIR)
|
rm $(DATA_DIR)
|
||||||
|
|
||||||
format: $(SRC) $(PLUGINS)
|
format: $(SRC) $(PLUGINS)
|
||||||
$(FORMATTER) $(SRC) $(PLUGINS) $(rose.h)
|
$(FORMATTER) $(SRC) $(PLUGINS) $(rose.h)
|
||||||
|
|
||||||
|
diagnose_deprecations:
|
||||||
|
G_ENABLE_DIAGNOSTIC=1 ./rose
|
||||||
|
|
||||||
|
view-gtk3-version:
|
||||||
|
dpkg -l libgtk-3-0
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
void read_readability_js(char* string)
|
void read_readability_js(char* string)
|
||||||
{
|
{
|
||||||
FILE* fp = fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/plugins/readability/readability.js", "r");
|
FILE* fp = fopen("/home/nuno/Documents/workspace/rosenrot/plugins/readability/readability.js", "r");
|
||||||
if (!fp) { // fp is NULL, fopen failed
|
if (!fp) { // fp is NULL, fopen failed
|
||||||
fprintf(stderr, "Failed to open file\n");
|
fprintf(stderr, "Failed to open file\n");
|
||||||
string = NULL;
|
string = NULL;
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
void read_style_js(char* string)
|
void read_style_js(char* string)
|
||||||
{
|
{
|
||||||
FILE* fp = fopen("/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/plugins/style/style.js", "r");
|
FILE* fp = fopen("/home/nuno/Documents/workspace/rosenrot/plugins/style/style.js", "r");
|
||||||
if (!fp) { // fp is NULL, fopen failed
|
if (!fp) { // fp is NULL, fopen failed
|
||||||
fprintf(stderr, "Failed to open file\n");
|
fprintf(stderr, "Failed to open file\n");
|
||||||
string = NULL;
|
string = NULL;
|
||||||
|
|
56
rose.c
|
@ -17,7 +17,7 @@ static struct {
|
||||||
enum { _SEARCH,
|
enum { _SEARCH,
|
||||||
_FIND,
|
_FIND,
|
||||||
_HIDDEN } entry_mode;
|
_HIDDEN } entry_mode;
|
||||||
} bar; // top bar.
|
} bar;
|
||||||
static int num_tabs = 0;
|
static int num_tabs = 0;
|
||||||
|
|
||||||
/* Utils */
|
/* Utils */
|
||||||
|
@ -69,8 +69,7 @@ void set_custom_style(WebKitWebView* view)
|
||||||
if (CUSTOM_STYLE_ENABLED) {
|
if (CUSTOM_STYLE_ENABLED) {
|
||||||
char* style_js = malloc(STYLE_N + 1);
|
char* style_js = malloc(STYLE_N + 1);
|
||||||
read_style_js(style_js);
|
read_style_js(style_js);
|
||||||
webkit_web_view_run_javascript(view, style_js,
|
webkit_web_view_evaluate_javascript(view, style_js, -1, NULL, "rosenrot-style-plugin", NULL, NULL, NULL);
|
||||||
NULL, NULL, NULL);
|
|
||||||
free(style_js);
|
free(style_js);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +78,7 @@ void handle_signal_load_changed(WebKitWebView* self, WebKitLoadEvent load_event,
|
||||||
{
|
{
|
||||||
switch (load_event) {
|
switch (load_event) {
|
||||||
/* see <https://webkitgtk.org/reference/webkit2gtk/2.5.1/WebKitWebView.html>
|
/* see <https://webkitgtk.org/reference/webkit2gtk/2.5.1/WebKitWebView.html>
|
||||||
*/
|
*/
|
||||||
case WEBKIT_LOAD_STARTED:
|
case WEBKIT_LOAD_STARTED:
|
||||||
set_custom_style(self);
|
set_custom_style(self);
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
@ -130,11 +129,10 @@ GtkWidget* handle_signal_create_new_tab(WebKitWebView* self,
|
||||||
gtk_notebook_set_show_tabs(notebook, true);
|
gtk_notebook_set_show_tabs(notebook, true);
|
||||||
return NULL;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
webkit_web_view_run_javascript(self,
|
webkit_web_view_evaluate_javascript(self, "alert('Too many tabs, not opening a new one')", -1, NULL, "rosenrot-alert-numtabs", NULL, NULL, NULL);
|
||||||
"alert('Too many tabs, not opening a new one')", NULL, NULL, NULL);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
WebKitGTK documentation recommends returning the new webview.
|
WebKitGTK documentation recommends returning the new webview.
|
||||||
I imagine that this might allow e.g., to go back in a new tab
|
I imagine that this might allow e.g., to go back in a new tab
|
||||||
or generally to keep track of history.
|
or generally to keep track of history.
|
||||||
|
@ -159,20 +157,17 @@ WebKitWebView* create_new_webview()
|
||||||
// See: <https://www.useragents.me/> for some common user agents
|
// See: <https://www.useragents.me/> for some common user agents
|
||||||
}
|
}
|
||||||
web_context = webkit_web_context_new_with_website_data_manager(
|
web_context = webkit_web_context_new_with_website_data_manager(
|
||||||
webkit_website_data_manager_new(CACHE, NULL));
|
webkit_website_data_manager_new(DATA_MANAGER_OPTS, NULL));
|
||||||
contentmanager = webkit_user_content_manager_new();
|
contentmanager = webkit_user_content_manager_new();
|
||||||
cookiemanager = webkit_web_context_get_cookie_manager(web_context);
|
cookiemanager = webkit_web_context_get_cookie_manager(web_context);
|
||||||
|
|
||||||
webkit_cookie_manager_set_persistent_storage(
|
webkit_cookie_manager_set_persistent_storage(
|
||||||
cookiemanager, CACHE_DIR "/cookies.sqlite",
|
cookiemanager, DATA_DIR "/cookies.sqlite",
|
||||||
WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
|
WEBKIT_COOKIE_PERSISTENT_STORAGE_SQLITE);
|
||||||
|
|
||||||
webkit_cookie_manager_set_accept_policy(cookiemanager,
|
webkit_cookie_manager_set_accept_policy(cookiemanager,
|
||||||
WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS);
|
WEBKIT_COOKIE_POLICY_ACCEPT_ALWAYS);
|
||||||
|
|
||||||
webkit_web_context_set_process_model(
|
|
||||||
web_context, WEBKIT_PROCESS_MODEL_MULTIPLE_SECONDARY_PROCESSES);
|
|
||||||
|
|
||||||
if (g_file_get_contents("~/.config/rose/style.css", &style, NULL, NULL))
|
if (g_file_get_contents("~/.config/rose/style.css", &style, NULL, NULL))
|
||||||
webkit_user_content_manager_add_style_sheet(
|
webkit_user_content_manager_add_style_sheet(
|
||||||
contentmanager, webkit_user_style_sheet_new(style, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, NULL, NULL));
|
contentmanager, webkit_user_style_sheet_new(style, WEBKIT_USER_CONTENT_INJECT_ALL_FRAMES, WEBKIT_USER_STYLE_LEVEL_USER, NULL, NULL));
|
||||||
|
@ -184,15 +179,9 @@ WebKitWebView* create_new_webview()
|
||||||
void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
||||||
{
|
{
|
||||||
if (num_tabs < MAX_NUM_TABS || MAX_NUM_TABS == 0) {
|
if (num_tabs < MAX_NUM_TABS || MAX_NUM_TABS == 0) {
|
||||||
GdkScreen* screen = gtk_window_get_screen(GTK_WINDOW(window));
|
|
||||||
GdkVisual* rgba_visual = gdk_screen_get_rgba_visual(screen);
|
|
||||||
GdkRGBA rgba;
|
|
||||||
|
|
||||||
gdk_rgba_parse(&rgba, BG_COLOR);
|
|
||||||
|
|
||||||
WebKitWebView* view = create_new_webview();
|
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, "load_changed", G_CALLBACK(handle_signal_load_changed), notebook);
|
||||||
g_signal_connect(view, "create", G_CALLBACK(handle_signal_create_new_tab), notebook);
|
g_signal_connect(view, "create", G_CALLBACK(handle_signal_create_new_tab), notebook);
|
||||||
|
|
||||||
|
@ -200,7 +189,6 @@ void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
||||||
gtk_notebook_set_tab_reorderable(notebook, GTK_WIDGET(view), true);
|
gtk_notebook_set_tab_reorderable(notebook, GTK_WIDGET(view), true);
|
||||||
gtk_widget_show_all(GTK_WIDGET(window));
|
gtk_widget_show_all(GTK_WIDGET(window));
|
||||||
gtk_widget_hide(GTK_WIDGET(bar.widget));
|
gtk_widget_hide(GTK_WIDGET(bar.widget));
|
||||||
webkit_web_view_set_background_color(view, &rgba);
|
|
||||||
load_uri(view, (uri) ? uri : HOME);
|
load_uri(view, (uri) ? uri : HOME);
|
||||||
|
|
||||||
set_custom_style(view);
|
set_custom_style(view);
|
||||||
|
@ -210,8 +198,8 @@ void notebook_create_new_tab(GtkNotebook* notebook, const char* uri)
|
||||||
webkit_web_view_set_zoom_level(view, ZOOM);
|
webkit_web_view_set_zoom_level(view, ZOOM);
|
||||||
num_tabs += 1;
|
num_tabs += 1;
|
||||||
} else {
|
} else {
|
||||||
webkit_web_view_run_javascript(notebook_get_webview(notebook),
|
|
||||||
"alert('Too many tabs, not opening a new one')", NULL, NULL, NULL);
|
webkit_web_view_evaluate_javascript(notebook_get_webview(notebook), "alert('Too many tabs, not opening a new one')", -1, NULL, "rosenrot-alert-numtabs", NULL, NULL, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -372,8 +360,7 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
||||||
if (READABILITY_ENABLED) {
|
if (READABILITY_ENABLED) {
|
||||||
char* readability_js = malloc(READABILITY_N + 1);
|
char* readability_js = malloc(READABILITY_N + 1);
|
||||||
read_readability_js(readability_js);
|
read_readability_js(readability_js);
|
||||||
webkit_web_view_run_javascript(view,
|
webkit_web_view_evaluate_javascript(view, readability_js, -1, NULL, "rosenrot-readability-plugin", NULL, NULL, NULL);
|
||||||
readability_js, NULL, NULL, NULL);
|
|
||||||
free(readability_js);
|
free(readability_js);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -387,17 +374,34 @@ int handle_signal_keypress(void* self, GdkEvent* event, GtkNotebook* notebook)
|
||||||
{
|
{
|
||||||
(void)self;
|
(void)self;
|
||||||
|
|
||||||
|
guint event_keyval = 0;
|
||||||
|
gdk_event_get_keyval(event, &event_keyval);
|
||||||
|
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_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++)
|
for (int i = 0; i < sizeof(shortcut) / sizeof(shortcut[0]); i++)
|
||||||
if ((event->key.state == shortcut[i].mod || shortcut[i].mod == 0x0) && event->key.keyval == shortcut[i].key)
|
if ((event_state & shortcut[i].mod || shortcut[i].mod == 0x0) && event_keyval == shortcut[i].key)
|
||||||
return handle_shortcut(shortcut[i].id, notebook);
|
return handle_shortcut(shortcut[i].id, notebook);
|
||||||
/*
|
/*
|
||||||
If I wanted to bind button presses, like the extra button in the mouse,
|
If I wanted to bind button presses, like the extra button in the mouse,
|
||||||
I would have to bind the button-press-event signal instead.
|
I would have to bind the button-press-event signal instead.
|
||||||
Some links in case I go down that road:
|
Some links in case I go down that road:
|
||||||
- <https://docs.gtk.org/gtk3/signal.Widget.button-press-event.html>
|
- <https://docs.gtk.org/gtk3/signal.Widget.button-press-event.html>
|
||||||
- <https://docs.gtk.org/gdk3/union.Event.html>
|
- <https://docs.gtk.org/gdk3/union.Event.html>
|
||||||
- https://docs.gtk.org/gdk3/struct.EventButton.html
|
- https://docs.gtk.org/gdk3/struct.EventButton.html
|
||||||
*/
|
*/
|
||||||
|
/*
|
||||||
|
This API is deprecated in GTK4 :(
|
||||||
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1
user-scripts/.old/ubuntu-20.04/README.md
Normal file
|
@ -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.
|
9
user-scripts/.old/ubuntu-20.04/rose-GIO_MODULE_DIR.desktop
Executable file
|
@ -0,0 +1,9 @@
|
||||||
|
#!/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
|
Before Width: | Height: | Size: 625 KiB After Width: | Height: | Size: 625 KiB |
Before Width: | Height: | Size: 474 KiB After Width: | Height: | Size: 474 KiB |
Before Width: | Height: | Size: 739 KiB After Width: | Height: | Size: 739 KiB |
Before Width: | Height: | Size: 102 KiB After Width: | Height: | Size: 102 KiB |
Before Width: | Height: | Size: 142 KiB After Width: | Height: | Size: 142 KiB |
Before Width: | Height: | Size: 474 KiB After Width: | Height: | Size: 474 KiB |
|
@ -6,4 +6,4 @@ Terminal=false
|
||||||
Exec=/bin/rose %u
|
Exec=/bin/rose %u
|
||||||
Name=Rose
|
Name=Rose
|
||||||
Comment=Minimalistic browser
|
Comment=Minimalistic browser
|
||||||
Icon=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
|
@ -1,6 +1,6 @@
|
||||||
# Key dependencies
|
# Key dependencies
|
||||||
sudo apt install git vim gcc make
|
sudo apt install git vim gcc make
|
||||||
sudo apt install libwebkit2gtk-4.0-dev
|
sudo apt install libwebkit2gtk-4.1-dev
|
||||||
|
|
||||||
# Optional adblock
|
# Optional adblock
|
||||||
git clone https://github.com/jun7/wyebadblock
|
git clone https://github.com/jun7/wyebadblock
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
Version=1.0
|
Version=1.0
|
||||||
Type=Application
|
Type=Application
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Exec=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose.sh %u
|
Exec=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose.sh %u
|
||||||
Name=Rose
|
Name=Rose
|
||||||
Comment=Minimalistic browser
|
Comment=Minimalistic browser
|
||||||
Icon=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
||||||
|
|
|
@ -6,4 +6,4 @@ Terminal=false
|
||||||
Exec=/bin/rose %u
|
Exec=/bin/rose %u
|
||||||
Name=Rose
|
Name=Rose
|
||||||
Comment=Minimalistic browser
|
Comment=Minimalistic browser
|
||||||
Icon=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
Icon=/home/nuno/Documents/workspace/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
||||||
|
|
|
@ -1,9 +0,0 @@
|
||||||
#!/usr/bin/env xdg-open
|
|
||||||
[Desktop Entry]
|
|
||||||
Version=1.0
|
|
||||||
Type=Application
|
|
||||||
Terminal=false
|
|
||||||
Exec=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose.sh %u
|
|
||||||
Name=Rose
|
|
||||||
Comment=Minimalistic browser
|
|
||||||
Icon=/home/loki/Documents/core/software/fresh/C/rose-browser/rosenrot/user-scripts/ubuntu-20.04/rose-images/rose-desktop-icon.png
|
|