Merge pull request #36 from NunoSempere/feats-and-tweaks
Various feats and tweaks
This commit is contained in:
commit
327344ee40
|
@ -9,10 +9,6 @@
|
||||||
- hackable without any knowledge
|
- hackable without any knowledge
|
||||||
- builtin rose-mklink script for in-shell static links
|
- builtin rose-mklink script for in-shell static links
|
||||||
|
|
||||||
#
|
|
||||||
### 👐 Contribute
|
|
||||||
See [contributing.md](https://github.com/mini-rose/rose/.github/contributing.md).
|
|
||||||
|
|
||||||
### 📜 License
|
### 📜 License
|
||||||
Rose is released under own license, which grants the following permissions:
|
Rose is released under own license, which grants the following permissions:
|
||||||
- Commercial use
|
- Commercial use
|
||||||
|
|
4
build.sh
4
build.sh
|
@ -1,6 +1,8 @@
|
||||||
|
#!/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')
|
||||||
|
|
||||||
INCS=`pkg-config --cflags ${DEPS[@]}`
|
INCS=`pkg-config --cflags ${DEPS[@]}`
|
||||||
|
|
|
@ -52,6 +52,7 @@ typedef enum {
|
||||||
finder_next,
|
finder_next,
|
||||||
finder_prev,
|
finder_prev,
|
||||||
newtab,
|
newtab,
|
||||||
|
/*prettify,*/
|
||||||
hidebar
|
hidebar
|
||||||
} func;
|
} func;
|
||||||
|
|
||||||
|
@ -81,6 +82,7 @@ static struct {
|
||||||
{ CTRL, KEY(n), finder_next },
|
{ CTRL, KEY(n), finder_next },
|
||||||
{ CTRL | SFT, KEY(N), finder_prev },
|
{ CTRL | SFT, KEY(N), finder_prev },
|
||||||
{ CTRL, KEY(t), newtab },
|
{ CTRL, KEY(t), newtab },
|
||||||
|
{ CTRL, KEY(p), prettify },
|
||||||
{ 0x0, KEY(Escape), hidebar }
|
{ 0x0, KEY(Escape), hidebar }
|
||||||
};
|
};
|
||||||
/* For controls more akin to normal browsers, use:
|
/* For controls more akin to normal browsers, use:
|
||||||
|
@ -100,7 +102,9 @@ static struct {
|
||||||
{ CTRL, KEY(l), show_searchbar },
|
{ CTRL, KEY(l), 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 },
|
||||||
|
|
||||||
};
|
};
|
||||||
*/
|
*/
|
||||||
/* Reference for the key shorthand:
|
/* Reference for the key shorthand:
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
./build.sh && {
|
./build.sh && {
|
||||||
cp -f rose /usr/bin
|
cp -f rose /usr/bin
|
||||||
mkdir -p /usr/share/themes/rose
|
mkdir -p /usr/share/themes/rose
|
||||||
|
|
3
plugins/libre_redirect/README.md
Normal file
3
plugins/libre_redirect/README.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
## About
|
||||||
|
|
||||||
|
This code automatically redirects webpage to their open-source frontends. It is based on <https://libredirect.codeberg.page/>
|
2
plugins/readability/README.md
Normal file
2
plugins/readability/README.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
This code reimplements firefox readability mode. Code taken from <https://raw.githubusercontent.com/ushnisha/readability-reader-webextensions/master/content_scripts/tranquilize.js>
|
||||||
|
|
BIN
plugins/readability/readability
Executable file
BIN
plugins/readability/readability
Executable file
Binary file not shown.
29
plugins/readability/readability.c
Normal file
29
plugins/readability/readability.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#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");
|
||||||
|
if (!fp) { // fp is NULL, fopen failed
|
||||||
|
fprintf(stderr, "Failed to open file\n");
|
||||||
|
string=NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int i=0;
|
||||||
|
int c;
|
||||||
|
while ((c = fgetc(fp)) != EOF){
|
||||||
|
string[i++] = c;
|
||||||
|
}
|
||||||
|
string[i]='\0';
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
int main(){
|
||||||
|
char* readability_js = malloc(READABILITY_N+1);
|
||||||
|
read_readability_js(readability_js);
|
||||||
|
printf("%s", readability_js);
|
||||||
|
free(readability_js);
|
||||||
|
}
|
||||||
|
*/
|
8
plugins/readability/readability.h
Normal file
8
plugins/readability/readability.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef READABILITY
|
||||||
|
#define READABILITY
|
||||||
|
|
||||||
|
#define READABILITY_N 84251 + 1
|
||||||
|
|
||||||
|
void read_readability_js(char* string);
|
||||||
|
|
||||||
|
#endif
|
2340
plugins/readability/readability.js
Normal file
2340
plugins/readability/readability.js
Normal file
File diff suppressed because it is too large
Load Diff
8
plugins/readability/recompute_READABILITY_N.sh
Executable file
8
plugins/readability/recompute_READABILITY_N.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
function sedr(){
|
||||||
|
find ./ -type f -exec sed -i -e "$1" {} \;
|
||||||
|
} ## e.g., sedr "s/target/replacement/g"
|
||||||
|
|
||||||
|
READABILITY_N=$(wc -c ./plugins/*/readability.js | cut -d " " -f 1)
|
||||||
|
sedr "s/^#define READABILITY_N .*/#define READABILITY_N $READABILITY_N + 1/g"
|
||||||
|
|
5
plugins/style/README.md
Normal file
5
plugins/style/README.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
## Customize css style for individual websites.
|
||||||
|
|
||||||
|
- Replicates: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/>.
|
||||||
|
- The template is similar to the readability folder.
|
||||||
|
- You will also want to customize the `style.c` file.
|
8
plugins/style/recompute_STYLE_N.sh
Executable file
8
plugins/style/recompute_STYLE_N.sh
Executable file
|
@ -0,0 +1,8 @@
|
||||||
|
#!/bin/bash
|
||||||
|
function sedr(){
|
||||||
|
find ./ -type f -exec sed -i -e "$1" {} \;
|
||||||
|
} ## e.g., sedr "s/target/replacement/g"
|
||||||
|
|
||||||
|
STYLE_N=$(wc -c style.js | cut -d " " -f 1)
|
||||||
|
sedr "s/^#define STYLE_N .*/#define STYLE_N $STYLE_N + 1/g"
|
||||||
|
|
29
plugins/style/style.c
Normal file
29
plugins/style/style.c
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#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");
|
||||||
|
if (!fp) { // fp is NULL, fopen failed
|
||||||
|
fprintf(stderr, "Failed to open file\n");
|
||||||
|
string=NULL;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int i=0;
|
||||||
|
int c;
|
||||||
|
while ((c = fgetc(fp)) != EOF){
|
||||||
|
string[i++] = c;
|
||||||
|
}
|
||||||
|
string[i]='\0';
|
||||||
|
fclose(fp);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
int main(){
|
||||||
|
char* readability_js = malloc(STYLE_N+1);
|
||||||
|
read_readability_js(readability_js);
|
||||||
|
printf("%s", readability_js);
|
||||||
|
free(readability_js);
|
||||||
|
}
|
||||||
|
*/
|
8
plugins/style/style.h
Normal file
8
plugins/style/style.h
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
#ifndef STYLE
|
||||||
|
#define STYLE
|
||||||
|
|
||||||
|
#define STYLE_N 794 + 1
|
||||||
|
|
||||||
|
void read_style_js(char* string);
|
||||||
|
|
||||||
|
#endif
|
26
plugins/style/style.js
Normal file
26
plugins/style/style.js
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
// Replicates the Stylus app: <https://addons.mozilla.org/en-GB/firefox/addon/styl-us/>
|
||||||
|
|
||||||
|
if (document.domain == "forum.effectivealtruism.org"){
|
||||||
|
var styles = `
|
||||||
|
.Layout-main {
|
||||||
|
margin-left: 100px;
|
||||||
|
}
|
||||||
|
.SingleColumnSection-root {
|
||||||
|
width: 1000px !important;
|
||||||
|
max-width: 1400px !important;
|
||||||
|
padding-left: 100px !important;
|
||||||
|
}
|
||||||
|
.NavigationStandalone-sidebar {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.intercom-lightweight-app{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
var styleSheet = document.createElement('style')
|
||||||
|
styleSheet.innerText = styles
|
||||||
|
document.head.appendChild(styleSheet)
|
||||||
|
console.log('Style changed')
|
||||||
|
}
|
||||||
|
|
||||||
|
document.body.style.visibility = "visible"
|
255
rose.c
255
rose.c
|
@ -12,7 +12,21 @@
|
||||||
#include <webkit2/webkit2.h>
|
#include <webkit2/webkit2.h>
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "plugins/libre_redirect/libre_redirect.h"
|
|
||||||
|
// #include "plugins/libre_redirect/libre_redirect.h"
|
||||||
|
// #include "plugins/readability/readability.h"
|
||||||
|
// #include "plugins/style/style.h"
|
||||||
|
|
||||||
|
int LIBRE_REDIRECT_ENABLED = false;
|
||||||
|
int READABILITY_ENABLED = false;
|
||||||
|
int CUSTOM_STYLE_ENABLED = false;
|
||||||
|
|
||||||
|
// to enable plugins,
|
||||||
|
// 1. uncomment their #include statement
|
||||||
|
// 2. set their variable to true;
|
||||||
|
// 3. in build.sh, uncomment:
|
||||||
|
// REQS= #./plugins/*/*.c
|
||||||
|
|
||||||
|
|
||||||
#define CACHE \
|
#define CACHE \
|
||||||
"base-cache-directory", CACHE_DIR, \
|
"base-cache-directory", CACHE_DIR, \
|
||||||
|
@ -96,25 +110,70 @@ void load_changed(WebKitWebView *self, WebKitLoadEvent load_event, GtkNotebook *
|
||||||
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:
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
if(LIBRE_REDIRECT_ENABLED){
|
||||||
|
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_REDIRECTED:
|
case WEBKIT_LOAD_REDIRECTED:
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
if(LIBRE_REDIRECT_ENABLED){
|
||||||
|
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_COMMITTED:
|
case WEBKIT_LOAD_COMMITTED:
|
||||||
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
if(LIBRE_REDIRECT_ENABLED){
|
||||||
|
redirect_if_annoying(self, webkit_web_view_get_uri(self));
|
||||||
|
}
|
||||||
|
if(CUSTOM_STYLE_ENABLED){
|
||||||
|
char* style_js = malloc(STYLE_N+1);
|
||||||
|
read_style_js(style_js);
|
||||||
|
webkit_web_view_run_javascript(notebook_get_webview(notebook),
|
||||||
|
style_js,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
free(style_js);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case WEBKIT_LOAD_FINISHED:
|
case WEBKIT_LOAD_FINISHED:
|
||||||
{
|
{
|
||||||
const char* title = webkit_web_view_get_title(self);
|
/* Add gtk tab title */
|
||||||
|
const char* webpage_title = webkit_web_view_get_title(self);
|
||||||
|
const int max_length = 25;
|
||||||
|
char tab_title[max_length + 1];
|
||||||
|
if(webpage_title != NULL){
|
||||||
|
for(int i = 0; i<(max_length); i++){
|
||||||
|
tab_title[i] = webpage_title[i];
|
||||||
|
if(webpage_title[i] == '\0'){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tab_title[max_length] = '\0';
|
||||||
|
}
|
||||||
|
|
||||||
gtk_notebook_set_tab_label_text(notebook, GTK_WIDGET(self),
|
gtk_notebook_set_tab_label_text(notebook, GTK_WIDGET(self),
|
||||||
title == NULL ? "—" : title );
|
webpage_title == NULL ? "—" : tab_title );
|
||||||
// gtk_widget_hide(GTK_WIDGET(bar));
|
// gtk_widget_hide(GTK_WIDGET(bar));
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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)
|
||||||
{
|
{
|
||||||
|
@ -128,6 +187,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);
|
||||||
|
@ -173,107 +233,124 @@ int handle_key(func id, GtkNotebook *notebook)
|
||||||
static bool is_fullscreen = 0;
|
static bool is_fullscreen = 0;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case goback:
|
case goback:
|
||||||
webkit_web_view_go_back(notebook_get_webview(notebook));
|
webkit_web_view_go_back(notebook_get_webview(notebook));
|
||||||
break;
|
break;
|
||||||
case goforward:
|
case goforward:
|
||||||
webkit_web_view_go_forward(notebook_get_webview(notebook));
|
webkit_web_view_go_forward(notebook_get_webview(notebook));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case refresh:
|
case refresh:
|
||||||
webkit_web_view_reload(notebook_get_webview(notebook));
|
webkit_web_view_reload(notebook_get_webview(notebook));
|
||||||
break;
|
break;
|
||||||
case refresh_force:
|
case refresh_force:
|
||||||
webkit_web_view_reload_bypass_cache(notebook_get_webview(notebook));
|
webkit_web_view_reload_bypass_cache(notebook_get_webview(notebook));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case back_to_home:
|
case back_to_home:
|
||||||
load_uri(notebook_get_webview(notebook), HOME);
|
load_uri(notebook_get_webview(notebook), HOME);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zoomin:
|
case zoomin:
|
||||||
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), (zoom += ZOOM_VAL));
|
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), (zoom += ZOOM_VAL));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zoomout:
|
case zoomout:
|
||||||
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), (zoom -= ZOOM_VAL));
|
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), (zoom -= ZOOM_VAL));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case zoom_reset:
|
case zoom_reset:
|
||||||
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), (zoom = ZOOM));
|
webkit_web_view_set_zoom_level(notebook_get_webview(notebook), (zoom = ZOOM));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case prev_tab:
|
case prev_tab:
|
||||||
if (gtk_notebook_get_current_page(notebook) == 0) {
|
if (gtk_notebook_get_current_page(notebook) == 0) {
|
||||||
gtk_notebook_set_current_page(notebook,
|
gtk_notebook_set_current_page(notebook,
|
||||||
gtk_notebook_get_n_pages(notebook) - 1);
|
gtk_notebook_get_n_pages(notebook) - 1);
|
||||||
} else {
|
} else {
|
||||||
gtk_notebook_prev_page(notebook);
|
gtk_notebook_prev_page(notebook);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case next_tab:
|
case next_tab:
|
||||||
if (gtk_notebook_get_current_page(notebook) ==
|
if (gtk_notebook_get_current_page(notebook) ==
|
||||||
gtk_notebook_get_n_pages(notebook) - 1) {
|
gtk_notebook_get_n_pages(notebook) - 1) {
|
||||||
notebook_append(notebook, NULL);
|
notebook_append(notebook, NULL);
|
||||||
gtk_notebook_set_show_tabs(notebook, true);
|
gtk_notebook_set_show_tabs(notebook, true);
|
||||||
} else {
|
} else {
|
||||||
gtk_notebook_next_page(notebook);
|
gtk_notebook_next_page(notebook);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case close_tab:
|
case close_tab:
|
||||||
gtk_notebook_remove_page(notebook, gtk_notebook_get_current_page(notebook));
|
gtk_notebook_remove_page(notebook, gtk_notebook_get_current_page(notebook));
|
||||||
|
|
||||||
switch (gtk_notebook_get_n_pages(notebook)) {
|
switch (gtk_notebook_get_n_pages(notebook)) {
|
||||||
case 0:
|
case 0:
|
||||||
exit(0);
|
exit(0);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
gtk_notebook_set_show_tabs(notebook, false);
|
gtk_notebook_set_show_tabs(notebook, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case toggle_fullscreen:
|
case toggle_fullscreen:
|
||||||
if (is_fullscreen)
|
if (is_fullscreen)
|
||||||
gtk_window_unfullscreen(window);
|
gtk_window_unfullscreen(window);
|
||||||
else
|
else
|
||||||
gtk_window_fullscreen(window);
|
gtk_window_fullscreen(window);
|
||||||
|
|
||||||
is_fullscreen = ! is_fullscreen;
|
is_fullscreen = ! is_fullscreen;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case show_searchbar:
|
case show_searchbar:
|
||||||
entry_mode = _SEARCH;
|
entry_mode = _SEARCH;
|
||||||
show_bar(notebook);
|
show_bar(notebook);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case show_finder:
|
case show_finder:
|
||||||
entry_mode = _FIND;
|
entry_mode = _FIND;
|
||||||
show_bar(notebook);
|
show_bar(notebook);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case finder_next:
|
case finder_next:
|
||||||
webkit_find_controller_search_next(
|
webkit_find_controller_search_next(
|
||||||
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
|
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case finder_prev:
|
case finder_prev:
|
||||||
webkit_find_controller_search_previous(
|
webkit_find_controller_search_previous(
|
||||||
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
|
webkit_web_view_get_find_controller(notebook_get_webview(notebook)));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case newtab:
|
case newtab:
|
||||||
notebook_append(notebook, NULL);
|
notebook_append(notebook, NULL);
|
||||||
gtk_notebook_set_show_tabs(notebook, true);
|
gtk_notebook_set_show_tabs(notebook, true);
|
||||||
|
break;
|
||||||
|
|
||||||
case hidebar:
|
case hidebar:
|
||||||
entry_mode = _HIDDEN;
|
entry_mode = _HIDDEN;
|
||||||
show_bar(notebook);
|
show_bar(notebook);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case prettify:
|
||||||
|
{
|
||||||
|
if(READABILITY_ENABLED){
|
||||||
|
char* readability_js = malloc(READABILITY_N+1);
|
||||||
|
read_readability_js(readability_js);
|
||||||
|
webkit_web_view_run_javascript(notebook_get_webview(notebook),
|
||||||
|
readability_js,
|
||||||
|
NULL, NULL, NULL);
|
||||||
|
free(readability_js);
|
||||||
|
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,7 +387,7 @@ void window_init(GtkNotebook *notebook)
|
||||||
800);
|
800);
|
||||||
gtk_entry_buffer_new("", 0);
|
gtk_entry_buffer_new("", 0);
|
||||||
gtk_entry_set_alignment(search, 0.48);
|
gtk_entry_set_alignment(search, 0.48);
|
||||||
gtk_widget_set_size_request(GTK_WIDGET(search), 300, -1);
|
gtk_widget_set_size_request(GTK_WIDGET(search), 1200, -1);
|
||||||
gtk_header_bar_set_custom_title(bar, GTK_WIDGET(search));
|
gtk_header_bar_set_custom_title(bar, GTK_WIDGET(search));
|
||||||
gtk_window_set_titlebar(window, GTK_WIDGET(bar));
|
gtk_window_set_titlebar(window, GTK_WIDGET(bar));
|
||||||
g_signal_connect(search, "activate", G_CALLBACK(search_activate), notebook);
|
g_signal_connect(search, "activate", G_CALLBACK(search_activate), notebook);
|
||||||
|
|
BIN
user-scripts/styles/images/style-nuno.png
Normal file
BIN
user-scripts/styles/images/style-nuno.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 178 KiB |
BIN
user-scripts/styles/images/style-original.png
Normal file
BIN
user-scripts/styles/images/style-original.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 175 KiB |
52
user-scripts/styles/style-nuno.css
Normal file
52
user-scripts/styles/style-nuno.css
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
@define-color Surface0 #313244;
|
||||||
|
@define-color Surface1 #45475a;
|
||||||
|
@define-color Base #1e1e2e;
|
||||||
|
@define-color Mantle #181825;
|
||||||
|
@define-color Lavender #b4befe;
|
||||||
|
@define-color Text #cdd6f4;
|
||||||
|
|
||||||
|
* {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
outline-color: @Lavender;
|
||||||
|
color: @Text;
|
||||||
|
border-color: white;
|
||||||
|
font-size: 16px;
|
||||||
|
/*@Base; */
|
||||||
|
/* border-bottom-color: @Base; */
|
||||||
|
}
|
||||||
|
|
||||||
|
window, notebook, headerbar {
|
||||||
|
background: @Base;
|
||||||
|
}
|
||||||
|
|
||||||
|
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 {
|
||||||
|
background-color: @Surface0;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry:focus {
|
||||||
|
background-color: @Surface0;
|
||||||
|
padding-left: 10px;
|
||||||
|
|
||||||
|
}
|
37
user-scripts/styles/style-original.css
Normal file
37
user-scripts/styles/style-original.css
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
@define-color Surface0 #313244;
|
||||||
|
@define-color Surface1 #45475a;
|
||||||
|
@define-color Base #1e1e2e;
|
||||||
|
@define-color Mantle #181825;
|
||||||
|
@define-color Lavender #b4befe;
|
||||||
|
@define-color Text #cdd6f4;
|
||||||
|
|
||||||
|
* {
|
||||||
|
padding: 0px;
|
||||||
|
margin: 0px;
|
||||||
|
outline-color: @Lavender;
|
||||||
|
color: @Text;
|
||||||
|
border-bottom-color: @Base;
|
||||||
|
}
|
||||||
|
|
||||||
|
window, notebook, headerbar {
|
||||||
|
background: @Base;
|
||||||
|
}
|
||||||
|
|
||||||
|
tabs {
|
||||||
|
background-color: @Base;
|
||||||
|
padding: 3px;
|
||||||
|
}
|
||||||
|
|
||||||
|
tab {
|
||||||
|
background-color: @Base;
|
||||||
|
margin: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry {
|
||||||
|
background-color: @Surface0;
|
||||||
|
padding-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
entry:focus {
|
||||||
|
box-shadow: none;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user