From 75d932dcdb70be5cc7c2756d7f042ff1df594cb1 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Sat, 28 Mar 2026 09:33:50 +1300 Subject: Some stuff (i have no idea what to put on the commit message) --- config.def.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'config.def.h') diff --git a/config.def.h b/config.def.h index 6bda445..d7af70e 100644 --- a/config.def.h +++ b/config.def.h @@ -4,21 +4,27 @@ #ifndef CONFIG_H #define CONFIG_H +#include +#include + /* forward declarations from main.c */ extern int mode; /* Cinnamon is declared in main.c before including config.h. Yes, I know this code is held together by hopes and dreams, but good enough. */ extern void tabopen(Cinnamon* cinnamon); +extern void tabclose(Cinnamon* cinnamon); + +/* guard to ensure config.h isnt empty or something + * if not defined, main will exit with code 1 */ +#define CINNAMON_ENABLED /* default window width/height, can be resized after. */ #define WINDOW_WIDTH 1024 #define WINDOW_HEIGHT 768 #define HOMEPAGE "https://start.duckduckgo.com" -/* this value is required for the browser to launch - if its not there the browser will exit with code 1 - do not ask any questions */ -#define ObamaPrism /* if a keybind is unbound, still don't send when not in insert mode */ #define NO_SEND_UNBOUND_KEYBINDS +/* if the last tab is closed, don't quit, just make a fresh one */ +#define NO_QUIT_ON_CLOSE_LAST_TAB /* Keybind definitions */ static void _kbd_insmode(Cinnamon* cinnamon, void* arg) { @@ -45,16 +51,21 @@ static void _kbd_scroll(Cinnamon* cinnamon, void* arg) { js = "alert(\"an unexpected error occurred in the scroll handler\");"; } - webkit_web_view_evaluate_javascript(WEBKIT_WEB_VIEW(webview), js, -1, NULL, NULL, NULL, NULL, NULL); + /* some distros ship older versions of webkit2gtk-4.1, use the deprecated run_javascript api to ensure compatibility */ + webkit_web_view_run_javascript(WEBKIT_WEB_VIEW(webview), js, NULL, NULL, NULL); } static void _kbd_tabsel(Cinnamon* cinnamon, void* arg) { gtk_notebook_set_current_page(GTK_NOTEBOOK(cinnamon->notebook), (int)(intptr_t)arg); } +static void _kbd_tabclose(Cinnamon* cinnamon, void* arg) { + tabclose(cinnamon); +} + static const Keybind keybinds[] = { { "", &_kbd_tabopen, NULL }, - // { "d", ":tab_close" }, + { "d", &_kbd_tabclose, NULL }, // { "o", ":commandline_show \":open\"" }, { "i", &_kbd_insmode, NULL }, { "j", &_kbd_scroll, "down" }, -- cgit v1.2.3