2026-08-12 18:48:46 +08:00
|
|
|
#ifndef PAGE_CONFIG_H
|
|
|
|
|
#define PAGE_CONFIG_H
|
|
|
|
|
|
|
|
|
|
#include <gdk/gdk.h>
|
|
|
|
|
|
|
|
|
|
/* Page loaded on startup if no URL is given on the command line,
|
|
|
|
|
* very self-explanatory*/
|
|
|
|
|
static const char *DEFAULT_URI = "https://google.com/";
|
|
|
|
|
|
|
|
|
|
/* Your search engine of choice */
|
|
|
|
|
static const char *SEARCH_URL_PREFIX = "https://google.com/search?q=";
|
|
|
|
|
|
|
|
|
|
/* Default window size */
|
|
|
|
|
static const int WINDOW_WIDTH = 1200;
|
|
|
|
|
static const int WINDOW_HEIGHT = 800;
|
|
|
|
|
|
|
|
|
|
/* Fraction added/removed per zoom keypress. */
|
|
|
|
|
static const double ZOOM_STEP = 0.1;
|
|
|
|
|
|
2026-08-12 19:05:30 +08:00
|
|
|
/* Zoom level applied to every new view on startup (1.0 = 100%) */
|
|
|
|
|
static const double ZOOM_DEFAULT = 1.0;
|
|
|
|
|
|
2026-08-12 18:48:46 +08:00
|
|
|
/* Pixels scrolled per Ctrl+Shift+J/K press. */
|
|
|
|
|
static const int SCROLL_STEP = 120;
|
|
|
|
|
|
|
|
|
|
/* Path in which cookies, INdexedDB, localStorage, HTTP cache,
|
|
|
|
|
* blah blah blah are stored. NULL for the default WebKit XDG path */
|
|
|
|
|
static const char *DATA_DIR = "~/.local/share/page";
|
|
|
|
|
|
|
|
|
|
static const gboolean ENABLE_DEV_TOOLS = TRUE;
|
|
|
|
|
|
|
|
|
|
/* To URL bar or to not - that is the question */
|
|
|
|
|
#define ENABLE_URL_BAR 1
|
|
|
|
|
|
|
|
|
|
/* keybinds */
|
|
|
|
|
typedef enum {
|
|
|
|
|
ACTION_FOCUS_URL,
|
|
|
|
|
ACTION_QUIT,
|
|
|
|
|
ACTION_RELOAD,
|
|
|
|
|
ACTION_RELOAD_HARD,
|
|
|
|
|
ACTION_BACK,
|
|
|
|
|
ACTION_FORWARD,
|
|
|
|
|
ACTION_ZOOM_IN,
|
|
|
|
|
ACTION_ZOOM_OUT,
|
|
|
|
|
ACTION_ZOOM_RESET,
|
|
|
|
|
ACTION_FULLSCREEN,
|
|
|
|
|
ACTION_ESCAPE,
|
|
|
|
|
ACTION_SCROLL_UP,
|
|
|
|
|
ACTION_SCROLL_DOWN,
|
|
|
|
|
} PageAction;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
guint keyval;
|
|
|
|
|
GdkModifierType mods;
|
|
|
|
|
PageAction action;
|
|
|
|
|
} PageKeybind;
|
|
|
|
|
|
|
|
|
|
static const PageKeybind KEYBINDINGS[] = {
|
|
|
|
|
/* keyval modifiers action */
|
|
|
|
|
#if ENABLE_URL_BAR
|
|
|
|
|
{ GDK_KEY_l, GDK_CONTROL_MASK, ACTION_FOCUS_URL },
|
|
|
|
|
#endif
|
|
|
|
|
{ GDK_KEY_q, GDK_CONTROL_MASK, ACTION_QUIT },
|
|
|
|
|
{ GDK_KEY_r, GDK_CONTROL_MASK, ACTION_RELOAD },
|
|
|
|
|
{ GDK_KEY_R, GDK_CONTROL_MASK | GDK_SHIFT_MASK, ACTION_RELOAD_HARD },
|
|
|
|
|
{ GDK_KEY_F5, 0, ACTION_RELOAD },
|
|
|
|
|
{ GDK_KEY_Left, GDK_ALT_MASK, ACTION_BACK },
|
|
|
|
|
{ GDK_KEY_Right, GDK_ALT_MASK, ACTION_FORWARD },
|
|
|
|
|
{ GDK_KEY_plus, GDK_CONTROL_MASK, ACTION_ZOOM_IN },
|
|
|
|
|
{ GDK_KEY_equal, GDK_CONTROL_MASK, ACTION_ZOOM_IN },
|
|
|
|
|
{ GDK_KEY_minus, GDK_CONTROL_MASK, ACTION_ZOOM_OUT },
|
|
|
|
|
{ GDK_KEY_0, GDK_CONTROL_MASK, ACTION_ZOOM_RESET },
|
|
|
|
|
{ GDK_KEY_F11, 0, ACTION_FULLSCREEN },
|
|
|
|
|
{ GDK_KEY_Escape, 0, ACTION_ESCAPE },
|
|
|
|
|
{ GDK_KEY_H, GDK_CONTROL_MASK | GDK_SHIFT_MASK, ACTION_BACK },
|
|
|
|
|
{ GDK_KEY_L, GDK_CONTROL_MASK | GDK_SHIFT_MASK, ACTION_FORWARD },
|
|
|
|
|
{ GDK_KEY_J, GDK_CONTROL_MASK | GDK_SHIFT_MASK, ACTION_SCROLL_DOWN },
|
|
|
|
|
{ GDK_KEY_K, GDK_CONTROL_MASK | GDK_SHIFT_MASK, ACTION_SCROLL_UP },
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
static const size_t N_KEYBINDINGS = sizeof(KEYBINDINGS) / sizeof(KEYBINDINGS[0]);
|
|
|
|
|
|
2026-08-12 19:05:30 +08:00
|
|
|
#endif
|