URI: 
       tExit ltkd when no clients are left - ltk - Socket-based GUI for X11 (WIP)
  HTML git clone git://lumidify.org/ltk.git (fast, but not encrypted)
  HTML git clone https://lumidify.org/git/ltk.git (encrypted, but very slow)
   DIR Log
   DIR Files
   DIR Refs
   DIR README
   DIR LICENSE
       ---
   DIR commit 5d21899cd0709d59584964aed6e94c536f08c911
   DIR parent df7e4a4517d0078deebaac2348838d8e4658d11f
  HTML Author: lumidify <nobody@lumidify.org>
       Date:   Sun, 21 Feb 2021 17:23:21 +0100
       
       Exit ltkd when no clients are left
       
       Diffstat:
         M README.md                           |       3 +++
         M TODO                                |       2 ++
         M ltk.h                               |       1 +
         M ltkd.c                              |      11 +++++++++++
         M testbox.sh                          |       3 +++
       
       5 files changed, 20 insertions(+), 0 deletions(-)
       ---
   DIR diff --git a/README.md b/README.md
       t@@ -15,3 +15,6 @@ make
        
        If you click the top button, it should exit. That's all it does now.
        Also read the comment in './test.sh'.
       +
       +New:
       +./testbox.sh shows my gopherhole, but most buttons don't actually do anything.
   DIR diff --git a/TODO b/TODO
       t@@ -1,3 +1,5 @@
       +Error levels: allow to only print errors and ignore regular events
       +
        Possibly implement xrandr support for proper dpi handling
        
        Double-buffering; general improvements to rendering...
   DIR diff --git a/ltk.h b/ltk.h
       t@@ -170,5 +170,6 @@ int ltk_widget_id_free(const char *id);
        ltk_widget *ltk_get_widget(const char *id, ltk_widget_type type, char **errstr);
        void ltk_set_widget(ltk_widget *widget, const char *id);
        void ltk_remove_widget(const char *id);
       +void ltk_quit(ltk_window *window);
        
        #endif
   DIR diff --git a/ltkd.c b/ltkd.c
       t@@ -1,3 +1,4 @@
       +/* FIXME: backslashes should be parsed properly! */
        /* FIXME Figure out how to properly print window id */
        /* FIXME: PROPERLY CLEANUP ALL THEMES */
        /* FIXME: error checking in tokenizer (is this necessary?) */
       t@@ -231,6 +232,16 @@ ltk_mainloop(ltk_window *window) {
                                                        FD_CLR(clifd, &wallfds);
                                                        sockets[i].fd = -1;
                                                        close(clifd);
       +                                                int newmaxsocket = -1;
       +                                                for (int j = 0; j <= maxsocket; j++) {
       +                                                        if (sockets[j].fd >= 0)
       +                                                                newmaxsocket = j;
       +                                                }
       +                                                maxsocket = newmaxsocket;
       +                                                if (maxsocket == -1) {
       +                                                        ltk_quit(window);
       +                                                        break;
       +                                                }
                                                } else {
                                                        process_commands(window, &sockets[i]);
                                                }
   DIR diff --git a/testbox.sh b/testbox.sh
       t@@ -18,6 +18,9 @@ do
                "exit_btn button_click")
                        echo "quit"
                        ;;
       +        "btn0 button_click")
       +                echo "button bla create \"safhaskfldshk\"\nbox box1 add bla w"
       +                ;;
                *)
                        printf "%s\n" "$cmd" >&2
                        ;;