Skip to content

Instantly share code, notes, and snippets.

@pedrominicz
Last active September 27, 2023 14:18
Show Gist options
  • Save pedrominicz/3ec315832f5ea305e7e6fc7b7d5b5515 to your computer and use it in GitHub Desktop.
Save pedrominicz/3ec315832f5ea305e7e6fc7b7d5b5515 to your computer and use it in GitHub Desktop.
dwm config
/* See LICENSE file for copyright and license details. */
/* appearance */
static const unsigned int borderpx = 2; /* border pixel of windows */
static const unsigned int snap = 16; /* snap pixel */
static const int showbar = 1; /* 0 means no bar */
static const int topbar = 1; /* 0 means bottom bar */
static const float floatingopacity = 0.2;
static const char *fonts[] = { "Source Code Pro:style=Bold:pixelsize=16:antialias=true:autohint=true" };
static const char dmenufont[] = "Source Code Pro:style=Bold:pixelsize=16:antialias=true:autohint=true";
static const char col_black[] = "#000000";
static const char col_white[] = "#a8a8a8";
static const char *colors[][3] = {
/* fg bg border */
[SchemeNorm] = { col_white, col_black, col_black },
[SchemeSel] = { col_black, col_white, col_white },
};
/* layout(s) */
static const float mfact = 0.5; /* factor of master area size [0.05..0.95] */
static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 1; /* 1 means respect size hints in tiled resizals */
static const int lockfullscreen = 0; /* 1 will force focus on the fullscreen window */
static const Layout layouts[] = {
/* symbol arrange function */
{ "[M]", monocle }, /* first entry is default */
{ "[]=", tile },
{ "><>", NULL }, /* no layout function means floating behavior */
};
/* tagging */
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
static const Rule rules[] = {
/* xprop(1):
* WM_CLASS(STRING) = instance, class
* WM_NAME(STRING) = title
*/
/* class instance title tags mask isfloating resizehints monitor */
{ "code-oss", NULL, NULL, 1 << 0, 0, resizehints, -1 },
{ "firefox", NULL, NULL, 1 << 1, 0, resizehints, -1 },
{ "Chromium", NULL, NULL, 1 << 1, 0, resizehints, -1 },
{ "Anki", NULL, NULL, 1 << 2, 0, resizehints, -1 },
{ "krita", NULL, NULL, 1 << 2, 0, resizehints, -1 },
{ "obs", NULL, NULL, 1 << 3, 0, resizehints, -1 },
{ "st-256color", NULL, NULL, 0, 0, 0, -1 },
{ "mpv", NULL, NULL, 0, 0, 0, -1 },
};
/* key definitions */
#define MODKEY Mod1Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \
{ MODKEY|ShiftMask, KEY, tag, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask|ShiftMask, KEY, toggletag, {.ui = 1 << TAG} },
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
static char dmenumon[2] = "0"; /* component of dmenucmd, manipulated in spawn() */
static const char *dmenucmd[] = { "dmenu_run", "-i", "-m", dmenumon, "-fn", dmenufont, "-nb", col_black, "-nf", col_white, "-sb", col_white, "-sf", col_black, NULL };
static const char *termcmd[] = { "st", NULL };
static const Key keys[] = {
/* modifier key function argument */
{ MODKEY, XK_p, spawn, {.v = dmenucmd } },
{ MODKEY|ShiftMask, XK_Return, spawn, {.v = termcmd } },
{ MODKEY, XK_b, togglebar, {0} },
{ MODKEY, XK_j, focusstack, {.i = +1 } },
{ MODKEY, XK_k, focusstack, {.i = -1 } },
{ MODKEY, XK_i, incnmaster, {.i = +1 } },
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
{ MODKEY, XK_h, setmfact, {.f = +0.05} },
{ MODKEY, XK_l, setmfact, {.f = -0.05} },
{ MODKEY, XK_Return, zoom, {0} },
{ MODKEY, XK_Tab, view, {0} },
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
{ MODKEY, XK_m, setlayout, {.v = &layouts[0]} },
{ MODKEY, XK_t, setlayout, {.v = &layouts[1]} },
{ MODKEY, XK_f, setlayout, {.v = &layouts[2]} },
{ MODKEY, XK_space, setlayout, {0} },
{ MODKEY|ShiftMask, XK_space, togglefloating, {0} },
{ MODKEY|ShiftMask, XK_f, togglefullscreen, {0} },
{ MODKEY, XK_0, view, {.ui = ~0 } },
{ MODKEY|ShiftMask, XK_0, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
TAGKEYS( XK_1, 0)
TAGKEYS( XK_2, 1)
TAGKEYS( XK_3, 2)
TAGKEYS( XK_4, 3)
TAGKEYS( XK_5, 4)
TAGKEYS( XK_6, 5)
TAGKEYS( XK_7, 6)
TAGKEYS( XK_8, 7)
TAGKEYS( XK_9, 8)
{ MODKEY|ShiftMask, XK_q, quit, {0} },
{ MODKEY|ShiftMask, XK_r, restart, {0} },
{ 0, XK_F15, view, {.ui = 1 << 1} },
};
/* button definitions */
/* click can be ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle, ClkClientWin, or ClkRootWin */
static const Button buttons[] = {
/* click event mask button function argument */
{ ClkLtSymbol, 0, Button1, setlayout, {0} },
{ ClkLtSymbol, 0, Button3, setlayout, {.v = &layouts[2]} },
{ ClkWinTitle, 0, Button2, zoom, {0} },
{ ClkStatusText, 0, Button2, spawn, {.v = termcmd } },
{ ClkClientWin, MODKEY, Button1, movemouse, {0} },
{ ClkClientWin, MODKEY, Button3, resizemouse, {0} },
{ ClkTagBar, 0, Button1, view, {0} },
{ ClkTagBar, 0, Button3, toggleview, {0} },
{ ClkTagBar, MODKEY, Button1, tag, {0} },
{ ClkTagBar, MODKEY, Button3, toggletag, {0} },
};
diff --git a/dwm.c b/dwm.c
index f1d86b2..cccf420 100644
--- a/dwm.c
+++ b/dwm.c
@@ -62,7 +62,7 @@ enum { CurNormal, CurResize, CurMove, CurLast }; /* cursor */
enum { SchemeNorm, SchemeSel }; /* color schemes */
enum { NetSupported, NetWMName, NetWMState, NetWMCheck,
NetWMFullscreen, NetActiveWindow, NetWMWindowType,
- NetWMWindowTypeDialog, NetClientList, NetLast }; /* EWMH atoms */
+ NetWMWindowTypeDialog, NetClientList, NetWMWindowOpacity, NetLast }; /* EWMH atoms */
enum { WMProtocols, WMDelete, WMState, WMTakeFocus, WMLast }; /* default atoms */
enum { ClkTagBar, ClkLtSymbol, ClkStatusText, ClkWinTitle,
ClkClientWin, ClkRootWin, ClkLast }; /* clicks */
@@ -92,7 +92,7 @@ struct Client {
int basew, baseh, incw, inch, maxw, maxh, minw, minh, hintsvalid;
int bw, oldbw;
unsigned int tags;
- int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen;
+ int isfixed, isfloating, isurgent, neverfocus, oldstate, isfullscreen, resizehints;
Client *next;
Client *snext;
Monitor *mon;
@@ -138,12 +138,13 @@ typedef struct {
const char *title;
unsigned int tags;
int isfloating;
+ int resizehints;
int monitor;
} Rule;
/* function declarations */
static void applyrules(Client *c);
-static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact);
+static int applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact);
static void arrange(Monitor *m);
static void arrangemon(Monitor *m);
static void attach(Client *c);
@@ -189,10 +190,11 @@ static void pop(Client *c);
static void propertynotify(XEvent *e);
static void quit(const Arg *arg);
static Monitor *recttomon(int x, int y, int w, int h);
-static void resize(Client *c, int x, int y, int w, int h, int interact);
-static void resizeclient(Client *c, int x, int y, int w, int h);
+static void resize(Client *c, int x, int y, int w, int h, int bw, int interact);
+static void resizeclient(Client *c, int x, int y, int w, int h, int bw);
static void resizemouse(const Arg *arg);
static void restack(Monitor *m);
+static void restart(const Arg *arg);
static void run(void);
static void scan(void);
static int sendevent(Client *c, Atom proto);
@@ -202,15 +204,18 @@ static void setfocus(Client *c);
static void setfullscreen(Client *c, int fullscreen);
static void setlayout(const Arg *arg);
static void setmfact(const Arg *arg);
+static void setopacity(Client *c, int opaque);
static void setup(void);
static void seturgent(Client *c, int urg);
static void showhide(Client *c);
+static void sigterm(int unused);
static void spawn(const Arg *arg);
static void tag(const Arg *arg);
static void tagmon(const Arg *arg);
static void tile(Monitor *m);
static void togglebar(const Arg *arg);
static void togglefloating(const Arg *arg);
+static void togglefullscreen(const Arg *arg);
static void toggletag(const Arg *arg);
static void toggleview(const Arg *arg);
static void unfocus(Client *c, int setfocus);
@@ -260,6 +265,7 @@ static void (*handler[LASTEvent]) (XEvent *) = {
[UnmapNotify] = unmapnotify
};
static Atom wmatom[WMLast], netatom[NetLast];
+static int restarting = 0;
static int running = 1;
static Cur *cursor[CurLast];
static Clr **scheme;
@@ -287,6 +293,7 @@ applyrules(Client *c)
/* rule matching */
c->isfloating = 0;
c->tags = 0;
+ c->resizehints = resizehints;
XGetClassHint(dpy, c->win, &ch);
class = ch.res_class ? ch.res_class : broken;
instance = ch.res_name ? ch.res_name : broken;
@@ -299,6 +306,7 @@ applyrules(Client *c)
{
c->isfloating = r->isfloating;
c->tags |= r->tags;
+ c->resizehints = r->resizehints;
for (m = mons; m && m->num != r->monitor; m = m->next);
if (m)
c->mon = m;
@@ -312,7 +320,7 @@ applyrules(Client *c)
}
int
-applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
+applysizehints(Client *c, int *x, int *y, int *w, int *h, int *bw, int interact)
{
int baseismin;
Monitor *m = c->mon;
@@ -325,25 +333,25 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
*x = sw - WIDTH(c);
if (*y > sh)
*y = sh - HEIGHT(c);
- if (*x + *w + 2 * c->bw < 0)
+ if (*x + *w + 2 * *bw < 0)
*x = 0;
- if (*y + *h + 2 * c->bw < 0)
+ if (*y + *h + 2 * *bw < 0)
*y = 0;
} else {
if (*x >= m->wx + m->ww)
*x = m->wx + m->ww - WIDTH(c);
if (*y >= m->wy + m->wh)
*y = m->wy + m->wh - HEIGHT(c);
- if (*x + *w + 2 * c->bw <= m->wx)
+ if (*x + *w + 2 * *bw <= m->wx)
*x = m->wx;
- if (*y + *h + 2 * c->bw <= m->wy)
+ if (*y + *h + 2 * *bw <= m->wy)
*y = m->wy;
}
if (*h < bh)
*h = bh;
if (*w < bh)
*w = bh;
- if (resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
+ if (c->resizehints || c->isfloating || !c->mon->lt[c->mon->sellt]->arrange) {
if (!c->hintsvalid)
updatesizehints(c);
/* see last two sentences in ICCCM 4.1.2.3 */
@@ -376,7 +384,7 @@ applysizehints(Client *c, int *x, int *y, int *w, int *h, int interact)
if (c->maxh)
*h = MIN(*h, c->maxh);
}
- return *x != c->x || *y != c->y || *w != c->w || *h != c->h;
+ return *x != c->x || *y != c->y || *w != c->w || *h != c->h || *bw != c->bw;
}
void
@@ -396,9 +404,20 @@ arrange(Monitor *m)
void
arrangemon(Monitor *m)
{
+ Client *c;
+
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, sizeof m->ltsymbol);
if (m->lt[m->sellt]->arrange)
m->lt[m->sellt]->arrange(m);
+ else
+ /* ><> case; rather than providing an arrange function and upsetting other logic that tests for its presence, simply add borders here */
+ for (c = selmon->clients; c; c = c->next)
+ if (ISVISIBLE(c) && c->bw == 0)
+ resize(c, c->x, c->y, c->w - 2*borderpx, c->h - 2*borderpx, borderpx, 0);
+
+ for (c = selmon->clients; c; c = c->next)
+ if (ISVISIBLE(c))
+ setopacity(c, c == selmon->sel);
}
void
@@ -433,9 +452,15 @@ buttonpress(XEvent *e)
}
if (ev->window == selmon->barwin) {
i = x = 0;
- do
+ unsigned int occ = 0;
+ for(c = m->clients; c; c=c->next)
+ occ |= c->tags;
+ do {
+ /* Do not reserve space for vacant tags */
+ if (!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
x += TEXTW(tags[i]);
- while (ev->x >= x && ++i < LENGTH(tags));
+ } while (ev->x >= x && ++i < LENGTH(tags));
if (i < LENGTH(tags)) {
click = ClkTagBar;
arg.ui = 1 << i;
@@ -569,7 +594,7 @@ configurenotify(XEvent *e)
for (m = mons; m; m = m->next) {
for (c = m->clients; c; c = c->next)
if (c->isfullscreen)
- resizeclient(c, m->mx, m->my, m->mw, m->mh);
+ resizeclient(c, m->mx, m->my, m->mw, m->mh, 0);
XMoveResizeWindow(dpy, m->barwin, m->wx, m->by, m->ww, bh);
}
focus(NULL);
@@ -721,13 +746,12 @@ drawbar(Monitor *m)
}
x = 0;
for (i = 0; i < LENGTH(tags); i++) {
+ /* Do not draw vacant tags */
+ if(!(occ & 1 << i || m->tagset[m->seltags] & 1 << i))
+ continue;
w = TEXTW(tags[i]);
drw_setscheme(drw, scheme[m->tagset[m->seltags] & 1 << i ? SchemeSel : SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, tags[i], urg & 1 << i);
- if (occ & 1 << i)
- drw_rect(drw, x + boxs, boxs, boxw, boxw,
- m == selmon && selmon->sel && selmon->sel->tags & 1 << i,
- urg & 1 << i);
x += w;
}
w = TEXTW(m->ltsymbol);
@@ -736,7 +760,7 @@ drawbar(Monitor *m)
if ((w = m->ww - tw - x) > bh) {
if (m->sel) {
- drw_setscheme(drw, scheme[m == selmon ? SchemeSel : SchemeNorm]);
+ drw_setscheme(drw, scheme[SchemeNorm]);
drw_text(drw, x, 0, w, bh, lrpad / 2, m->sel->name, 0);
if (m->sel->isfloating)
drw_rect(drw, x + boxs, boxs, boxw, boxw, m->sel->isfixed, 0);
@@ -803,6 +827,7 @@ focus(Client *c)
grabbuttons(c, 1);
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
setfocus(c);
+ setopacity(c, 1);
} else {
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
@@ -1122,7 +1147,7 @@ monocle(Monitor *m)
if (n > 0) /* override layout symbol */
snprintf(m->ltsymbol, sizeof m->ltsymbol, "[%d]", n);
for (c = nexttiled(m->clients); c; c = nexttiled(c->next))
- resize(c, m->wx, m->wy, m->ww - 2 * c->bw, m->wh - 2 * c->bw, 0);
+ resize(c, m->wx, m->wy, m->ww, m->wh, 0, 0);
}
void
@@ -1190,7 +1215,7 @@ movemouse(const Arg *arg)
&& (abs(nx - c->x) > snap || abs(ny - c->y) > snap))
togglefloating(NULL);
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
- resize(c, nx, ny, c->w, c->h, 1);
+ resize(c, nx, ny, c->w, c->h, c->bw, 1);
break;
}
} while (ev.type != ButtonRelease);
@@ -1258,6 +1283,11 @@ propertynotify(XEvent *e)
void
quit(const Arg *arg)
{
+ Monitor *m;
+
+ for (m = mons; m; m = m->next)
+ if (m->clients)
+ return;
running = 0;
}
@@ -1276,14 +1306,14 @@ recttomon(int x, int y, int w, int h)
}
void
-resize(Client *c, int x, int y, int w, int h, int interact)
+resize(Client *c, int x, int y, int w, int h, int bw, int interact)
{
- if (applysizehints(c, &x, &y, &w, &h, interact))
- resizeclient(c, x, y, w, h);
+ if (applysizehints(c, &x, &y, &w, &h, &bw, interact))
+ resizeclient(c, x, y, w, h, bw);
}
void
-resizeclient(Client *c, int x, int y, int w, int h)
+resizeclient(Client *c, int x, int y, int w, int h, int bw)
{
XWindowChanges wc;
@@ -1291,7 +1321,7 @@ resizeclient(Client *c, int x, int y, int w, int h)
c->oldy = c->y; c->y = wc.y = y;
c->oldw = c->w; c->w = wc.width = w;
c->oldh = c->h; c->h = wc.height = h;
- wc.border_width = c->bw;
+ c->oldbw = c->bw; c->bw = wc.border_width = bw;
XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
configure(c);
XSync(dpy, False);
@@ -1340,7 +1370,7 @@ resizemouse(const Arg *arg)
togglefloating(NULL);
}
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
- resize(c, c->x, c->y, nw, nh, 1);
+ resize(c, c->x, c->y, nw, nh, c->bw, 1);
break;
}
} while (ev.type != ButtonRelease);
@@ -1379,6 +1409,13 @@ restack(Monitor *m)
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
}
+void
+restart(const Arg *arg)
+{
+ restarting = 1;
+ running = 0;
+}
+
void
run(void)
{
@@ -1487,22 +1524,20 @@ setfullscreen(Client *c, int fullscreen)
PropModeReplace, (unsigned char*)&netatom[NetWMFullscreen], 1);
c->isfullscreen = 1;
c->oldstate = c->isfloating;
- c->oldbw = c->bw;
- c->bw = 0;
c->isfloating = 1;
- resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh);
+ resizeclient(c, c->mon->mx, c->mon->my, c->mon->mw, c->mon->mh, 0);
XRaiseWindow(dpy, c->win);
} else if (!fullscreen && c->isfullscreen){
XChangeProperty(dpy, c->win, netatom[NetWMState], XA_ATOM, 32,
PropModeReplace, (unsigned char*)0, 0);
c->isfullscreen = 0;
c->isfloating = c->oldstate;
- c->bw = c->oldbw;
c->x = c->oldx;
c->y = c->oldy;
c->w = c->oldw;
c->h = c->oldh;
- resizeclient(c, c->x, c->y, c->w, c->h);
+ c->bw = c->oldbw;
+ resizeclient(c, c->x, c->y, c->w, c->h, c->bw);
arrange(c->mon);
}
}
@@ -1526,8 +1561,11 @@ void
setmfact(const Arg *arg)
{
float f;
+ unsigned int n;
+ Client *c;
- if (!arg || !selmon->lt[selmon->sellt]->arrange)
+ for (n = 0, c = nexttiled(selmon->clients); c; c = nexttiled(c->next), n++);
+ if (!arg || selmon->lt[selmon->sellt]->arrange != tile || n < 2)
return;
f = arg->f < 1.0 ? arg->f + selmon->mfact : arg->f - 1.0;
if (f < 0.05 || f > 0.95)
@@ -1536,6 +1574,17 @@ setmfact(const Arg *arg)
arrange(selmon);
}
+void
+setopacity(Client *c, int opaque)
+{
+ if (!opaque && c->isfloating) {
+ unsigned long real_opacity[] = { floatingopacity * 0xffffffff };
+ XChangeProperty(dpy, c->win, netatom[NetWMWindowOpacity], XA_CARDINAL,
+ 32, PropModeReplace, (unsigned char *)real_opacity, 1);
+ } else
+ XDeleteProperty(dpy, c->win, netatom[NetWMWindowOpacity]);
+}
+
void
setup(void)
{
@@ -1553,6 +1602,9 @@ setup(void)
/* clean up any zombies (inherited from .xinitrc etc) immediately */
while (waitpid(-1, NULL, WNOHANG) > 0);
+ if (signal(SIGTERM, sigterm) == SIG_ERR)
+ die("can't install SIGTERM handler:");
+
/* init screen */
screen = DefaultScreen(dpy);
sw = DisplayWidth(dpy, screen);
@@ -1579,6 +1631,7 @@ setup(void)
netatom[NetWMWindowType] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE", False);
netatom[NetWMWindowTypeDialog] = XInternAtom(dpy, "_NET_WM_WINDOW_TYPE_DIALOG", False);
netatom[NetClientList] = XInternAtom(dpy, "_NET_CLIENT_LIST", False);
+ netatom[NetWMWindowOpacity] = XInternAtom(dpy, "_NET_WM_WINDOW_OPACITY", False);
/* init cursors */
cursor[CurNormal] = drw_cur_create(drw, XC_left_ptr);
cursor[CurResize] = drw_cur_create(drw, XC_sizing);
@@ -1635,7 +1688,7 @@ showhide(Client *c)
/* show clients top down */
XMoveWindow(dpy, c->win, c->x, c->y);
if ((!c->mon->lt[c->mon->sellt]->arrange || c->isfloating) && !c->isfullscreen)
- resize(c, c->x, c->y, c->w, c->h, 0);
+ resize(c, c->x, c->y, c->w, c->h, c->bw, 0);
showhide(c->snext);
} else {
/* hide clients bottom up */
@@ -1644,6 +1697,12 @@ showhide(Client *c)
}
}
+void
+sigterm(int unused)
+{
+ quit(NULL);
+}
+
void
spawn(const Arg *arg)
{
@@ -1687,13 +1746,17 @@ tagmon(const Arg *arg)
void
tile(Monitor *m)
{
- unsigned int i, n, h, mw, my, ty;
+ unsigned int i, n, h, mw, my, ty, bw;
Client *c;
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
if (n == 0)
return;
+ if (n == 1)
+ bw = 0;
+ else
+ bw = borderpx;
if (n > m->nmaster)
mw = m->nmaster ? m->ww * m->mfact : 0;
else
@@ -1701,12 +1764,12 @@ tile(Monitor *m)
for (i = my = ty = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), i++)
if (i < m->nmaster) {
h = (m->wh - my) / (MIN(n, m->nmaster) - i);
- resize(c, m->wx, m->wy + my, mw - (2*c->bw), h - (2*c->bw), 0);
+ resize(c, m->wx + m->ww - mw, m->wy + my, mw - 2*bw, h - 2*bw, bw, 0);
if (my + HEIGHT(c) < m->wh)
my += HEIGHT(c);
} else {
h = (m->wh - ty) / (n - i);
- resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
+ resize(c, m->wx, m->wy + ty, m->ww - mw - 2*bw, h - 2*bw, bw, 0);
if (ty + HEIGHT(c) < m->wh)
ty += HEIGHT(c);
}
@@ -1731,10 +1794,20 @@ togglefloating(const Arg *arg)
selmon->sel->isfloating = !selmon->sel->isfloating || selmon->sel->isfixed;
if (selmon->sel->isfloating)
resize(selmon->sel, selmon->sel->x, selmon->sel->y,
- selmon->sel->w, selmon->sel->h, 0);
+ selmon->sel->w - 2 * (borderpx - selmon->sel->bw),
+ selmon->sel->h - 2 * (borderpx - selmon->sel->bw),
+ borderpx, 0);
arrange(selmon);
}
+void
+togglefullscreen(const Arg *arg)
+{
+ if (!selmon->sel)
+ return;
+ setfullscreen(selmon->sel, !selmon->sel->isfullscreen);
+}
+
void
toggletag(const Arg *arg)
{
@@ -1773,6 +1846,7 @@ unfocus(Client *c, int setfocus)
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
}
+ setopacity(c, 0);
}
void
@@ -2159,6 +2233,10 @@ main(int argc, char *argv[])
#endif /* __OpenBSD__ */
scan();
run();
+ if (restarting) {
+ execvp(argv[0], argv);
+ die("dwm: execvp '%s' failed:", argv[0]);
+ }
cleanup();
XCloseDisplay(dpy);
return EXIT_SUCCESS;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment