2023-02-07 13:28:21 +00:00
|
|
|
#include <stdbool.h>
|
2024-03-12 17:39:03 +00:00
|
|
|
#include <gdk/gdk.h>
|
|
|
|
// Previously: #include <gdk/gdkkeysyms.h>
|
2024-03-12 19:01:31 +00:00
|
|
|
// But GTK3 discourages including the individual headers
|
|
|
|
// In GTK4, the location also changes to <gdk/gdkenums.h>
|
2023-02-07 13:28:21 +00:00
|
|
|
|
2024-02-11 12:58:38 +00:00
|
|
|
// Key user config
|
2023-06-05 01:15:32 +00:00
|
|
|
#define WIDTH 1920 // 960 for half-width, 1920 for full width
|
2023-02-07 13:28:21 +00:00
|
|
|
#define HEIGHT 1080
|
2024-02-11 13:06:23 +00:00
|
|
|
#define BAR_SIZE 1000
|
2024-02-11 12:58:38 +00:00
|
|
|
|
|
|
|
// More user config
|
2023-11-08 23:00:31 +00:00
|
|
|
#define ZOOM 1.6 /* Starting zoom level.*/
|
2023-02-07 13:28:21 +00:00
|
|
|
#define ZOOM_VAL .1 /* Zooming value in zoomin/zoomout functions */
|
|
|
|
#define BG_COLOR "#FEFEFE" /* "FEFEFE", "#1E1E2E" */
|
2023-05-14 03:50:14 +00:00
|
|
|
#define DEBUG false
|
2023-06-17 06:19:29 +00:00
|
|
|
#define MAX_NUM_TABS 8 // set to 0 or false if you want unlimited tabs, or look at the relevant rose.c code.
|
2024-03-21 11:29:47 +00:00
|
|
|
#define SEARCH "https://search.brave.com/search?q=%s"
|
|
|
|
// #define SEARCH "https://search.nunosempere.com/search?q=%s"
|
2024-03-14 19:31:07 +00:00
|
|
|
// #define SEARCH "https://lite.duckduckgo.com/html/?q=%s"
|
|
|
|
#define HOME ""
|
2024-03-14 22:31:04 +00:00
|
|
|
// ^ Could also be a website ("https://search.nunosempere.com"), or a file ("file:///opt/rose/homepage.png")
|
2024-03-14 19:31:07 +00:00
|
|
|
// #define HOME "https://search.nunosempere.com/"
|
2024-03-14 22:31:04 +00:00
|
|
|
// #define HOME "file:///opt/rosenrot/rose.png"
|
2023-02-07 13:28:21 +00:00
|
|
|
|
2024-02-11 15:58:35 +00:00
|
|
|
// Plugins
|
|
|
|
#define LIBRE_REDIRECT_ENABLED true
|
|
|
|
#define READABILITY_ENABLED true
|
|
|
|
#define CUSTOM_STYLE_ENABLED true
|
|
|
|
#define CUSTOM_USER_AGENT false
|
|
|
|
/*
|
|
|
|
To disable plugins:
|
|
|
|
1. set their corresponding variable to false
|
|
|
|
2. you could also look into this file at commit afe93518a for an approach using stand-in code.
|
|
|
|
3. recompile
|
|
|
|
|
|
|
|
To remove plugins completely;
|
2024-03-18 00:31:11 +00:00
|
|
|
1. Remove the corresponding code in the rosenrot.c by looking for the variables above.
|
|
|
|
2. Remove PLUGIN and $(PLUGIN) from the makefile
|
2024-02-11 15:58:35 +00:00
|
|
|
3. Recompile
|
|
|
|
*/
|
|
|
|
|
2024-02-11 12:58:38 +00:00
|
|
|
// Webkit settings
|
|
|
|
// See: 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"
|
|
|
|
/* CACHE */
|
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-02-11 12:58:38 +00:00
|
|
|
|
|
|
|
// GTK
|
2024-02-11 15:57:06 +00:00
|
|
|
#define GTK_SETTINGS_CONFIG_H "gtk-application-prefer-dark-theme", false, "gtk-enable-animations", false
|
2024-02-11 12:58:38 +00:00
|
|
|
#define KEY(x) GDK_KEY_##x
|
2024-03-22 12:38:13 +00:00
|
|
|
/*
|
|
|
|
There are two different constants for Page_Up/Page_Down:
|
|
|
|
This could possibly have something to so with having Page_Down/Page_Up
|
|
|
|
as part of a keypad with/without NumLock
|
|
|
|
See: https://docs.gtk.org/gdk3/?q=Page_Up
|
|
|
|
See: https://docs.gtk.org/gdk3/?q=GDK_KEY_KP
|
|
|
|
*/
|
2024-02-11 12:58:38 +00:00
|
|
|
|
|
|
|
// Shortcuts
|
2023-02-07 13:28:21 +00:00
|
|
|
typedef enum {
|
|
|
|
goback,
|
|
|
|
goforward,
|
|
|
|
refresh,
|
|
|
|
refresh_force,
|
|
|
|
back_to_home,
|
|
|
|
toggle_fullscreen,
|
|
|
|
zoomin,
|
|
|
|
zoomout,
|
|
|
|
zoom_reset,
|
2024-01-06 15:30:09 +00:00
|
|
|
new_tab,
|
2023-02-07 13:28:21 +00:00
|
|
|
next_tab,
|
|
|
|
prev_tab,
|
|
|
|
close_tab,
|
|
|
|
show_searchbar,
|
|
|
|
show_finder,
|
|
|
|
finder_next,
|
|
|
|
finder_prev,
|
|
|
|
prettify,
|
|
|
|
hide_bar
|
|
|
|
} func;
|
|
|
|
|
|
|
|
#define SFT 1 << 0
|
|
|
|
#define CTRL 1 << 2
|
|
|
|
#define ALT 1 << 3
|
2024-03-12 18:10:20 +00:00
|
|
|
// reference: <https://github.com/GNOME/gtk/blob/7ea7d5c3906ccd231b04654101bb742f157d82f6/gdk/gdkenums.h#L140>
|
2023-02-07 13:28:21 +00:00
|
|
|
|
|
|
|
static struct {
|
|
|
|
unsigned mod;
|
|
|
|
unsigned key;
|
|
|
|
func id;
|
2024-02-11 16:14:01 +00:00
|
|
|
} shortcut[] = {
|
2024-03-22 12:38:13 +00:00
|
|
|
{ CTRL, KEY(h), goback },
|
|
|
|
{ CTRL, KEY(j), goforward },
|
|
|
|
{ CTRL, KEY(r), refresh },
|
|
|
|
{ CTRL, KEY(R), refresh_force },
|
|
|
|
{ CTRL, KEY(H), back_to_home },
|
|
|
|
{ CTRL, KEY(equal), zoomin },
|
|
|
|
{ CTRL, KEY(minus), zoomout },
|
|
|
|
{ CTRL, KEY(0), zoom_reset },
|
|
|
|
{ CTRL, KEY(KP_Page_Up), prev_tab }, /* also try KEY(Page_Up) if this doesn't work on your machine */
|
|
|
|
{ CTRL, KEY(KP_Page_Down), next_tab }, /* ditto for KEY(Page_Down) */
|
|
|
|
{ CTRL, KEY(t), new_tab },
|
|
|
|
{ CTRL, KEY(w), close_tab },
|
|
|
|
{ 0x0, KEY(F11), toggle_fullscreen },
|
|
|
|
{ CTRL, KEY(l), show_searchbar },
|
|
|
|
{ CTRL, KEY(semicolon), hide_bar },
|
|
|
|
{ CTRL, KEY(f), show_finder },
|
|
|
|
{ CTRL, KEY(n), finder_next },
|
|
|
|
{ CTRL, KEY(N), finder_prev },
|
|
|
|
{ CTRL, KEY(p), prettify }
|
2023-02-07 13:28:21 +00:00
|
|
|
};
|
|
|
|
/* ^ For controls more akin to normal browsers */
|
|
|
|
/* Reference for the key shorthand:
|
|
|
|
* <https://gitlab.gnome.org/GNOME/gtk/-/blob/main/gdk/gdkkeysyms.h> */
|
|
|
|
|
|
|
|
/* Old controls: {
|
2024-03-12 19:01:31 +00:00
|
|
|
{ CTRL, KEY(h), goback },
|
|
|
|
{ CTRL, KEY(l), goforward },
|
|
|
|
{ CTRL, KEY(r), refresh },
|
2023-02-07 13:28:21 +00:00
|
|
|
{ CTRL | SFT, KEY(R), refresh_force },
|
|
|
|
{ CTRL | SFT, KEY(H), back_to_home },
|
2024-03-12 19:01:31 +00:00
|
|
|
{ CTRL, KEY(equal), zoomin },
|
|
|
|
{ CTRL, KEY(minus), zoomout },
|
|
|
|
{ CTRL, KEY(0), zoom_reset },
|
|
|
|
{ ALT, KEY(h), prev_tab },
|
2023-02-07 13:28:21 +00:00
|
|
|
{ CTRL, KEY(k), hide_searchbar },
|
2024-03-12 19:01:31 +00:00
|
|
|
{ ALT, KEY(l), next_tab },
|
|
|
|
{ CTRL, KEY(w), close_tab },
|
|
|
|
{ 0x0, KEY(F11), toggle_fullscreen },
|
|
|
|
{ CTRL, KEY(e), show_searchbar },
|
|
|
|
{ CTRL, KEY(f), show_finder },
|
|
|
|
{ CTRL, KEY(n), finder_next },
|
|
|
|
{ CTRL | SFT, KEY(N), finder_prev },
|
2023-02-07 13:28:21 +00:00
|
|
|
{ CTRL, KEY(p), prettify }
|
|
|
|
};
|
|
|
|
*/
|
2024-02-11 12:58:38 +00:00
|
|
|
|