surf-quit_hotkey-20210830-11dca18.diff - sites - public wiki contents of suckless.org
 (HTM) git clone git://git.suckless.org/sites
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
       surf-quit_hotkey-20210830-11dca18.diff (1550B)
       ---
            1 From bf390f44ba6de4aa6e30ab28a8ef51886e338d3e Mon Sep 17 00:00:00 2001
            2 From: z0gg3r <z0gg3r@users.no-reply.github.com>
            3 Date: Mon, 30 Aug 2021 21:24:52 +0200
            4 Subject: [PATCH] Adds new function quit that calls cleanup() and exit(0) and
            5  assings q as hotkey to quit in config.def.h
            6 
            7 ---
            8  config.def.h | 2 ++
            9  surf.c       | 8 ++++++++
           10  2 files changed, 10 insertions(+)
           11 
           12 diff --git a/config.def.h b/config.def.h
           13 index 1355ba3..cf2fc68 100644
           14 --- a/config.def.h
           15 +++ b/config.def.h
           16 @@ -136,6 +136,8 @@ static Key keys[] = {
           17  
           18          { 0,                     GDK_KEY_Escape, stop,       { 0 } },
           19          { MODKEY,                GDK_KEY_c,      stop,       { 0 } },
           20 +        
           21 +        { 0,                         GDK_KEY_q,         quit,             { 0 } },
           22  
           23          { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r,      reload,     { .i = 1 } },
           24          { MODKEY,                GDK_KEY_r,      reload,     { .i = 0 } },
           25 diff --git a/surf.c b/surf.c
           26 index 03d8242..c0ba8ed 100644
           27 --- a/surf.c
           28 +++ b/surf.c
           29 @@ -228,6 +228,7 @@ static void scrollv(Client *c, const Arg *a);
           30  static void scrollh(Client *c, const Arg *a);
           31  static void navigate(Client *c, const Arg *a);
           32  static void stop(Client *c, const Arg *a);
           33 +static void quit(Client *c, const Arg *a);
           34  static void toggle(Client *c, const Arg *a);
           35  static void togglefullscreen(Client *c, const Arg *a);
           36  static void togglecookiepolicy(Client *c, const Arg *a);
           37 @@ -1901,6 +1902,13 @@ stop(Client *c, const Arg *a)
           38          webkit_web_view_stop_loading(c->view);
           39  }
           40  
           41 +void
           42 +quit(Client *c, const Arg *a)
           43 +{
           44 +        cleanup();
           45 +        exit(0);
           46 +}
           47 +
           48  void
           49  toggle(Client *c, const Arg *a)
           50  {
           51 -- 
           52 2.33.0
           53