-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.h
146 lines (122 loc) · 4.8 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#include <stdbool.h>
#include <gtk/gtk.h>
/* Key user config */
#define HEIGHT 1504
#define FULL_WIDTH 2256
#define WIDTH FULL_WIDTH
#define BAR_WIDTH FULL_WIDTH/2
/* More user config */
#define ZOOM_START_LEVEL 1.5
#define ZOOM_STEPSIZE .1
#define MAX_NUM_TABS 8 // 0 or false for unlimited tabs
#define SEARCH "https://search.brave.com/search?q=%s"
#define HOME "https://search.brave.com/search"
// #define SEARCH "https://search.nunosempere.com/search?q=%s"
// #define SEARCH "https://lite.duckduckgo.com/html/?q=%s"
// #define HOME "file:///opt/rosenrot/flower-imgs/rose-homepage.png"
/* Plugins */
#define LIBRE_REDIRECT_ENABLED true
#define READABILITY_ENABLED true
#define CUSTOM_USER_AGENT false
/*
To disable plugins:
1. set their corresponding variable to false
2. recompile
To remove plugins completely;
1. Remove the corresponding code in rosenrot.c by looking for the variables above, as well as custom_style_enabled
2. Remove PLUGIN and $(PLUGIN) from the makefile
3. Recompile
You could also look into commit afe93518a for an approach using stand-in code.
*/
/* Webkit */
// https://webkitgtk.org/reference/webkit2gtk/stable/class.Settings.html
#define WEBKIT_DEFAULT_SETTINGS \
"enable-back-forward-navigation-gestures", true, \
"enable-developer-extras", true, \
"enable-smooth-scrolling", false, \
"default-charset", "utf-8"
#define DATA_DIR "/home/nuno/.cache/rosenrot"
#define DATA_MANAGER_OPTS "base-cache-directory", DATA_DIR, "base-data-directory", DATA_DIR
#define NETWORK_SESSION_OPTS DATA_DIR, DATA_DIR
/* GTK */
// https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkkeysyms.h
// https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkenums.h
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
#define KEY(x) GDK_KEY_##x
#define SFT 1 << 0
#define CTRL 1 << 2
#define ALT 1 << 3
/* Misc helpers */
#define ABORT_REQUEST_ON_CURRENT_TAB NULL
#define NULLCHECK(x) \
do { \
if (x == NULL) { \
printf("\nNULL check not passed"); \
printf("@ %s (%d): ", __FILE__, __LINE__); \
exit(0); \
} \
} while (0)
/* Shortcuts */
typedef enum {
goback,
goforward,
refresh,
refresh_force,
back_to_home,
toggle_fullscreen,
toggle_custom_style,
zoomin,
zoomout,
zoom_reset,
new_tab,
next_tab,
prev_tab,
close_tab,
show_searchbar,
hide_bar,
show_finder,
finder_next,
finder_prev,
filter,
halve_window,
rebig_window,
prettify,
save_uri_to_txt,
open_uri_in_brave,
} func;
static struct {
unsigned mod;
unsigned key;
func id;
} shortcut[] = {
{ CTRL, KEY(h), goback },
{ CTRL, KEY(j), goforward },
{ CTRL, KEY(r), refresh },
{ CTRL, KEY(R), refresh_force },
{ CTRL, KEY(H), back_to_home },
{ 0x0, KEY(F11), toggle_fullscreen },
{ CTRL, KEY(S), toggle_custom_style },
{ CTRL, KEY(equal), zoomin },
{ CTRL, KEY(minus), zoomout },
{ CTRL, KEY(0), zoom_reset },
{ CTRL | SFT, KEY(KP_Page_Up), prev_tab }, // use SFT just to show one can
{ CTRL | SFT, KEY(KP_Page_Down), next_tab },
{ CTRL | SFT, KEY(Page_Up), prev_tab },
{ CTRL | SFT, KEY(Page_Down), next_tab },
// working hypothesis: Page_UP vs KP_Page_Up might depend on whether the user has a numpad
{ CTRL, KEY(Tab), next_tab },
{ CTRL, KEY(b), prev_tab },
{ CTRL, KEY(t), new_tab },
{ CTRL, KEY(w), close_tab },
{ CTRL, KEY(l), show_searchbar },
{ CTRL, KEY(o), hide_bar }, // previously: KEY(semicolon)
{ CTRL, KEY(f), show_finder },
{ CTRL, KEY(n), finder_next },
{ CTRL, KEY(N), finder_prev },
{ CTRL, KEY(F), filter },
{ CTRL, KEY(Up), halve_window },
{ CTRL, KEY(Down), rebig_window },
{ CTRL, KEY(p), prettify },
{ CTRL, KEY(s), save_uri_to_txt },
{ CTRL, KEY(b), open_uri_in_brave }
};