Compare commits
2 Commits
7ffccdd3c9
...
684ff9bb71
Author | SHA1 | Date | |
---|---|---|---|
|
684ff9bb71 | ||
|
3d0629b664 |
@ -4,7 +4,6 @@
|
|||||||
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 */
|
||||||
@ -52,7 +51,6 @@ 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 */
|
||||||
@ -96,8 +94,6 @@ 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} },
|
||||||
|
76
dwm.c
76
dwm.c
@ -80,7 +80,6 @@ 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;
|
||||||
|
|
||||||
@ -129,7 +128,6 @@ 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 */
|
||||||
@ -234,7 +232,6 @@ 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);
|
||||||
@ -268,6 +265,7 @@ 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);
|
||||||
@ -334,7 +332,6 @@ 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 */
|
||||||
@ -786,7 +783,6 @@ 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;
|
||||||
@ -800,7 +796,6 @@ 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];
|
||||||
@ -1053,6 +1048,7 @@ 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
|
||||||
@ -1770,6 +1766,8 @@ 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));
|
||||||
}
|
}
|
||||||
@ -1958,28 +1956,6 @@ 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)
|
||||||
{
|
{
|
||||||
@ -2202,7 +2178,7 @@ tagmon(const Arg *arg)
|
|||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n, h, smh, mw, my, ty;
|
unsigned int i, n, h, 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++);
|
||||||
@ -2220,25 +2196,9 @@ tile(Monitor *m)
|
|||||||
if (my + HEIGHT(c) < m->wh)
|
if (my + HEIGHT(c) < m->wh)
|
||||||
my += HEIGHT(c);
|
my += HEIGHT(c);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
smh = m->mh * m->smfact;
|
|
||||||
if(!(nexttiled(c->next)))
|
|
||||||
h = (m->wh - ty) / (n - i);
|
h = (m->wh - ty) / (n - i);
|
||||||
else
|
resize(c, m->wx + mw, m->wy + ty, m->ww - mw - (2*c->bw), h - (2*c->bw), 0);
|
||||||
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)
|
if (ty + HEIGHT(c) < m->wh)
|
||||||
ty += HEIGHT(c) + smh;
|
|
||||||
}
|
|
||||||
else if (ty + HEIGHT(c) < m->wh)
|
|
||||||
ty += HEIGHT(c);
|
ty += HEIGHT(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2343,7 +2303,6 @@ 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];
|
||||||
@ -2741,7 +2700,6 @@ 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];
|
||||||
@ -2883,6 +2841,28 @@ 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)
|
||||||
{
|
{
|
||||||
|
79
patches/behavior/dwm-warp-6.4.diff
Normal file
79
patches/behavior/dwm-warp-6.4.diff
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
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
|
||||||
|
|
@ -1,117 +0,0 @@
|
|||||||
--- 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