diff options
| -rw-r--r-- | .gitignore | 1 | ||||
| -rw-r--r-- | Makefile | 5 | ||||
| -rw-r--r-- | README.md | 1 | ||||
| -rw-r--r-- | config.def.h (renamed from config.h) | 8 | ||||
| -rw-r--r-- | main.c | 20 |
5 files changed, 22 insertions, 13 deletions
@@ -1 +1,2 @@ cinnamon +config.h @@ -24,4 +24,9 @@ install: $(TARGET) uninstall: rm -f $(PREFIX)/bin/$(TARGET) +config.h: + @cp config.def.h config.h + @echo "config.h created from config.def.h, edit it with your preferred configuration then run make again" + @exit 1 + .PHONY: all clean run @@ -37,6 +37,7 @@ To install this software, you must compile it from source. Don't worry, it shoul ```shell $ git clone https://git.arslaancodes.com/cinnamon-browser.git $ cd cinnamon-browser +$ cp config.def.h config.h # make install ``` @@ -1,7 +1,6 @@ -/* -Copyright (c) 2026 Arslaan Pathan -This software is licensed under the ARPL. See LICENSE for details. -*/ +/* This file (and this file ONLY) is released into the public domain. + * No rights reserved. Copy, modify, do whatever you want. */ + #ifndef CONFIG_H #define CONFIG_H @@ -20,6 +19,7 @@ typedef struct { const char* command; } Keybind; +/* TODO: make this use functions and not command strings */ static const Keybind keybinds[] = { { "<S-o>", ":tab_open" }, { "d", ":tab_close" }, @@ -73,29 +73,31 @@ int main(int argc, char *argv[]) { #endif gtk_init(&argc, &argv); + Cinnamon cinnamon = {0}; + /* Create a new window and set default size */ - GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL); + cinnamon.window = gtk_window_new(GTK_WINDOW_TOPLEVEL); /* Size constants defined in config.h */ - gtk_window_set_default_size(GTK_WINDOW(window), WINDOW_WIDTH, WINDOW_HEIGHT); - g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL); + gtk_window_set_default_size(GTK_WINDOW(cinnamon.window), WINDOW_WIDTH, WINDOW_HEIGHT); + g_signal_connect(cinnamon.window, "destroy", G_CALLBACK(gtk_main_quit), NULL); - GtkWidget *notebook = gtk_notebook_new(); - gtk_container_add(GTK_CONTAINER(window), notebook); + cinnamon.notebook = gtk_notebook_new(); + gtk_container_add(GTK_CONTAINER(cinnamon.window), cinnamon.notebook); /* Create initial tab */ GtkWidget *webview = webkit_web_view_new(); - gtk_notebook_append_page(GTK_NOTEBOOK(notebook), webview, gtk_label_new("New Tab")); + gtk_notebook_append_page(GTK_NOTEBOOK(cinnamon.notebook), webview, gtk_label_new("New Tab")); /* HOMEPAGE defined in config.h */ webkit_web_view_load_uri(WEBKIT_WEB_VIEW(webview), HOMEPAGE); /* handle keypresses */ - g_signal_connect(window, "key-press-event", G_CALLBACK(on_key_press), notebook); + g_signal_connect(cinnamon.window, "key-press-event", G_CALLBACK(on_key_press), &cinnamon); /* handle tab changes */ - g_signal_connect(webview, "notify::title", G_CALLBACK(on_title_changed), notebook); + g_signal_connect(webview, "notify::title", G_CALLBACK(on_title_changed), cinnamon.notebook); - gtk_widget_show_all(window); + gtk_widget_show_all(cinnamon.window); gtk_main(); return 0; |
