2023-02-07 13:28:21 +00:00
|
|
|
#include <stdbool.h>
|
2024-07-21 01:21:59 +00:00
|
|
|
#include <gtk/gtk.h>
|
2023-02-07 13:28:21 +00:00
|
|
|
|
2024-07-22 23:04:39 +00:00
|
|
|
/* Key user config */
|
2024-07-23 01:59:00 +00:00
|
|
|
#define HEIGHT 1080
|
2024-07-22 23:04:39 +00:00
|
|
|
#define FULL_WIDTH 1920
|
|
|
|
#define WIDTH FULL_WIDTH
|
|
|
|
#define BAR_WIDTH FULL_WIDTH/2
|
|
|
|
|
|
|
|
/* More user config */
|
|
|
|
#define ZOOM_START_LEVEL 1.8
|
2024-03-24 11:45:21 +00:00
|
|
|
#define ZOOM_STEPSIZE .1
|
2024-07-22 23:04:39 +00:00
|
|
|
#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 */
|
2024-02-11 15:58:35 +00:00
|
|
|
#define LIBRE_REDIRECT_ENABLED true
|
|
|
|
#define READABILITY_ENABLED true
|
|
|
|
#define CUSTOM_USER_AGENT false
|
2024-07-22 23:04:39 +00:00
|
|
|
/*
|
2024-02-11 15:58:35 +00:00
|
|
|
To disable plugins:
|
|
|
|
1. set their corresponding variable to false
|
2024-03-24 11:45:21 +00:00
|
|
|
2. recompile
|
2024-02-11 15:58:35 +00:00
|
|
|
|
|
|
|
To remove plugins completely;
|
2024-07-23 01:54:36 +00:00
|
|
|
1. Remove the corresponding code in rosenrot.c by looking for the variables above, as well as custom_style_enabled
|
2024-03-18 00:31:11 +00:00
|
|
|
2. Remove PLUGIN and $(PLUGIN) from the makefile
|
2024-02-11 15:58:35 +00:00
|
|
|
3. Recompile
|
2024-03-24 11:45:21 +00:00
|
|
|
|
|
|
|
You could also look into commit afe93518a for an approach using stand-in code.
|
2024-02-11 15:58:35 +00:00
|
|
|
*/
|
|
|
|
|
2024-07-22 23:04:39 +00:00
|
|
|
/* Webkit */
|
2024-03-24 11:45:21 +00:00
|
|
|
// https://webkitgtk.org/reference/webkit2gtk/stable/class.Settings.html
|
2024-02-11 12:58:38 +00:00
|
|
|
#define WEBKIT_DEFAULT_SETTINGS \
|
2024-07-22 23:04:39 +00:00
|
|
|
"enable-back-forward-navigation-gestures", true, \
|
|
|
|
"enable-developer-extras", true, \
|
2024-02-11 12:58:38 +00:00
|
|
|
"enable-smooth-scrolling", false, \
|
|
|
|
"default-charset", "utf-8"
|
2024-03-14 18:47:36 +00:00
|
|
|
#define DATA_DIR "/home/nuno/.cache/rosenrot"
|
2024-03-12 17:16:29 +00:00
|
|
|
#define DATA_MANAGER_OPTS "base-cache-directory", DATA_DIR, "base-data-directory", DATA_DIR
|
2024-07-20 22:49:29 +00:00
|
|
|
#define NETWORK_SESSION_OPTS DATA_DIR, DATA_DIR
|
2024-02-11 12:58:38 +00:00
|
|
|
|
2024-07-22 23:04:39 +00:00
|
|
|
/* GTK */
|
2024-03-24 11:45:21 +00:00
|
|
|
// https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkkeysyms.h
|
|
|
|
// https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkenums.h
|
2024-07-22 23:04:39 +00:00
|
|
|
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
|
|
|
#define KEY(x) GDK_KEY_##x
|
2024-03-24 11:45:21 +00:00
|
|
|
#define SFT 1 << 0
|
|
|
|
#define CTRL 1 << 2
|
|
|
|
#define ALT 1 << 3
|
2024-02-11 12:58:38 +00:00
|
|
|
|
2024-07-22 23:04:39 +00:00
|
|
|
/* 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 */
|
2023-02-07 13:28:21 +00:00
|
|
|
typedef enum {
|
2024-04-14 12:56:03 +00:00
|
|
|
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,
|
|
|
|
|
2024-07-22 23:04:39 +00:00
|
|
|
halve_window,
|
|
|
|
rebig_window,
|
|
|
|
|
2024-04-14 12:56:03 +00:00
|
|
|
prettify,
|
2023-02-07 13:28:21 +00:00
|
|
|
} func;
|
|
|
|
|
|
|
|
static struct {
|
|
|
|
unsigned mod;
|
|
|
|
unsigned key;
|
|
|
|
func id;
|
2024-02-11 16:14:01 +00:00
|
|
|
} shortcut[] = {
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(h), goback },
|
|
|
|
{ CTRL, KEY(j), goforward },
|
2024-04-14 12:56:03 +00:00
|
|
|
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(r), refresh },
|
|
|
|
{ CTRL, KEY(R), refresh_force },
|
2024-04-14 12:56:03 +00:00
|
|
|
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(H), back_to_home },
|
2024-04-14 12:56:03 +00:00
|
|
|
|
|
|
|
{ 0x0, KEY(F11), toggle_fullscreen },
|
|
|
|
{ CTRL, KEY(S), toggle_custom_style },
|
|
|
|
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(equal), zoomin },
|
|
|
|
{ CTRL, KEY(minus), zoomout },
|
|
|
|
{ CTRL, KEY(0), zoom_reset },
|
2024-04-14 12:56:03 +00:00
|
|
|
|
2024-07-22 23:04:39 +00:00
|
|
|
{ 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 },
|
|
|
|
// working hypothesis: Page_UP vs KP_Page_Up might depend on whether the user has a numpad
|
|
|
|
{ CTRL | SFT, KEY(Page_Down), next_tab },
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(t), new_tab },
|
|
|
|
{ CTRL, KEY(w), close_tab },
|
2024-04-14 12:56:03 +00:00
|
|
|
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(l), show_searchbar },
|
2024-07-21 03:19:22 +00:00
|
|
|
{ CTRL, KEY(o), hide_bar }, // previously: KEY(semicolon)
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(f), show_finder },
|
|
|
|
{ CTRL, KEY(n), finder_next },
|
|
|
|
{ CTRL, KEY(N), finder_prev },
|
2024-07-22 23:04:39 +00:00
|
|
|
{ CTRL, KEY(Left), halve_window },
|
|
|
|
{ CTRL, KEY(Right), rebig_window },
|
2024-04-14 12:53:45 +00:00
|
|
|
{ CTRL, KEY(p), prettify }
|
2023-02-07 13:28:21 +00:00
|
|
|
};
|