aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--Makefile5
-rw-r--r--README.md1
-rw-r--r--config.def.h (renamed from config.h)8
-rw-r--r--main.c20
5 files changed, 22 insertions, 13 deletions
diff --git a/.gitignore b/.gitignore
index 0e9b4c6..043bea3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
cinnamon
+config.h
diff --git a/Makefile b/Makefile
index 76fb5aa..9ddf943 100644
--- a/Makefile
+++ b/Makefile
@@ -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
diff --git a/README.md b/README.md
index 6c14a56..e66bf67 100644
--- a/README.md
+++ b/README.md
@@ -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
```
diff --git a/config.h b/config.def.h
index 3a3a4e6..eebd436 100644
--- a/config.h
+++ b/config.def.h
@@ -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" },
diff --git a/main.c b/main.c
index a6b012f..d5321a0 100644
--- a/main.c
+++ b/main.c
@@ -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;