Move colors to global vars so that they cab be set later for a file.
Add char ** to args and pass xterm through it
int running = 1;
int ignore_enter = 0;
unsigned int numlockmask = 0;
int running = 1;
int ignore_enter = 0;
unsigned int numlockmask = 0;
+unsigned long col_focus = 0xff0000;
+unsigned long col_unfocus = 0x888888;
Display *display;
Window root;
Display *display;
Window root;
#define SWM_ARG_ID_FOCUSNEXT (0)
#define SWM_ARG_ID_FOCUSPREV (1)
#define SWM_ARG_ID_FOCUSMAIN (2)
#define SWM_ARG_ID_FOCUSNEXT (0)
#define SWM_ARG_ID_FOCUSPREV (1)
#define SWM_ARG_ID_FOCUSMAIN (2)
void
spawn(union arg *args)
{
void
spawn(union arg *args)
{
- char *argv[] = { "xterm", NULL }; /* XXX make this in args */
-
/*
* The double-fork construct avoids zombie processes and keeps the code
* clean from stupid signal handlers.
/*
* The double-fork construct avoids zombie processes and keeps the code
* clean from stupid signal handlers.
if(display)
close(ConnectionNumber(display));
setsid();
if(display)
close(ConnectionNumber(display));
setsid();
+ execvp(args->argv[0], args->argv);
fprintf(stderr, "execvp failed\n");
perror(" failed");
}
fprintf(stderr, "execvp failed\n");
perror(" failed");
}
void
focus_win(struct ws_win *win)
{
void
focus_win(struct ws_win *win)
{
- XSetWindowBorder(display, win->id, 0xff0000);
+ XSetWindowBorder(display, win->id, col_focus);
XSetInputFocus(display, win->id, RevertToPointerRoot, CurrentTime);
ws[current_ws].focus = win;
}
XSetInputFocus(display, win->id, RevertToPointerRoot, CurrentTime);
ws[current_ws].focus = win;
}
void
unfocus_win(struct ws_win *win)
{
void
unfocus_win(struct ws_win *win)
{
- XSetWindowBorder(display, win->id, 0x888888);
+ XSetWindowBorder(display, win->id, col_unfocus);
if (ws[current_ws].focus == win)
ws[current_ws].focus = NULL;
}
if (ws[current_ws].focus == win)
ws[current_ws].focus = NULL;
}
+ focus_win(winfocus); /* this has to be done outside of the loop */
+/* terminal + args */
+char *term[] = { "xterm", NULL };
+
/* key definitions */
struct key {
unsigned int mod;
/* key definitions */
struct key {
unsigned int mod;
} keys[] = {
/* modifier key function argument */
{ MODKEY, XK_Return, swap_to_main, {0} },
} keys[] = {
/* modifier key function argument */
{ MODKEY, XK_Return, swap_to_main, {0} },
- { MODKEY | ShiftMask, XK_Return, spawn, {0} },
+ { MODKEY | ShiftMask, XK_Return, spawn, {.argv = term } },
{ MODKEY | ShiftMask, XK_q, quit, {0} },
{ MODKEY, XK_m, focus, {.id = SWM_ARG_ID_FOCUSMAIN} },
{ MODKEY, XK_1, switchws, {.id = 0} },
{ MODKEY | ShiftMask, XK_q, quit, {0} },
{ MODKEY, XK_m, focus, {.id = SWM_ARG_ID_FOCUSMAIN} },
{ MODKEY, XK_1, switchws, {.id = 0} },