Compare commits
8 Commits
Author | SHA1 | Date |
---|---|---|
|
5687f46964 | |
|
061e9fe9a7 | |
|
9f8855343c | |
|
e81f17d4c1 | |
|
348f6559ab | |
|
712d6639ff | |
|
89f9905714 | |
|
ba56fe9fea |
10
Makefile
10
Makefile
|
@ -6,13 +6,7 @@ include config.mk
|
||||||
SRC = drw.c dwm.c util.c
|
SRC = drw.c dwm.c util.c
|
||||||
OBJ = ${SRC:.c=.o}
|
OBJ = ${SRC:.c=.o}
|
||||||
|
|
||||||
all: options dwm
|
all: dwm
|
||||||
|
|
||||||
options:
|
|
||||||
@echo dwm build options:
|
|
||||||
@echo "CFLAGS = ${CFLAGS}"
|
|
||||||
@echo "LDFLAGS = ${LDFLAGS}"
|
|
||||||
@echo "CC = ${CC}"
|
|
||||||
|
|
||||||
.c.o:
|
.c.o:
|
||||||
${CC} -c ${CFLAGS} $<
|
${CC} -c ${CFLAGS} $<
|
||||||
|
@ -48,4 +42,4 @@ uninstall:
|
||||||
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
|
||||||
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
${DESTDIR}${MANPREFIX}/man1/dwm.1
|
||||||
|
|
||||||
.PHONY: all options clean dist install uninstall
|
.PHONY: all clean dist install uninstall
|
||||||
|
|
|
@ -56,7 +56,8 @@ static const Layout layouts[] = {
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static const char *dmenucmd[] = { "dmenu_run", "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
|
||||||
|
static const char *dmenucmd[] = { "dmenu_run", "-m", dmenumon, "-fn", dmenufont, "-nb", col_gray1, "-nf", col_gray3, "-sb", col_cyan, "-sf", col_gray4, NULL };
|
||||||
static const char *termcmd[] = { "st", NULL };
|
static const char *termcmd[] = { "st", NULL };
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# dwm version
|
# dwm version
|
||||||
VERSION = 6.4
|
VERSION = 6.5
|
||||||
|
|
||||||
# Customize below to fit your system
|
# Customize below to fit your system
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ INCS = -I${X11INC} -I${FREETYPEINC}
|
||||||
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_POSIX_C_SOURCE=200809L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700L -DVERSION=\"${VERSION}\" ${XINERAMAFLAGS}
|
||||||
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
#CFLAGS = -g -std=c99 -pedantic -Wall -O0 ${INCS} ${CPPFLAGS}
|
||||||
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
CFLAGS = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
|
||||||
LDFLAGS = ${LIBS}
|
LDFLAGS = ${LIBS}
|
||||||
|
|
56
dwm.c
56
dwm.c
|
@ -205,7 +205,6 @@ static void setmfact(const Arg *arg);
|
||||||
static void setup(void);
|
static void setup(void);
|
||||||
static void seturgent(Client *c, int urg);
|
static void seturgent(Client *c, int urg);
|
||||||
static void showhide(Client *c);
|
static void showhide(Client *c);
|
||||||
static void sigchld(int unused);
|
|
||||||
static void spawn(const Arg *arg);
|
static void spawn(const Arg *arg);
|
||||||
static void tag(const Arg *arg);
|
static void tag(const Arg *arg);
|
||||||
static void tagmon(const Arg *arg);
|
static void tagmon(const Arg *arg);
|
||||||
|
@ -955,16 +954,26 @@ grabkeys(void)
|
||||||
{
|
{
|
||||||
updatenumlockmask();
|
updatenumlockmask();
|
||||||
{
|
{
|
||||||
unsigned int i, j;
|
unsigned int i, j, k;
|
||||||
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
|
||||||
KeyCode code;
|
int start, end, skip;
|
||||||
|
KeySym *syms;
|
||||||
|
|
||||||
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
XUngrabKey(dpy, AnyKey, AnyModifier, root);
|
||||||
for (i = 0; i < LENGTH(keys); i++)
|
XDisplayKeycodes(dpy, &start, &end);
|
||||||
if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
|
syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip);
|
||||||
for (j = 0; j < LENGTH(modifiers); j++)
|
if (!syms)
|
||||||
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
|
return;
|
||||||
True, GrabModeAsync, GrabModeAsync);
|
for (k = start; k <= end; k++)
|
||||||
|
for (i = 0; i < LENGTH(keys); i++)
|
||||||
|
/* skip modifier codes, we do that ourselves */
|
||||||
|
if (keys[i].keysym == syms[(k - start) * skip])
|
||||||
|
for (j = 0; j < LENGTH(modifiers); j++)
|
||||||
|
XGrabKey(dpy, k,
|
||||||
|
keys[i].mod | modifiers[j],
|
||||||
|
root, True,
|
||||||
|
GrabModeAsync, GrabModeAsync);
|
||||||
|
XFree(syms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1533,9 +1542,16 @@ setup(void)
|
||||||
int i;
|
int i;
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
Atom utf8string;
|
Atom utf8string;
|
||||||
|
struct sigaction sa;
|
||||||
|
|
||||||
/* clean up any zombies immediately */
|
/* do not transform children into zombies when they terminate */
|
||||||
sigchld(0);
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sa.sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT | SA_RESTART;
|
||||||
|
sa.sa_handler = SIG_IGN;
|
||||||
|
sigaction(SIGCHLD, &sa, NULL);
|
||||||
|
|
||||||
|
/* clean up any zombies (inherited from .xinitrc etc) immediately */
|
||||||
|
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||||
|
|
||||||
/* init screen */
|
/* init screen */
|
||||||
screen = DefaultScreen(dpy);
|
screen = DefaultScreen(dpy);
|
||||||
|
@ -1628,21 +1644,23 @@ showhide(Client *c)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
sigchld(int unused)
|
|
||||||
{
|
|
||||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
|
||||||
die("can't install SIGCHLD handler:");
|
|
||||||
while (0 < waitpid(-1, NULL, WNOHANG));
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
spawn(const Arg *arg)
|
spawn(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
struct sigaction sa;
|
||||||
|
|
||||||
|
if (arg->v == dmenucmd)
|
||||||
|
dmenumon[0] = '0' + selmon->num;
|
||||||
if (fork() == 0) {
|
if (fork() == 0) {
|
||||||
if (dpy)
|
if (dpy)
|
||||||
close(ConnectionNumber(dpy));
|
close(ConnectionNumber(dpy));
|
||||||
setsid();
|
setsid();
|
||||||
|
|
||||||
|
sigemptyset(&sa.sa_mask);
|
||||||
|
sa.sa_flags = 0;
|
||||||
|
sa.sa_handler = SIG_DFL;
|
||||||
|
sigaction(SIGCHLD, &sa, NULL);
|
||||||
|
|
||||||
execvp(((char **)arg->v)[0], (char **)arg->v);
|
execvp(((char **)arg->v)[0], (char **)arg->v);
|
||||||
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
|
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
|
||||||
}
|
}
|
||||||
|
@ -1833,7 +1851,7 @@ updatebarpos(Monitor *m)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updateclientlist()
|
updateclientlist(void)
|
||||||
{
|
{
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
|
|
Loading…
Reference in New Issue