tAdd keybind to show the desktop - spkp - Stacking wayland compositor
 (HTM) git clone git://git.z3bra.org/spkp.git
 (DIR) Log
 (DIR) Files
 (DIR) Refs
       ---
 (DIR) commit 628ab33aeafa8ccd566717c78759c9cd1c3ce493
 (DIR) parent 7206ecf40360ea2b96aad0104135c744bfd47ffc
 (HTM) Author: Willy Goiffon <dev@z3bra.org>
       Date:   Fri, 13 Nov 2020 17:44:35 +0100
       
       Add keybind to show the desktop
       
       Diffstat:
         M compositor.c                        |      18 ++++++++++++++++++
         M config.def.h                        |       1 +
       
       2 files changed, 19 insertions(+), 0 deletions(-)
       ---
 (DIR) diff --git a/compositor.c b/compositor.c
       t@@ -55,6 +55,8 @@ struct state {
        
                struct wlr_seat *seat;
        
       +        int desktop; /* wether desktop is visible */
       +
                int grabmode;
                double gx, gy;
                struct wlr_box grabbox;
       t@@ -201,6 +203,7 @@ static struct window *underneath(struct state *, double, double);
        static void kb_terminate(struct state *, union keyarg *);
        static void kb_alttab(struct state *, union keyarg *);
        static void kb_exec(struct state *, union keyarg *);
       +static void kb_desktop(struct state *, union keyarg *);
        
        #include "config.h"
        
       t@@ -1089,6 +1092,21 @@ kb_exec(struct state *server, union keyarg *arg)
                }
        }
        
       +/*
       + * Hide/show all windows on the desktop
       + */
       +void
       +kb_desktop(struct state *server, union keyarg *arg)
       +{
       +        (void)arg;
       +        struct window *w;
       +
       +        server->desktop = !server->desktop;
       +        wl_list_for_each(w, &server->windows, link)
       +                w->mapped = !server->desktop;
       +
       +}
       +
        int
        main(int argc, char *argv[])
        {
 (DIR) diff --git a/config.def.h b/config.def.h
       t@@ -15,4 +15,5 @@ struct key keys[] = {
                { ALT      , XKB_KEY_Tab   , kb_alttab   , {.i = 0} },
                { ALT|SHFT , XKB_KEY_Tab   , kb_alttab   , {.i = 1} },
                { LOGO     , XKB_KEY_Return, kb_exec     , {.v = "alacritty"} },
       +        { LOGO     , XKB_KEY_d     , kb_desktop  , {0     } },
        };