summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Smith <luke@lukesmith.xyz>2020-09-12 09:32:09 -0400
committerLuke Smith <luke@lukesmith.xyz>2020-09-12 09:32:09 -0400
commitcf59ac74328dd8140cc5ab88c6234d2437f4d341 (patch)
treee194662506b445c3e2824df29d254a9997b41f54
parent35e3d2a73c1fd0bc5a2439268fb3ca184d82e95a (diff)
parent59848a9fdb32bda602bab0d7aea22ff203515ad4 (diff)
Merge branch 'master' of github.com:LukeSmithxyz/dwm into master
-rw-r--r--config.h5
-rw-r--r--dwm.c23
-rw-r--r--vanitygaps.c4
3 files changed, 24 insertions, 8 deletions
diff --git a/config.h b/config.h
index 6b28fbb..86936b2 100644
--- a/config.h
+++ b/config.h
@@ -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} },
diff --git a/dwm.c b/dwm.c
index 47e099c..2e43282 100644
--- a/dwm.c
+++ b/dwm.c
@@ -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;
}
diff --git a/vanitygaps.c b/vanitygaps.c
index 2b438be..7245e74 100644
--- a/vanitygaps.c
+++ b/vanitygaps.c
@@ -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;