aboutsummaryrefslogtreecommitdiff
path: root/config.def.h
diff options
context:
space:
mode:
authorArslaan Pathan <[email protected]>2026-04-04 22:11:56 +1300
committerArslaan Pathan <[email protected]>2026-04-04 22:11:56 +1300
commit191f74d6d2d81c22840ca8407be1c5c746b042ed (patch)
tree2b9bff275edae6f1de85308c0b6dd2af2174a356 /config.def.h
parenta0df420a325d0f8e60a0ce00c329ce112f251ad7 (diff)
downloadcinnamon-browser-191f74d6d2d81c22840ca8407be1c5c746b042ed.tar.xz
cinnamon-browser-191f74d6d2d81c22840ca8407be1c5c746b042ed.zip
Add an indicator for the current mode, improve config file a bit, and add dedicated mode setter
Diffstat (limited to 'config.def.h')
-rw-r--r--config.def.h18
1 files changed, 12 insertions, 6 deletions
diff --git a/config.def.h b/config.def.h
index d7af70e..76df792 100644
--- a/config.def.h
+++ b/config.def.h
@@ -8,13 +8,11 @@
#include <gtk/gtk.h>
/* 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);
+extern void set_mode(Cinnamon* cinnamon, int new_mode);
-/* guard to ensure config.h isnt empty or something
- * if not defined, main will exit with code 1 */
+/* guard ensures config exists/enables brower */
#define CINNAMON_ENABLED
/* default window width/height, can be resized after. */
@@ -25,10 +23,13 @@ extern void tabclose(Cinnamon* cinnamon);
#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
+/* hide the tab bar, unless a keybind or command shows it */
+#define HIDE_TAB_BAR
/* Keybind definitions */
+/* we use the _kbd prefix here just because, idk, good practice to keep keybinds isolated? in practice use whatever the hell you want as long as it doesnt interfere with builtin functions */
static void _kbd_insmode(Cinnamon* cinnamon, void* arg) {
- mode = 1;
+ set_mode(cinnamon, 1);
}
static void _kbd_tabopen(Cinnamon* cinnamon, void* arg) {
@@ -52,6 +53,11 @@ static void _kbd_scroll(Cinnamon* cinnamon, void* arg) {
}
/* some distros ship older versions of webkit2gtk-4.1, use the deprecated run_javascript api to ensure compatibility */
+ /* this entire scroll mechanism is scuffed, first of all, i should have abstracted that in main.c, second of all, we're using JS apis of all things just to scroll T_T */
+ /* this code sucks,
+ * you know it,
+ * i know it.
+ * call me an idiot later and just use the browser. */
webkit_web_view_run_javascript(WEBKIT_WEB_VIEW(webview), js, NULL, NULL, NULL);
}
@@ -64,7 +70,7 @@ static void _kbd_tabclose(Cinnamon* cinnamon, void* arg) {
}
static const Keybind keybinds[] = {
- { "<S-o>", &_kbd_tabopen, NULL },
+ { "t", &_kbd_tabopen, NULL },
{ "d", &_kbd_tabclose, NULL },
// { "o", ":commandline_show \":open\"" },
{ "i", &_kbd_insmode, NULL },