Compare commits

...

4 Commits

7 changed files with 67 additions and 4 deletions

View File

@ -17,14 +17,21 @@ This is my personal version. Contribute upstream to [github.com/mini-rose/rose](
### To do ### To do
- [ ] Find out what each of the css elements refers to.
- [ ] Use something other than Whatsapp as an example syslink.
Done:
- [x] String substitution on uri in order to redirect to better frontends. - [x] String substitution on uri in order to redirect to better frontends.
- [x] Present "standard" browser keybindings as an alternative. - [x] Present "standard" browser keybindings as an alternative.
- [x] Fix zoom in new tab - [x] Fix zoom in new tab
- [x] Reader mode - [x] Reader mode
- [x] Add reader mode to config.def. - [x] Add reader mode to config.def.
- [x] Make tab bar slightly prettier. - [x] Make tab bar slightly prettier.
- [ ] Find out what each of the css elements refers to. - [x] Add "open in new window" functionality.
- Useful for opening links in new tab when clicking on them and selecting that option
- And for actually opening links with the href newtab option.
- Links: <https://docs.gtk.org/gobject/func.signal_connect.html>, <https://webkitgtk.org/reference/webkit2gtk/2.37.90/signal.AutomationSession.create-web-view.html>, <https://webkitgtk.org/reference/webkit2gtk/2.26.0/WebKitWebView.html#WebKitWebView-create> <https://stackoverflow.com/questions/40180757/webkit2gtk-get-new-window-link>
### Known bugs ### Known bugs
- [ ] Doesn't work with a Spanish keyboard layout, for some reason. - [ ] Doesn't work with when Spanish is selected as the language, for some reason.

View File

@ -1,7 +1,10 @@
#!/bin/bash
CC=clang CC=clang
SRC=rose.c SRC=rose.c
REQS=./plugins/*/*.c REQS=./plugins/*/*.c
DEPS=('webkit2gtk-4.0') DEPS=('webkit2gtk-4.0')
DEBUG="" # set to "-g" for debug mode.
INCS=`pkg-config --cflags ${DEPS[@]}` INCS=`pkg-config --cflags ${DEPS[@]}`
LIBS=`pkg-config --libs ${DEPS[@]}` LIBS=`pkg-config --libs ${DEPS[@]}`
@ -10,4 +13,4 @@ LIBS=`pkg-config --libs ${DEPS[@]}`
WYEBAB='-L/usr/lib/wyebrowser/adblock.so' WYEBAB='-L/usr/lib/wyebrowser/adblock.so'
# echo $CC $INCS $LIBS $SRC $REQS $WYEBAB -o rose # echo $CC $INCS $LIBS $SRC $REQS $WYEBAB -o rose
$CC $INCS $LIBS $SRC $REQS $WYEBAB -o rose $CC $DEBUG $INCS $LIBS $SRC $REQS $WYEBAB -o rose

View File

@ -38,7 +38,7 @@ int libre_redirect(const char* uri, char* output){
"https://wikipedia.org" "https://wikipedia.org"
}; };
char* alternatives[] = { char* alternatives[] = {
"https://yt.artemislena.eu", "https://invidious.flokinet.to", /* "https://yt.artemislena.eu", */
"https://teddit.nunosempere.com", "https://teddit.nunosempere.com",
"https://scribe.rip", "https://scribe.rip",
"https://simplytranslate.org/", "https://simplytranslate.org/",

21
rose.c
View File

@ -136,6 +136,26 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *
} }
} }
void notebook_append(GtkNotebook *notebook, const char *uri);
/* notebook_append calls handle_create, but handle_create also calls notebook_append.
* Therefore we need to declare notebook_append, so that handle_create_new_tab knows its type.
*/
GtkWidget* handle_create_new_tab(WebKitWebView *self, WebKitNavigationAction *navigation_action, GtkNotebook *notebook){
WebKitURIRequest *uri_request = webkit_navigation_action_get_request(navigation_action);
const char *uri = webkit_uri_request_get_uri (uri_request);
printf("Creating new window: %s\n", uri);
notebook_append(notebook, uri);
gtk_notebook_set_show_tabs(notebook, true);
return NULL;
/* WebKitGTK documentation recommends returning the new webview.
* I imagine that this might allow e.g., to go back in a new tab
* or generally to keep track of history.
* However, this would require either modifying notebook_append
* or duplicating its contents, for unclear gain.
*/
}
void notebook_append(GtkNotebook *notebook, const char *uri) void notebook_append(GtkNotebook *notebook, const char *uri)
{ {
GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(window)); GdkScreen *screen = gtk_window_get_screen(GTK_WINDOW(window));
@ -148,6 +168,7 @@ void notebook_append(GtkNotebook *notebook, const char *uri)
gtk_widget_set_visual(GTK_WIDGET(window), rgba_visual); gtk_widget_set_visual(GTK_WIDGET(window), rgba_visual);
g_signal_connect(view, "load_changed", G_CALLBACK(load_changed), notebook); g_signal_connect(view, "load_changed", G_CALLBACK(load_changed), notebook);
g_signal_connect(view, "create", G_CALLBACK(handle_create_new_tab), notebook);
int n = gtk_notebook_append_page(notebook, GTK_WIDGET(view), NULL); int n = gtk_notebook_append_page(notebook, GTK_WIDGET(view), NULL);
gtk_notebook_set_tab_reorderable(notebook, GTK_WIDGET(view), true); gtk_notebook_set_tab_reorderable(notebook, GTK_WIDGET(view), true);

View File

@ -0,0 +1,13 @@
For some reason, the Ubuntu environment assigns a program to the rose desktop tab if it is called from within /usr/bin/rose, even if from the Whatsapp desktop file.
The solution is to make a syslink from rose to whatsapp:
```
$ ln -s /usr/bin/rose /usr/bin/whatsapp
```
and then call whatsapp from:
```
/usr/bin/whatsapp https://web.whatsapp.com/
```

View File

@ -0,0 +1,10 @@
#!/usr/bin/env xdg-open
[Desktop Entry]
Version=1.0
Type=Application
Terminal=false
Exec= /usr/bin/whatsapp https://web.whatsapp.com
Name=Whatsapp
Comment=Whatsapp messaging service.
Icon=/home/loki/Pictures/fresh/misc/whatsapp_icon.svg

View File

@ -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
```