kbgwm

sucklessy floating window manager
git clone https://git.neuralcrash.com/kbgwm.git
Log | Files | Refs | README | LICENSE

commit 9202c0151600cf238b17df993f099e071bebf771
parent 1c57f029f463b6e53abb245a24dd8c02edf6722e
Author: Kebigon <git@kebigon.xyz>
Date:   Mon, 20 Jul 2020 18:26:14 +0900

Add shortcut to quit the window manager
Diffstat:
Mconfig.h | 1+
Mkbgwm.c | 19+++++++++++++++++--
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/config.h b/config.h @@ -27,6 +27,7 @@ static Key keys[] = { MODKEY, XK_Page_Down, workspace_next, { 0 } }, { MODKEY | SHIFT, XK_Tab, focus_next, { .b = true } }, { MODKEY, XK_Tab, focus_next, { .b = false } }, + { MODKEY | SHIFT, XK_q, quit, { 0 } }, WORKSPACEKEYS(XK_Home, 0) WORKSPACEKEYS(XK_1, 0) WORKSPACEKEYS(XK_2, 1) diff --git a/kbgwm.c b/kbgwm.c @@ -36,6 +36,7 @@ static void handle_map_request(xcb_map_request_event_t*); static void handle_mapping_notify(xcb_mapping_notify_event_t*); static void handle_motion_notify(xcb_motion_notify_event_t*); static void handle_unmap_notify(xcb_unmap_notify_event_t*); +static void quit(const Arg*); static void workspace_change(const Arg*); static void workspace_next(const Arg*); static void workspace_previous(const Arg*); @@ -50,7 +51,7 @@ static inline void debug_print_globals(); #define BORDER_WIDTH_X2 (BORDER_WIDTH << 1) -bool quit = false; +bool running = true; bool moving = false; bool resizing = false; xcb_connection_t* c; @@ -127,7 +128,7 @@ void mouseresize(__attribute__((unused))const Arg* arg) void eventLoop() { - while (!quit) + while (running) { xcb_generic_event_t* event = xcb_wait_for_event(c); @@ -546,6 +547,11 @@ void handle_unmap_notify(xcb_unmap_notify_event_t* event) printf("XCB_UNMAP_NOTIFY: window=%d\n", event->window); } +void quit(__attribute__((unused))const Arg* arg) +{ + running = false; +} + /* * Setup */ @@ -753,6 +759,15 @@ int main(void) // Event loop eventLoop(); + for (uint_fast8_t i = 0; i != NB_WORKSPACES; i++) + { + while (workspaces[i] != NULL) + { + client* client = client_remove_workspace(i); + free(client); + } + } + xcb_disconnect(c); return (0);