X-Git-Url: https://git.xinqibao.xyz/dwm.git/blobdiff_plain/272e15c4b7bdeeb258caadb7c62e70c49c12b16d..7696c89c90c926f6371b1ee3ec1b13dd2414aa40:/cmd.c diff --git a/cmd.c b/cmd.c index 8244540..c14c3e6 100644 --- a/cmd.c +++ b/cmd.c @@ -5,16 +5,46 @@ #include "wm.h" #include +#include void -run(char *arg) +run(void *aux) { - spawn(dpy, arg); + spawn(dpy, aux); } void -quit(char *arg) +quit(void *aux) { - fputs("quit\n", stderr); running = False; } + +void +sel(void *aux) +{ + const char *arg = aux; + Client *c; + + if(!arg || !stack) + return; + if(!strncmp(arg, "next", 5)) + focus(stack->snext ? stack->snext : stack); + else if(!strncmp(arg, "prev", 5)) { + for(c = stack; c && c->snext; c = c->snext); + focus(c ? c : stack); + } +} + +void +kill(void *aux) +{ + Client *c = stack; + + if(!c) + return; + if(c->proto & WM_PROTOCOL_DELWIN) + send_message(c->win, wm_atom[WMProtocols], wm_atom[WMDelete]); + else + XKillClient(dpy, c->win); +} +