Skip to content
This repository has been archived by the owner on Jun 16, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/master' into gruvbox
Browse files Browse the repository at this point in the history
  • Loading branch information
pangteypiyush committed May 7, 2024
2 parents 4111f10 + 061e9fe commit 7e67d4c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 34 deletions.
10 changes: 2 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@ include config.mk
SRC = drw.c dwm.c util.c
OBJ = ${SRC:.c=.o}

all: options dwm

options:
@echo dwm build options:
@echo "CFLAGS = ${CFLAGS}"
@echo "LDFLAGS = ${LDFLAGS}"
@echo "CC = ${CC}"
all: dwm

.c.o:
${CC} -c ${CFLAGS} $<
Expand Down Expand Up @@ -48,4 +42,4 @@ uninstall:
rm -f ${DESTDIR}${PREFIX}/bin/dwm\
${DESTDIR}${MANPREFIX}/man1/dwm.1

.PHONY: all options clean dist install uninstall
.PHONY: all clean dist install uninstall
3 changes: 2 additions & 1 deletion config.def.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ static const Layout layouts[] = {
#define GTKCMD(cmd) { .v = (const char*[]){ "/usr/bin/gtk-launch", cmd, NULL } }

/* 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 Arg tagexec[] = {
Expand Down
10 changes: 5 additions & 5 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ static const unsigned int snap = 32; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const char *fonts[] = { "SauceCodePro Nerd Font:size=11" };
static const char dmenufont[] = "SauceCodePro Nerd Font:size=11";
// static const char dmenufont[] = "SauceCodePro Nerd Font:size=11";

// gruvbox
static const char col_gb_bg[] = "#282828";
Expand Down Expand Up @@ -113,21 +113,21 @@ static const char *termcmd[] = { "gnome-terminal", NULL };

static const Arg tagexec[] = {
{ .v = termcmd },
GTKCMD("org.gnome.Nautilus.desktop"),
GTKCMD("visual-studio-code.desktop"),
GTKCMD("nemo.desktop"),
GTKCMD("code.desktop"),
SHCMD("lxterminal -t AlsaMixer -e /usr/bin/alsamixer"),
GTKCMD("discord"),
GTKCMD("cmus"),
{ .v = termcmd },
GTKCMD("personal-firefox"),
{ .v = termcmd },
GTKCMD("firefox")
};

static Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, SHCMD("rofi -show run") },
{ ALTMOD|ShiftMask, XK_x, spawn, {.v = termcmd } },
{ MODKEY, XK_e, spawn, SHCMD("nautilus") },
{ MODKEY, XK_e, spawn, SHCMD("nemo") },
{ 0, XF86XK_AudioLowerVolume, spawn, SHCMD("amixer set Master 5%-") },
{ 0, XF86XK_AudioRaiseVolume, spawn, SHCMD("amixer set Master 5%+") },
{ 0, XF86XK_AudioMute, spawn, SHCMD("amixer set Master toggle") },
Expand Down
4 changes: 2 additions & 2 deletions config.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# dwm version
VERSION = 6.4
VERSION = 6.5

# Customize below to fit your system

Expand All @@ -26,7 +26,7 @@ INCS = -I${X11INC} -I${FREETYPEINC}
LIBS = -L${X11LIB} -lX11 ${XINERAMALIBS} ${FREETYPELIBS}

# 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 = -std=c99 -pedantic -Wall -Wno-deprecated-declarations -Os ${INCS} ${CPPFLAGS}
LDFLAGS = ${LIBS}
Expand Down
52 changes: 34 additions & 18 deletions dwm.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ static void setup(void);
static void seturgent(Client *c, int urg);
static void shiftview(const Arg *arg);
static void showhide(Client *c);
static void sigchld(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void spawntag(const Arg *arg);
Expand Down Expand Up @@ -1001,16 +1000,26 @@ grabkeys(void)
{
updatenumlockmask();
{
unsigned int i, j;
unsigned int i, j, k;
unsigned int modifiers[] = { 0, LockMask, numlockmask, numlockmask|LockMask };
KeyCode code;
int start, end, skip;
KeySym *syms;

XUngrabKey(dpy, AnyKey, AnyModifier, root);
for (i = 0; i < LENGTH(keys); i++)
if ((code = XKeysymToKeycode(dpy, keys[i].keysym)))
for (j = 0; j < LENGTH(modifiers); j++)
XGrabKey(dpy, code, keys[i].mod | modifiers[j], root,
True, GrabModeAsync, GrabModeAsync);
XDisplayKeycodes(dpy, &start, &end);
syms = XGetKeyboardMapping(dpy, start, end - start + 1, &skip);
if (!syms)
return;
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);
}
}

Expand Down Expand Up @@ -1603,9 +1612,16 @@ setup(void)
int i;
XSetWindowAttributes wa;
Atom utf8string;
struct sigaction sa;

/* do not transform children into zombies when they terminate */
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 immediately */
sigchld(0);
/* clean up any zombies (inherited from .xinitrc etc) immediately */
while (waitpid(-1, NULL, WNOHANG) > 0);

/* init screen */
screen = DefaultScreen(dpy);
Expand Down Expand Up @@ -1712,21 +1728,21 @@ 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
spawn(const Arg *arg)
{
struct sigaction sa;

if (fork() == 0) {
if (dpy)
close(ConnectionNumber(dpy));
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);
die("dwm: execvp '%s' failed:", ((char **)arg->v)[0]);
}
Expand Down

0 comments on commit 7e67d4c

Please sign in to comment.