add custom style toggle
This commit is contained in:
parent
c4581f3fd5
commit
8aa43e81fc
3
config.h
3
config.h
|
@ -16,7 +16,6 @@
|
|||
// Plugins
|
||||
#define LIBRE_REDIRECT_ENABLED true
|
||||
#define READABILITY_ENABLED true
|
||||
#define CUSTOM_STYLE_ENABLED true
|
||||
#define CUSTOM_USER_AGENT false
|
||||
/*
|
||||
To disable plugins:
|
||||
|
@ -57,6 +56,7 @@ typedef enum {
|
|||
refresh_force,
|
||||
back_to_home,
|
||||
toggle_fullscreen,
|
||||
toggle_custom_style,
|
||||
zoomin,
|
||||
zoomout,
|
||||
zoom_reset,
|
||||
|
@ -93,6 +93,7 @@ static struct {
|
|||
{ CTRL, KEY(t), new_tab },
|
||||
{ CTRL, KEY(w), close_tab },
|
||||
{ 0x0, KEY(F11), toggle_fullscreen },
|
||||
{ CTRL, KEY(S), toggle_custom_style },
|
||||
{ CTRL, KEY(l), show_searchbar },
|
||||
{ CTRL, KEY(semicolon), hide_bar },
|
||||
{ CTRL, KEY(f), show_finder },
|
||||
|
|
|
@ -23,8 +23,9 @@ int shortcut_expand(const char* uri, char* output)
|
|||
"!fnf",
|
||||
"!fnc",
|
||||
"!hn",
|
||||
"!hnb"
|
||||
"!x",
|
||||
"!hnb",
|
||||
"!ww",
|
||||
"!x"
|
||||
};
|
||||
|
||||
char* expansions[] = {
|
||||
|
@ -34,7 +35,8 @@ int shortcut_expand(const char* uri, char* output)
|
|||
"https://forum.nunosempere.com/comments",
|
||||
"https://news.ycombinator.com",
|
||||
"https://news.ycombinator.com/best",
|
||||
"https://twitter.com",
|
||||
"https://web.whatsapp.com",
|
||||
"https://twitter.com"
|
||||
};
|
||||
|
||||
// len = sizeof(shortcuts) / sizeof(shortcuts[0]);
|
||||
|
|
11
rosenrot.c
11
rosenrot.c
|
@ -17,6 +17,7 @@ static struct {
|
|||
Bar_entry_mode entry_mode;
|
||||
} bar;
|
||||
static int num_tabs = 0;
|
||||
static int custom_style_enabled = 1;
|
||||
|
||||
/* Forward declarations */
|
||||
void toggle_bar(GtkNotebook* notebook, Bar_entry_mode mode);
|
||||
|
@ -71,7 +72,7 @@ void redirect_if_annoying(WebKitWebView* view, const char* uri)
|
|||
}
|
||||
void set_custom_style(WebKitWebView* view)
|
||||
{
|
||||
if (CUSTOM_STYLE_ENABLED) {
|
||||
if (custom_style_enabled) {
|
||||
char* style_js = malloc(STYLE_N + 1);
|
||||
read_style_js(style_js);
|
||||
webkit_web_view_evaluate_javascript(view, style_js, -1, NULL, "rosenrot-style-plugin", NULL, NULL, NULL);
|
||||
|
@ -302,7 +303,6 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
|||
}
|
||||
|
||||
break;
|
||||
|
||||
case toggle_fullscreen:
|
||||
if (is_fullscreen)
|
||||
gtk_window_unfullscreen(window);
|
||||
|
@ -310,7 +310,12 @@ int handle_shortcut(func id, GtkNotebook* notebook)
|
|||
gtk_window_fullscreen(window);
|
||||
is_fullscreen = !is_fullscreen;
|
||||
break;
|
||||
|
||||
case toggle_custom_style: /* Ctrl s + Ctrl Shift R to reload */
|
||||
if (custom_style_enabled)
|
||||
custom_style_enabled = 0;
|
||||
else
|
||||
custom_style_enabled = 1;
|
||||
break;
|
||||
case show_searchbar:
|
||||
toggle_bar(notebook, _SEARCH);
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue
Block a user