Compare commits
5 Commits
f533b4ed35
...
7ffccdd3c9
Author | SHA1 | Date | |
---|---|---|---|
|
7ffccdd3c9 | ||
|
c88efa050f | ||
|
9ef6996bd6 | ||
|
1241bda940 | ||
|
8b5f4911c1 |
@ -4,6 +4,7 @@
|
|||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const unsigned int snap = 32; /* snap pixel */
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
static const int swallowfloating = 0; /* 1 means swallow floating windows by default */
|
||||||
|
static const unsigned int minwsz = 20; /* Minimal heigt of a client for smfact */
|
||||||
static const int showbar = 1; /* 0 means no standard bar */
|
static const int showbar = 1; /* 0 means no standard bar */
|
||||||
static const int topbar = 1; /* 0 means standard bar at bottom */
|
static const int topbar = 1; /* 0 means standard bar at bottom */
|
||||||
static const int extrabar = 1; /* 0 means no extra bar */
|
static const int extrabar = 1; /* 0 means no extra bar */
|
||||||
@ -51,6 +52,7 @@ static const Rule rules[] = {
|
|||||||
#define WFDEFAULT WFINACTIVE
|
#define WFDEFAULT WFINACTIVE
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */
|
||||||
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
static const int nmaster = 1; /* number of clients in master area */
|
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 resizehints = 1; /* 1 means respect size hints in tiled resizals */
|
||||||
@ -94,6 +96,8 @@ static const Key keys[] = {
|
|||||||
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY|ShiftMask, XK_h, setsmfact, {.f = +0.05} },
|
||||||
|
{ MODKEY|ShiftMask, XK_l, setsmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XK_Return, zoom, {0} },
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
{ MODKEY, XK_Tab, view, {0} },
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
94
dwm.c
94
dwm.c
@ -80,6 +80,7 @@ typedef union {
|
|||||||
int i;
|
int i;
|
||||||
unsigned int ui;
|
unsigned int ui;
|
||||||
float f;
|
float f;
|
||||||
|
float sf;
|
||||||
const void *v;
|
const void *v;
|
||||||
} Arg;
|
} Arg;
|
||||||
|
|
||||||
@ -128,6 +129,7 @@ struct Monitor {
|
|||||||
char ltsymbol[16];
|
char ltsymbol[16];
|
||||||
char wfsymbol[2];
|
char wfsymbol[2];
|
||||||
float mfact;
|
float mfact;
|
||||||
|
float smfact;
|
||||||
int nmaster;
|
int nmaster;
|
||||||
int num;
|
int num;
|
||||||
int by; /* bar geometry */
|
int by; /* bar geometry */
|
||||||
@ -232,6 +234,7 @@ static void setfocus(Client *c);
|
|||||||
static void setfullscreen(Client *c, int fullscreen);
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
|
static void setsmfact(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 show(const Arg *arg);
|
static void show(const Arg *arg);
|
||||||
@ -265,7 +268,6 @@ static void updatetitle(Client *c);
|
|||||||
static void updatewindowtype(Client *c);
|
static void updatewindowtype(Client *c);
|
||||||
static void updatewmhints(Client *c);
|
static void updatewmhints(Client *c);
|
||||||
static void view(const Arg *arg);
|
static void view(const Arg *arg);
|
||||||
static void warp(const Client *c);
|
|
||||||
static Client *wintoclient(Window w);
|
static Client *wintoclient(Window w);
|
||||||
static Monitor *wintomon(Window w);
|
static Monitor *wintomon(Window w);
|
||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
static int xerror(Display *dpy, XErrorEvent *ee);
|
||||||
@ -332,6 +334,7 @@ struct Pertag {
|
|||||||
unsigned int curtag, prevtag; /* current and previous tag */
|
unsigned int curtag, prevtag; /* current and previous tag */
|
||||||
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
|
||||||
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
|
||||||
|
float smfacts[LENGTH(tags) + 1]; /* smfacts per tag */
|
||||||
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
|
||||||
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
|
||||||
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
|
||||||
@ -783,6 +786,7 @@ createmon(void)
|
|||||||
m = ecalloc(1, sizeof(Monitor));
|
m = ecalloc(1, sizeof(Monitor));
|
||||||
m->tagset[0] = m->tagset[1] = 1;
|
m->tagset[0] = m->tagset[1] = 1;
|
||||||
m->mfact = mfact;
|
m->mfact = mfact;
|
||||||
|
m->smfact = smfact;
|
||||||
m->nmaster = nmaster;
|
m->nmaster = nmaster;
|
||||||
m->showbar = showbar;
|
m->showbar = showbar;
|
||||||
m->topbar = topbar;
|
m->topbar = topbar;
|
||||||
@ -796,6 +800,7 @@ createmon(void)
|
|||||||
for (i = 0; i <= LENGTH(tags); i++) {
|
for (i = 0; i <= LENGTH(tags); i++) {
|
||||||
m->pertag->nmasters[i] = m->nmaster;
|
m->pertag->nmasters[i] = m->nmaster;
|
||||||
m->pertag->mfacts[i] = m->mfact;
|
m->pertag->mfacts[i] = m->mfact;
|
||||||
|
m->pertag->smfacts[i] = m->smfact;
|
||||||
|
|
||||||
m->pertag->ltidxs[i][0] = m->lt[0];
|
m->pertag->ltidxs[i][0] = m->lt[0];
|
||||||
m->pertag->ltidxs[i][1] = m->lt[1];
|
m->pertag->ltidxs[i][1] = m->lt[1];
|
||||||
@ -1048,7 +1053,6 @@ focusmon(const Arg *arg)
|
|||||||
unfocus(selmon->sel, 0);
|
unfocus(selmon->sel, 0);
|
||||||
selmon = m;
|
selmon = m;
|
||||||
focus(NULL);
|
focus(NULL);
|
||||||
warp(selmon->sel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1670,6 +1674,7 @@ void
|
|||||||
resizemouse(const Arg *arg)
|
resizemouse(const Arg *arg)
|
||||||
{
|
{
|
||||||
int ocx, ocy, nw, nh;
|
int ocx, ocy, nw, nh;
|
||||||
|
unsigned int i;
|
||||||
Client *c;
|
Client *c;
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
@ -1713,6 +1718,15 @@ resizemouse(const Arg *arg)
|
|||||||
|
|
||||||
if (!selmon->lt[selmon->sellt]->arrange || c->isfloating)
|
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, 1);
|
||||||
|
else {
|
||||||
|
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
|
||||||
|
for(i=0; i<LENGTH(tags); ++i)
|
||||||
|
if(selmon->tagset[selmon->seltags] & 1<<i)
|
||||||
|
selmon->pertag->mfacts[i+1] = selmon->mfact;
|
||||||
|
if(selmon->pertag->curtag == 0)
|
||||||
|
selmon->pertag->mfacts[0] = selmon->mfact;
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (ev.type != ButtonRelease);
|
} while (ev.type != ButtonRelease);
|
||||||
@ -1720,8 +1734,6 @@ resizemouse(const Arg *arg)
|
|||||||
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
|
if (c->isfloating || NULL == c->mon->lt[c->mon->sellt]->arrange) {
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w + c->bw - 1, c->h + c->bw - 1);
|
||||||
} else {
|
} else {
|
||||||
selmon->mfact = (double) (ev.xmotion.x_root - selmon->mx) / (double) selmon->ww;
|
|
||||||
arrange(selmon);
|
|
||||||
XWarpPointer(dpy, None, root, 0, 0, 0, 0,
|
XWarpPointer(dpy, None, root, 0, 0, 0, 0,
|
||||||
selmon->mx + (selmon->ww * selmon->mfact),
|
selmon->mx + (selmon->ww * selmon->mfact),
|
||||||
selmon->my + (selmon->wh / 2)
|
selmon->my + (selmon->wh / 2)
|
||||||
@ -1758,8 +1770,6 @@ restack(Monitor *m)
|
|||||||
wc.sibling = c->win;
|
wc.sibling = c->win;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && m->lt[m->sellt]->arrange != &monocle)
|
|
||||||
warp(m->sel);
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
||||||
}
|
}
|
||||||
@ -1948,6 +1958,28 @@ setmfact(const Arg *arg)
|
|||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
setsmfact(const Arg *arg) {
|
||||||
|
float sf;
|
||||||
|
unsigned int i;
|
||||||
|
|
||||||
|
if(!arg || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
return;
|
||||||
|
sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0;
|
||||||
|
if(sf < 0 || sf > 0.9)
|
||||||
|
return;
|
||||||
|
selmon->smfact = sf;
|
||||||
|
for(i=0; i<LENGTH(tags); ++i)
|
||||||
|
if(selmon->tagset[selmon->seltags] & 1<<i)
|
||||||
|
selmon->pertag->smfacts[i+1] = sf;
|
||||||
|
|
||||||
|
if(selmon->pertag->curtag == 0)
|
||||||
|
{
|
||||||
|
selmon->pertag->smfacts[0] = sf;
|
||||||
|
}
|
||||||
|
arrange(selmon);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
setup(void)
|
setup(void)
|
||||||
{
|
{
|
||||||
@ -2170,7 +2202,7 @@ tagmon(const Arg *arg)
|
|||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n, h, mw, my, ty;
|
unsigned int i, n, h, smh, mw, my, ty;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
for (n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
@ -2188,11 +2220,27 @@ tile(Monitor *m)
|
|||||||
if (my + HEIGHT(c) < m->wh)
|
if (my + HEIGHT(c) < m->wh)
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c);
|
||||||
} else {
|
} 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);
|
smh = m->mh * m->smfact;
|
||||||
if (ty + HEIGHT(c) < m->wh)
|
if(!(nexttiled(c->next)))
|
||||||
|
h = (m->wh - ty) / (n - i);
|
||||||
|
else
|
||||||
|
h = (m->wh - smh - ty) / (n - i);
|
||||||
|
if(h < minwsz) {
|
||||||
|
c->isfloating = True;
|
||||||
|
XRaiseWindow(dpy, c->win);
|
||||||
|
resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False);
|
||||||
|
ty -= HEIGHT(c);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
|
||||||
|
if(!(nexttiled(c->next))) {
|
||||||
|
if (ty + HEIGHT(c) < m->wh)
|
||||||
|
ty += HEIGHT(c) + smh;
|
||||||
|
}
|
||||||
|
else if (ty + HEIGHT(c) < m->wh)
|
||||||
ty += HEIGHT(c);
|
ty += HEIGHT(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -2295,6 +2343,7 @@ toggleview(const Arg *arg)
|
|||||||
/* apply settings for this view */
|
/* apply settings for this view */
|
||||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||||
|
selmon->smfact = selmon->pertag->smfacts[selmon->pertag->curtag];
|
||||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||||
@ -2692,6 +2741,7 @@ view(const Arg *arg)
|
|||||||
|
|
||||||
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
selmon->nmaster = selmon->pertag->nmasters[selmon->pertag->curtag];
|
||||||
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
selmon->mfact = selmon->pertag->mfacts[selmon->pertag->curtag];
|
||||||
|
selmon->smfact = selmon->pertag->smfacts[selmon->pertag->curtag];
|
||||||
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
selmon->sellt = selmon->pertag->sellts[selmon->pertag->curtag];
|
||||||
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
selmon->lt[selmon->sellt] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt];
|
||||||
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
selmon->lt[selmon->sellt^1] = selmon->pertag->ltidxs[selmon->pertag->curtag][selmon->sellt^1];
|
||||||
@ -2833,28 +2883,6 @@ swallowingclient(Window w)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
warp(const Client *c)
|
|
||||||
{
|
|
||||||
int x, y;
|
|
||||||
|
|
||||||
if (!c) {
|
|
||||||
XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!getrootptr(&x, &y) ||
|
|
||||||
(x > c->x - c->bw &&
|
|
||||||
y > c->y - c->bw &&
|
|
||||||
x < c->x + c->w + c->bw*2 &&
|
|
||||||
y < c->y + c->h + c->bw*2) ||
|
|
||||||
(y > c->mon->by && y < c->mon->by + bh) ||
|
|
||||||
(c->mon->topbar && !y))
|
|
||||||
return;
|
|
||||||
|
|
||||||
XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
Client *
|
Client *
|
||||||
wintoclient(Window w)
|
wintoclient(Window w)
|
||||||
{
|
{
|
||||||
|
@ -1,79 +0,0 @@
|
|||||||
From a229c36f51ad6f8b40109ed53c643f242351962a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Jonas Dujava <jonas.dujava@gmail.com>
|
|
||||||
Date: Fri, 26 May 2023 22:14:48 +0200
|
|
||||||
Subject: [PATCH] Warp patch
|
|
||||||
|
|
||||||
Warps the mouse cursor to the center of the currently focused
|
|
||||||
window or screen when the mouse cursor is
|
|
||||||
(a) on a different screen, or
|
|
||||||
(b) on top of a different window.
|
|
||||||
|
|
||||||
This version properly handles warping to windows that have not been
|
|
||||||
mapped yet (before it resulted in a change of the stack order).
|
|
||||||
See the discussion in (thanks goes to Bakkeby):
|
|
||||||
https://github.com/bakkeby/patches/issues/60
|
|
||||||
---
|
|
||||||
dwm.c | 26 ++++++++++++++++++++++++++
|
|
||||||
1 file changed, 26 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/dwm.c b/dwm.c
|
|
||||||
index e5efb6a..7ea6c14 100644
|
|
||||||
--- a/dwm.c
|
|
||||||
+++ b/dwm.c
|
|
||||||
@@ -228,6 +228,7 @@ static void updatetitle(Client *c);
|
|
||||||
static void updatewindowtype(Client *c);
|
|
||||||
static void updatewmhints(Client *c);
|
|
||||||
static void view(const Arg *arg);
|
|
||||||
+static void warp(const Client *c);
|
|
||||||
static Client *wintoclient(Window w);
|
|
||||||
static Monitor *wintomon(Window w);
|
|
||||||
static int xerror(Display *dpy, XErrorEvent *ee);
|
|
||||||
@@ -834,6 +835,7 @@ focusmon(const Arg *arg)
|
|
||||||
unfocus(selmon->sel, 0);
|
|
||||||
selmon = m;
|
|
||||||
focus(NULL);
|
|
||||||
+ warp(selmon->sel);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
@@ -1366,6 +1368,8 @@ restack(Monitor *m)
|
|
||||||
wc.sibling = c->win;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+ if (m == selmon && (m->tagset[m->seltags] & m->sel->tags) && m->lt[m->sellt]->arrange != &monocle)
|
|
||||||
+ warp(m->sel);
|
|
||||||
XSync(dpy, False);
|
|
||||||
while (XCheckMaskEvent(dpy, EnterWindowMask, &ev));
|
|
||||||
}
|
|
||||||
@@ -2044,6 +2048,28 @@ view(const Arg *arg)
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+warp(const Client *c)
|
|
||||||
+{
|
|
||||||
+ int x, y;
|
|
||||||
+
|
|
||||||
+ if (!c) {
|
|
||||||
+ XWarpPointer(dpy, None, root, 0, 0, 0, 0, selmon->wx + selmon->ww / 2, selmon->wy + selmon->wh / 2);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (!getrootptr(&x, &y) ||
|
|
||||||
+ (x > c->x - c->bw &&
|
|
||||||
+ y > c->y - c->bw &&
|
|
||||||
+ x < c->x + c->w + c->bw*2 &&
|
|
||||||
+ y < c->y + c->h + c->bw*2) ||
|
|
||||||
+ (y > c->mon->by && y < c->mon->by + bh) ||
|
|
||||||
+ (c->mon->topbar && !y))
|
|
||||||
+ return;
|
|
||||||
+
|
|
||||||
+ XWarpPointer(dpy, None, c->win, 0, 0, 0, 0, c->w / 2, c->h / 2);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
Client *
|
|
||||||
wintoclient(Window w)
|
|
||||||
{
|
|
||||||
--
|
|
||||||
2.40.1
|
|
||||||
|
|
117
patches/functions/dwm-6.0-smfact.diff
Normal file
117
patches/functions/dwm-6.0-smfact.diff
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
--- config.def.h 2013-04-06 21:01:27.750829760 +0200
|
||||||
|
+++ config.def.h 2013-04-06 21:02:19.557495556 +0200
|
||||||
|
@@ -10,6 +10,7 @@ static const char selbgcolor[] = "#
|
||||||
|
static const char selfgcolor[] = "#eeeeee";
|
||||||
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
|
static const unsigned int snap = 32; /* snap pixel */
|
||||||
|
+static const unsigned int minwsz = 20; /* Minimal heigt of a client for smfact */
|
||||||
|
static const Bool showbar = True; /* False means no bar */
|
||||||
|
static const Bool topbar = True; /* False means bottom bar */
|
||||||
|
|
||||||
|
@@ -24,6 +25,7 @@ static const Rule rules[] = {
|
||||||
|
|
||||||
|
/* layout(s) */
|
||||||
|
static const float mfact = 0.55; /* factor of master area size [0.05..0.95] */
|
||||||
|
+static const float smfact = 0.00; /* factor of tiled clients [0.00..0.95] */
|
||||||
|
static const int nmaster = 1; /* number of clients in master area */
|
||||||
|
static const Bool resizehints = True; /* True means respect size hints in tiled resizals */
|
||||||
|
|
||||||
|
@@ -60,6 +62,8 @@ static Key keys[] = {
|
||||||
|
{ MODKEY, XK_d, incnmaster, {.i = -1 } },
|
||||||
|
{ MODKEY, XK_h, setmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_l, setmfact, {.f = +0.05} },
|
||||||
|
+ { MODKEY|ShiftMask, XK_h, setsmfact, {.f = +0.05} },
|
||||||
|
+ { MODKEY|ShiftMask, XK_l, setsmfact, {.f = -0.05} },
|
||||||
|
{ MODKEY, XK_Return, zoom, {0} },
|
||||||
|
{ MODKEY, XK_Tab, view, {0} },
|
||||||
|
{ MODKEY|ShiftMask, XK_c, killclient, {0} },
|
||||||
|
--- dwm.c 2011-12-19 16:02:46.000000000 +0100
|
||||||
|
+++ dwm.c 2013-04-06 21:00:46.620830452 +0200
|
||||||
|
@@ -69,6 +69,7 @@ typedef union {
|
||||||
|
int i;
|
||||||
|
unsigned int ui;
|
||||||
|
float f;
|
||||||
|
+ float sf;
|
||||||
|
const void *v;
|
||||||
|
} Arg;
|
||||||
|
|
||||||
|
@@ -127,6 +128,7 @@ typedef struct {
|
||||||
|
struct Monitor {
|
||||||
|
char ltsymbol[16];
|
||||||
|
float mfact;
|
||||||
|
+ float smfact;
|
||||||
|
int nmaster;
|
||||||
|
int num;
|
||||||
|
int by; /* bar geometry */
|
||||||
|
@@ -220,6 +222,7 @@ static void setfocus(Client *c);
|
||||||
|
static void setfullscreen(Client *c, Bool fullscreen);
|
||||||
|
static void setlayout(const Arg *arg);
|
||||||
|
static void setmfact(const Arg *arg);
|
||||||
|
+static void setsmfact(const Arg *arg);
|
||||||
|
static void setup(void);
|
||||||
|
static void showhide(Client *c);
|
||||||
|
static void sigchld(int unused);
|
||||||
|
@@ -651,6 +654,7 @@ createmon(void) {
|
||||||
|
die("fatal: could not malloc() %u bytes\n", sizeof(Monitor));
|
||||||
|
m->tagset[0] = m->tagset[1] = 1;
|
||||||
|
m->mfact = mfact;
|
||||||
|
+ m->smfact = smfact;
|
||||||
|
m->nmaster = nmaster;
|
||||||
|
m->showbar = showbar;
|
||||||
|
m->topbar = topbar;
|
||||||
|
@@ -1581,6 +1585,19 @@ setmfact(const Arg *arg) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
+setsmfact(const Arg *arg) {
|
||||||
|
+ float sf;
|
||||||
|
+
|
||||||
|
+ if(!arg || !selmon->lt[selmon->sellt]->arrange)
|
||||||
|
+ return;
|
||||||
|
+ sf = arg->sf < 1.0 ? arg->sf + selmon->smfact : arg->sf - 1.0;
|
||||||
|
+ if(sf < 0 || sf > 0.9)
|
||||||
|
+ return;
|
||||||
|
+ selmon->smfact = sf;
|
||||||
|
+ arrange(selmon);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
setup(void) {
|
||||||
|
XSetWindowAttributes wa;
|
||||||
|
|
||||||
|
@@ -1703,7 +1720,7 @@ textnw(const char *text, unsigned int le
|
||||||
|
|
||||||
|
void
|
||||||
|
tile(Monitor *m) {
|
||||||
|
- unsigned int i, n, h, mw, my, ty;
|
||||||
|
+ unsigned int i, n, h, smh, mw, my, ty;
|
||||||
|
Client *c;
|
||||||
|
|
||||||
|
for(n = 0, c = nexttiled(m->clients); c; c = nexttiled(c->next), n++);
|
||||||
|
@@ -1721,9 +1738,23 @@ tile(Monitor *m) {
|
||||||
|
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), False);
|
||||||
|
- ty += HEIGHT(c);
|
||||||
|
+ smh = m->mh * m->smfact;
|
||||||
|
+ if(!(nexttiled(c->next)))
|
||||||
|
+ h = (m->wh - ty) / (n - i);
|
||||||
|
+ else
|
||||||
|
+ h = (m->wh - smh - ty) / (n - i);
|
||||||
|
+ if(h < minwsz) {
|
||||||
|
+ c->isfloating = True;
|
||||||
|
+ XRaiseWindow(dpy, c->win);
|
||||||
|
+ resize(c, m->mx + (m->mw / 2 - WIDTH(c) / 2), m->my + (m->mh / 2 - HEIGHT(c) / 2), m->ww - mw - (2*c->bw), h - (2*c->bw), False);
|
||||||
|
+ ty -= HEIGHT(c);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), False);
|
||||||
|
+ if(!(nexttiled(c->next)))
|
||||||
|
+ ty += HEIGHT(c) + smh;
|
||||||
|
+ else
|
||||||
|
+ ty += HEIGHT(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user