From 151bb561befc5279f745f6190bc58f71017cabc9 Mon Sep 17 00:00:00 2001 From: Arslaan Pathan Date: Sun, 5 Apr 2026 23:35:49 +1200 Subject: Add user_start for easy extensibility via config.h and fix on_cmdbar_activate not returning anything --- Makefile | 2 +- config.def.h | 11 +++++++++++ main.c | 3 +++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ddf943..37b0149 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ # Copyright (c) 2026 Arslaan Pathan # This software is licensed under the ARPL. See LICENSE for details. CC = clang -CFLAGS = -std=gnu17 `pkg-config --cflags webkit2gtk-4.1 gtk+-3.0` +CFLAGS = -std=gnu17 `pkg-config --cflags webkit2gtk-4.1 gtk+-3.0` -Wno-deprecated-declarations LIBS = `pkg-config --libs webkit2gtk-4.1 gtk+-3.0` TARGET = cinnamon SRC = main.c diff --git a/config.def.h b/config.def.h index c69eb9f..16102aa 100644 --- a/config.def.h +++ b/config.def.h @@ -193,4 +193,15 @@ static const Command commands[] = { { "forward", &_cmd_forward }, }; + +/* User start/hooks + * Do whatever you want here, initialize whatever custom hooks you want to your heart's content. At this point config.h can just become an extension api on crack, knock yourself out + * have fun */ +/* It runs just before gtk_main(), after everything prior has been initialized. */ +void user_start(Cinnamon* cinnamon) { + /* Function has to exist or else main.c won't compile, this code is so scuffed T_T */ + /* for now just printf to see if it loads */ + printf("[user_start] starting NOW!\n"); +} + #endif diff --git a/main.c b/main.c index 8bc8246..2374d61 100644 --- a/main.c +++ b/main.c @@ -87,6 +87,7 @@ static gboolean on_cmdbar_activate(GtkEntry *entry, gpointer data) { gtk_widget_hide(cinnamon->cmdbar); cmdbar_focused = false; set_mode(cinnamon, 0); + return TRUE; } static gboolean on_key_press(GtkWidget *widget, GdkEventKey *event, gpointer data) { @@ -219,6 +220,8 @@ int main(int argc, char *argv[]) { #ifdef HIDE_TAB_BAR gtk_notebook_set_show_tabs(GTK_NOTEBOOK(cinnamon.notebook), FALSE); #endif + + user_start(&cinnamon); gtk_main(); return 0; -- cgit v1.2.3