Merge branch 'master' of github.com:LukeSmithxyz/dwm into master

This commit is contained in:
Luke Smith 2020-09-12 09:32:09 -04:00
commit cf59ac7432
No known key found for this signature in database
GPG key ID: 4C50B54A911F6252
3 changed files with 24 additions and 8 deletions

View file

@ -213,7 +213,7 @@ static Key keys[] = {
{ MODKEY, XK_F5, xrdb, {.v = NULL } },
{ MODKEY, XK_F6, spawn, SHCMD("torwrap") },
{ MODKEY, XK_F7, spawn, SHCMD("td-toggle") },
{ MODKEY, XK_F8, spawn, SHCMD("mailsync") },
{ MODKEY, XK_F8, spawn, SHCMD("mw sync") },
{ MODKEY, XK_F9, spawn, SHCMD("dmenumount") },
{ MODKEY, XK_F10, spawn, SHCMD("dmenuumount") },
{ MODKEY, XK_F11, spawn, SHCMD("mpv --no-cache --no-osc --no-input-default-bindings --input-conf=/dev/null --title=webcam $(ls /dev/video[0,2,4,6,8] | tail -n 1)") },
@ -239,6 +239,7 @@ static Key keys[] = {
{ 0, XF86XK_AudioRewind, spawn, SHCMD("mpc seek -10") },
{ 0, XF86XK_AudioForward, spawn, SHCMD("mpc seek +10") },
{ 0, XF86XK_AudioMedia, spawn, SHCMD("st -e ncmpcpp") },
{ 0, XF86XK_AudioMicMute, spawn, SHCMD("pactl set-source-mute @DEFAULT_SOURCE@ toggle") },
{ 0, XF86XK_PowerOff, spawn, SHCMD("sysact") },
{ 0, XF86XK_Calculator, spawn, SHCMD("st -e bc -l") },
{ 0, XF86XK_Sleep, spawn, SHCMD("sudo -A zzz") },
@ -278,6 +279,7 @@ static Key keys[] = {
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static Button buttons[] = {
/* click event mask button function argument */
#ifndef __OpenBSD__
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button1, sigdwmblocks, {.i = 1} },
{ ClkStatusText, 0, Button2, sigdwmblocks, {.i = 2} },
@ -285,6 +287,7 @@ static Button buttons[] = {
{ ClkStatusText, 0, Button4, sigdwmblocks, {.i = 4} },
{ ClkStatusText, 0, Button5, sigdwmblocks, {.i = 5} },
{ ClkStatusText, ShiftMask, Button1, sigdwmblocks, {.i = 6} },
#endif
{ ClkStatusText, ShiftMask, Button3, spawn, SHCMD("st -e nvim ~/.local/src/dwmblocks/config.h") },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button2, defaultgaps, {0} },

23
dwm.c
View file

@ -206,7 +206,6 @@ static void focusin(XEvent *e);
static void focusmon(const Arg *arg);
static void focusstack(const Arg *arg);
static Atom getatomprop(Client *c, Atom prop);
static int getdwmblockspid();
static int getrootptr(int *x, int *y);
static long getstate(Window w);
static int gettextprop(Window w, Atom atom, char *text, unsigned int size);
@ -246,7 +245,10 @@ static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
static void sigchld(int unused);
#ifndef __OpenBSD__
static int getdwmblockspid();
static void sigdwmblocks(const Arg *arg);
#endif
static void sighup(int unused);
static void sigterm(int unused);
static void spawn(const Arg *arg);
@ -1016,6 +1018,7 @@ getatomprop(Client *c, Atom prop)
return atom;
}
#ifndef __OpenBSD__
int
getdwmblockspid()
{
@ -1027,6 +1030,7 @@ getdwmblockspid()
dwmblockspid = pid;
return pid != 0 ? 0 : -1;
}
#endif
int
getrootptr(int *x, int *y)
@ -1908,6 +1912,7 @@ sigterm(int unused)
quit(&a);
}
#ifndef __OpenBSD__
void
sigdwmblocks(const Arg *arg)
{
@ -1924,6 +1929,7 @@ sigdwmblocks(const Arg *arg)
}
}
}
#endif
void
spawn(const Arg *arg)
@ -2406,18 +2412,25 @@ getparentprocess(pid_t p)
{
unsigned int v = 0;
#ifdef __linux__
#if defined(__linux__)
FILE *f;
char buf[256];
snprintf(buf, sizeof(buf) - 1, "/proc/%u/stat", (unsigned)p);
if (!(f = fopen(buf, "r")))
return 0;
return (pid_t)0;
fscanf(f, "%*u %*s %*c %u", &v);
if (fscanf(f, "%*u %*s %*c %u", (unsigned *)&v) != 1)
v = (pid_t)0;
fclose(f);
#endif /* __linux__ */
#elif defined(__FreeBSD__)
struct kinfo_proc *proc = kinfo_getproc(p);
if (!proc)
return (pid_t)0;
v = proc->ki_ppid;
free(proc);
#endif
return (pid_t)v;
}

View file

@ -343,13 +343,13 @@ centeredfloatingmaster(Monitor *m)
/* go mfact box in the center if more than nmaster clients */
if (m->ww > m->wh) {
mw = m->ww * m->mfact - iv*mivf*(MIN(n, m->nmaster) - 1);
mh = m->wh * 0.9;
mh = m->wh * 0.9 - 2*oh;
} else {
mw = m->ww * 0.9 - iv*mivf*(MIN(n, m->nmaster) - 1);
mh = m->wh * m->mfact;
}
mx = m->wx + (m->ww - mw) / 2;
my = m->wy + (m->wh - mh - 2*oh) / 2;
my = m->wy + (m->wh - mh) / 2;
sx = m->wx + ov;
sy = m->wy + oh;