add uicb_exec

This commit is contained in:
Julien Danjou 2007-09-28 13:39:46 +02:00
parent 659adaab5e
commit a6943aa3f3
3 changed files with 17 additions and 0 deletions

View File

@ -84,6 +84,7 @@ static const NameFuncLink LayoutsList[] =
static const NameFuncLink KeyfuncList[] = {
/* util.c */
{"spawn", uicb_spawn},
{"exec", uicb_exec},
/* client.c */
{"killclient", uicb_killclient},
{"moveresize", uicb_moveresize},

15
util.c
View File

@ -24,6 +24,7 @@
#include <stdio.h>
#include <sys/wait.h>
#include <unistd.h>
#include <bits/posix1_lim.h>
#include <X11/Xutil.h>
#include <X11/Xatom.h>
@ -53,6 +54,20 @@ eprint(const char *fmt, ...)
exit(EXIT_FAILURE);
}
void
uicb_exec(Display * disp,
DC *drawcontext __attribute__ ((unused)),
awesome_config * awesomeconf __attribute__ ((unused)),
const char *arg)
{
char path[_POSIX_PATH_MAX];
if(disp)
close(ConnectionNumber(disp));
sscanf(arg, "%s", path);
execlp(path, arg, NULL);
}
void
uicb_spawn(Display * disp,
DC *drawcontext __attribute__ ((unused)),

1
util.h
View File

@ -197,4 +197,5 @@ Bool xgettextprop(Display *, Window, Atom, char *, ssize_t);
double compute_new_value_from_arg(const char *, double);
UICB_PROTO(uicb_spawn);
UICB_PROTO(uicb_exec);
#endif