commit 309436705689dfaffb94c4d2001138b61e52ea07
parent 0333cebb10bb3e8a04fabfe144cd4b19f29705ea
Author: z0gg3r <z0gg3r@users.no-reply.github.com>
Date: Mon, 30 Aug 2021 21:44:05 +0200
Surf patch that adds a quit function
This just adds a simple quit function that first calls cleanup and then exit(0)
and a adds 'q' as a hotkey in config.def.h to call the new function.
Diffstat:
2 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/surf.suckless.org/patches/quit-hotkey/index.md b/surf.suckless.org/patches/quit-hotkey/index.md
@@ -0,0 +1,19 @@
+quit hotkey
+===================
+
+Description
+-----------
+
+This patch adds a quit function to surf.c and adds 'q' as a hotkey to quit in
+the config.def.h file.
+
+Download
+--------
+
+* [surf-quithotkey-20210830-11dca18.diff](surf-quithotkey-20210830-11dca18.diff)
+ (4.0k)
+
+Author
+------
+
+* zocker <zockerfreunde03.info@gmx.de>
diff --git a/surf.suckless.org/patches/quit-hotkey/surf-quit_hotkey-20210830-11dca18.diff b/surf.suckless.org/patches/quit-hotkey/surf-quit_hotkey-20210830-11dca18.diff
@@ -0,0 +1,53 @@
+From bf390f44ba6de4aa6e30ab28a8ef51886e338d3e Mon Sep 17 00:00:00 2001
+From: z0gg3r <z0gg3r@users.no-reply.github.com>
+Date: Mon, 30 Aug 2021 21:24:52 +0200
+Subject: [PATCH] Adds new function quit that calls cleanup() and exit(0) and
+ assings q as hotkey to quit in config.def.h
+
+---
+ config.def.h | 2 ++
+ surf.c | 8 ++++++++
+ 2 files changed, 10 insertions(+)
+
+diff --git a/config.def.h b/config.def.h
+index 1355ba3..cf2fc68 100644
+--- a/config.def.h
++++ b/config.def.h
+@@ -136,6 +136,8 @@ static Key keys[] = {
+
+ { 0, GDK_KEY_Escape, stop, { 0 } },
+ { MODKEY, GDK_KEY_c, stop, { 0 } },
++
++ { 0, GDK_KEY_q, quit, { 0 } },
+
+ { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
+ { MODKEY, GDK_KEY_r, reload, { .i = 0 } },
+diff --git a/surf.c b/surf.c
+index 03d8242..c0ba8ed 100644
+--- a/surf.c
++++ b/surf.c
+@@ -228,6 +228,7 @@ static void scrollv(Client *c, const Arg *a);
+ static void scrollh(Client *c, const Arg *a);
+ static void navigate(Client *c, const Arg *a);
+ static void stop(Client *c, const Arg *a);
++static void quit(Client *c, const Arg *a);
+ static void toggle(Client *c, const Arg *a);
+ static void togglefullscreen(Client *c, const Arg *a);
+ static void togglecookiepolicy(Client *c, const Arg *a);
+@@ -1901,6 +1902,13 @@ stop(Client *c, const Arg *a)
+ webkit_web_view_stop_loading(c->view);
+ }
+
++void
++quit(Client *c, const Arg *a)
++{
++ cleanup();
++ exit(0);
++}
++
+ void
+ toggle(Client *c, const Arg *a)
+ {
+--
+2.33.0
+