JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
simplified several portions of code through replacing rect structs with x,y,h,w count...
[dwm.git] / cmd.c
diff --git a/cmd.c b/cmd.c
index 8244540..baa3ae9 100644 (file)
--- a/cmd.c
+++ b/cmd.c
@@ -5,16 +5,48 @@
 
 #include "wm.h"
 #include <stdio.h>
+#include <string.h>
 
 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 = NULL;
+
+       if(!arg || !stack)
+               return;
+       if(!strncmp(arg, "next", 5))
+               c = stack->snext ? stack->snext : stack;
+       else if(!strncmp(arg, "prev", 5))
+               for(c = stack; c && c->snext; c = c->snext);
+       if(!c)
+               c = stack;
+       raise(c);
+       focus(c);
+}
+
+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);
+}
+