mirror layout
I missed this feature for some time too, then I've just added two layouts with master and stack area separated horizontaly: tiledown and tileup (with the stack area down and up respectively) by adding a third argument telling whether one wants to separate horizontally or verticaly to the _tile function in layouts/tile.c. Patch against latest git version, you will need to have icons icons/layouts/{tiledown.png,tiledownw.png,tileup.png,tileupw.png} to compile it without modifications. Fabienne Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
f9cebe0dd8
commit
1dbe305177
|
@ -124,8 +124,12 @@ dist_iconslayouts_DATA += icons/layouts/maxw.png
|
||||||
dist_iconslayouts_DATA += icons/layouts/spiral.png
|
dist_iconslayouts_DATA += icons/layouts/spiral.png
|
||||||
dist_iconslayouts_DATA += icons/layouts/spiralw.png
|
dist_iconslayouts_DATA += icons/layouts/spiralw.png
|
||||||
dist_iconslayouts_DATA += icons/layouts/tile.png
|
dist_iconslayouts_DATA += icons/layouts/tile.png
|
||||||
|
dist_iconslayouts_DATA += icons/layouts/tiledown.png
|
||||||
|
dist_iconslayouts_DATA += icons/layouts/tiledownw.png
|
||||||
dist_iconslayouts_DATA += icons/layouts/tileleft.png
|
dist_iconslayouts_DATA += icons/layouts/tileleft.png
|
||||||
dist_iconslayouts_DATA += icons/layouts/tileleftw.png
|
dist_iconslayouts_DATA += icons/layouts/tileleftw.png
|
||||||
|
dist_iconslayouts_DATA += icons/layouts/tileup.png
|
||||||
|
dist_iconslayouts_DATA += icons/layouts/tileupw.png
|
||||||
dist_iconslayouts_DATA += icons/layouts/tilew.png
|
dist_iconslayouts_DATA += icons/layouts/tilew.png
|
||||||
|
|
||||||
clean-local:
|
clean-local:
|
||||||
|
|
|
@ -343,7 +343,7 @@ screen <integer> [MULTI]
|
||||||
tag <identifier> [MULTI]
|
tag <identifier> [MULTI]
|
||||||
{
|
{
|
||||||
layout = <{dwindle,floating,max,
|
layout = <{dwindle,floating,max,
|
||||||
spiral,tile,tileleft}>
|
spiral,tile,tileleft,tiledown,tileup}>
|
||||||
mwfact = <float>
|
mwfact = <float>
|
||||||
nmaster = <integer>
|
nmaster = <integer>
|
||||||
}
|
}
|
||||||
|
@ -351,7 +351,8 @@ screen <integer> [MULTI]
|
||||||
layouts
|
layouts
|
||||||
{
|
{
|
||||||
layout <{dwindle,floating,max,
|
layout <{dwindle,floating,max,
|
||||||
spiral,tile,tileleft}> { image = <image> } [MULTI]
|
spiral,tile,tileleft,
|
||||||
|
tiledown,tileup}> { image = <image> } [MULTI]
|
||||||
}
|
}
|
||||||
colors
|
colors
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,8 @@ screen 0
|
||||||
{
|
{
|
||||||
layout tile { image = "@iconslayoutsdir@/tilew.png" }
|
layout tile { image = "@iconslayoutsdir@/tilew.png" }
|
||||||
layout tileleft { image = "@iconslayoutsdir@/tileleftw.png" }
|
layout tileleft { image = "@iconslayoutsdir@/tileleftw.png" }
|
||||||
|
layout tiledown { image = "@iconslayoutsdir@/tiledownw.png" }
|
||||||
|
layout tileup { image = "@iconslayoutsdir@/tileupw.png" }
|
||||||
layout max { image = "@iconslayoutsdir@/maxw.png" }
|
layout max { image = "@iconslayoutsdir@/maxw.png" }
|
||||||
layout spiral { image = "@iconslayoutsdir@/spiralw.png" }
|
layout spiral { image = "@iconslayoutsdir@/spiralw.png" }
|
||||||
layout dwindle { image = "@iconslayoutsdir@/dwindlew.png" }
|
layout dwindle { image = "@iconslayoutsdir@/dwindlew.png" }
|
||||||
|
|
2
layout.c
2
layout.c
|
@ -42,6 +42,8 @@ const name_func_link_t LayoutList[] =
|
||||||
{
|
{
|
||||||
{"tile", layout_tile},
|
{"tile", layout_tile},
|
||||||
{"tileleft", layout_tileleft},
|
{"tileleft", layout_tileleft},
|
||||||
|
{"tiledown", layout_tiledown},
|
||||||
|
{"tileup", layout_tileup},
|
||||||
{"max", layout_max},
|
{"max", layout_max},
|
||||||
{"spiral", layout_spiral},
|
{"spiral", layout_spiral},
|
||||||
{"dwindle", layout_dwindle},
|
{"dwindle", layout_dwindle},
|
||||||
|
|
|
@ -37,7 +37,10 @@ uicb_tag_setnmaster(int screen, char * arg)
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
Layout *curlay = curtags[0]->layout;
|
Layout *curlay = curtags[0]->layout;
|
||||||
|
|
||||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
if(!arg || (curlay->arrange != layout_tile
|
||||||
|
&& curlay->arrange != layout_tileleft
|
||||||
|
&& curlay->arrange != layout_tiledown
|
||||||
|
&& curlay->arrange != layout_tileup))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((curtags[0]->nmaster = (int) compute_new_value_from_arg(arg, (double) curtags[0]->nmaster)) < 0)
|
if((curtags[0]->nmaster = (int) compute_new_value_from_arg(arg, (double) curtags[0]->nmaster)) < 0)
|
||||||
|
@ -54,7 +57,10 @@ uicb_tag_setncol(int screen, char * arg)
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
Layout *curlay = curtags[0]->layout;
|
Layout *curlay = curtags[0]->layout;
|
||||||
|
|
||||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
if(!arg || (curlay->arrange != layout_tile
|
||||||
|
&& curlay->arrange != layout_tileleft
|
||||||
|
&& curlay->arrange != layout_tiledown
|
||||||
|
&& curlay->arrange != layout_tileup))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((curtags[0]->ncol = (int) compute_new_value_from_arg(arg, (double) curtags[0]->ncol)) < 1)
|
if((curtags[0]->ncol = (int) compute_new_value_from_arg(arg, (double) curtags[0]->ncol)) < 1)
|
||||||
|
@ -72,11 +78,14 @@ uicb_tag_setmwfact(int screen, char *arg)
|
||||||
Tag **curtags = get_current_tags(screen);
|
Tag **curtags = get_current_tags(screen);
|
||||||
Layout *curlay = curtags[0]->layout;
|
Layout *curlay = curtags[0]->layout;
|
||||||
|
|
||||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
if(!arg || (curlay->arrange != layout_tile
|
||||||
|
&& curlay->arrange != layout_tileleft
|
||||||
|
&& curlay->arrange != layout_tiledown
|
||||||
|
&& curlay->arrange != layout_tileup))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
newarg = a_strdup(arg);
|
newarg = a_strdup(arg);
|
||||||
if(curlay->arrange == layout_tileleft)
|
if(curlay->arrange == layout_tileleft || curlay->arrange == layout_tileup)
|
||||||
{
|
{
|
||||||
if(newarg[0] == '+')
|
if(newarg[0] == '+')
|
||||||
newarg[0] = '-';
|
newarg[0] = '-';
|
||||||
|
@ -95,7 +104,7 @@ uicb_tag_setmwfact(int screen, char *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_tile(int screen, const Bool right)
|
_tile(int screen, const Bool right, const Bool vertical)
|
||||||
{
|
{
|
||||||
/* windows area geometry */
|
/* windows area geometry */
|
||||||
int wah = 0, waw = 0, wax = 0, way = 0;
|
int wah = 0, waw = 0, wax = 0, way = 0;
|
||||||
|
@ -130,8 +139,16 @@ _tile(int screen, const Bool right)
|
||||||
|
|
||||||
if(curtags[0]->nmaster)
|
if(curtags[0]->nmaster)
|
||||||
{
|
{
|
||||||
mh = masterwin ? wah / masterwin : waw;
|
if(vertical)
|
||||||
mw = otherwin ? waw * curtags[0]->mwfact : waw;
|
{
|
||||||
|
mh = masterwin ? wah / masterwin : wah;
|
||||||
|
mw = otherwin ? waw * curtags[0]->mwfact : waw;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
mh = otherwin ? wah * curtags[0]->mwfact : wah;
|
||||||
|
mw = masterwin ? waw / masterwin : waw;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
mh = mw = 0;
|
mh = mw = 0;
|
||||||
|
@ -146,8 +163,16 @@ _tile(int screen, const Bool right)
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
if(i < curtags[0]->nmaster)
|
if(i < curtags[0]->nmaster)
|
||||||
{
|
{
|
||||||
geometry.y = way + i * mh;
|
if(vertical)
|
||||||
geometry.x = wax + (right ? 0 : waw - mw);
|
{
|
||||||
|
geometry.y = way + i * mh;
|
||||||
|
geometry.x = wax + (right ? 0 : waw - mw);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
geometry.y = way + (right ? 0 : wah - mh);
|
||||||
|
geometry.x = wax + i * mw;
|
||||||
|
}
|
||||||
geometry.width = mw - 2 * c->border;
|
geometry.width = mw - 2 * c->border;
|
||||||
geometry.height = mh - 2 * c->border;
|
geometry.height = mh - 2 * c->border;
|
||||||
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
||||||
|
@ -163,19 +188,39 @@ _tile(int screen, const Bool right)
|
||||||
if(current_col == real_ncol - 1)
|
if(current_col == real_ncol - 1)
|
||||||
win_by_col += otherwin % real_ncol;
|
win_by_col += otherwin % real_ncol;
|
||||||
|
|
||||||
if(otherwin <= real_ncol)
|
if(vertical)
|
||||||
geometry.height = wah - 2 * c->border;
|
{
|
||||||
|
if(otherwin <= real_ncol)
|
||||||
|
geometry.height = wah - 2 * c->border;
|
||||||
|
else
|
||||||
|
geometry.height = (wah / win_by_col) - 2 * c->border;
|
||||||
|
|
||||||
|
geometry.width = (waw - mw) / real_ncol - 2 * c->border;
|
||||||
|
|
||||||
|
if(i == curtags[0]->nmaster || otherwin <= real_ncol || (i - curtags[0]->nmaster) % win_by_col == 0)
|
||||||
|
geometry.y = way;
|
||||||
|
else
|
||||||
|
geometry.y = way + ((i - curtags[0]->nmaster) % win_by_col) * (geometry.height + 2 * c->border);
|
||||||
|
|
||||||
|
geometry.x = wax + current_col * (geometry.width + 2 * c->border) + (right ? mw : 0);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
geometry.height = (wah / win_by_col) - 2 * c->border;
|
{
|
||||||
|
if(otherwin <= real_ncol)
|
||||||
|
geometry.width = waw - 2 * c->border;
|
||||||
|
else
|
||||||
|
geometry.width = (waw / win_by_col) - 2 * c->border;
|
||||||
|
|
||||||
geometry.width = (waw - mw) / real_ncol - 2 * c->border;
|
geometry.height = (wah - mh) / real_ncol - 2 * c->border;
|
||||||
|
|
||||||
if(i == curtags[0]->nmaster || otherwin <= real_ncol || (i - curtags[0]->nmaster) % win_by_col == 0)
|
if(i == curtags[0]->nmaster || otherwin <= real_ncol || (i - curtags[0]->nmaster) % win_by_col == 0)
|
||||||
geometry.y = way;
|
geometry.x = wax;
|
||||||
else
|
else
|
||||||
geometry.y = way + ((i - curtags[0]->nmaster) % win_by_col) * (geometry.height + 2 * c->border);
|
geometry.x = wax + ((i - curtags[0]->nmaster) % win_by_col) * (geometry.width + 2 * c->border);
|
||||||
|
|
||||||
|
geometry.y = way + current_col * (geometry.height + 2 * c->border) + (right ? mh : 0);
|
||||||
|
}
|
||||||
|
|
||||||
geometry.x = wax + current_col * (geometry.width + 2 * c->border) + (right ? mw : 0);
|
|
||||||
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
client_resize(c, geometry, globalconf.screens[screen].resize_hints);
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -187,13 +232,25 @@ _tile(int screen, const Bool right)
|
||||||
void
|
void
|
||||||
layout_tile(int screen)
|
layout_tile(int screen)
|
||||||
{
|
{
|
||||||
_tile(screen, True);
|
_tile(screen, True, True);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
layout_tileleft(int screen)
|
layout_tileleft(int screen)
|
||||||
{
|
{
|
||||||
_tile(screen, False);
|
_tile(screen, False, True);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
layout_tiledown(int screen)
|
||||||
|
{
|
||||||
|
_tile(screen, True, False);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
layout_tileup(int screen)
|
||||||
|
{
|
||||||
|
_tile(screen, False, False);
|
||||||
}
|
}
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
|
|
||||||
LayoutArrange layout_tile;
|
LayoutArrange layout_tile;
|
||||||
LayoutArrange layout_tileleft;
|
LayoutArrange layout_tileleft;
|
||||||
|
LayoutArrange layout_tiledown;
|
||||||
|
LayoutArrange layout_tileup;
|
||||||
|
|
||||||
Uicb uicb_tag_setnmaster;
|
Uicb uicb_tag_setnmaster;
|
||||||
Uicb uicb_tag_setncol;
|
Uicb uicb_tag_setncol;
|
||||||
|
|
16
mouse.c
16
mouse.c
|
@ -138,7 +138,8 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
ocy = c->geometry.y;
|
ocy = c->geometry.y;
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
}
|
}
|
||||||
else if (layout->arrange == layout_tile || layout->arrange == layout_tileleft)
|
else if (layout->arrange == layout_tile || layout->arrange == layout_tileleft
|
||||||
|
|| layout->arrange == layout_tiledown || layout->arrange == layout_tileup)
|
||||||
{
|
{
|
||||||
for(n = 0, c = globalconf.clients; c; c = c->next)
|
for(n = 0, c = globalconf.clients; c; c = c->next)
|
||||||
if(IS_TILED(c, screen))
|
if(IS_TILED(c, screen))
|
||||||
|
@ -165,6 +166,10 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
|
|
||||||
if(curtags[0]->layout->arrange == layout_tileleft)
|
if(curtags[0]->layout->arrange == layout_tileleft)
|
||||||
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, 0, c->geometry.height + c->border - 1);
|
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, 0, c->geometry.height + c->border - 1);
|
||||||
|
else if(curtags[0]->layout->arrange == layout_tiledown)
|
||||||
|
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, c->geometry.height + c->border - 1);
|
||||||
|
else if(curtags[0]->layout->arrange == layout_tileup)
|
||||||
|
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, 0);
|
||||||
else
|
else
|
||||||
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, c->geometry.height + c->border - 1);
|
XWarpPointer(globalconf.display, None, c->win, 0, 0, 0, 0, c->geometry.width + c->border - 1, c->geometry.height + c->border - 1);
|
||||||
|
|
||||||
|
@ -196,12 +201,17 @@ uicb_client_resizemouse(int screen, char *arg __attribute__ ((unused)))
|
||||||
geometry.y = c->geometry.y;
|
geometry.y = c->geometry.y;
|
||||||
client_resize(c, geometry, True);
|
client_resize(c, geometry, True);
|
||||||
}
|
}
|
||||||
else if(layout->arrange == layout_tile || layout->arrange == layout_tileleft)
|
else if(layout->arrange == layout_tile || layout->arrange == layout_tileleft
|
||||||
|
|| layout->arrange == layout_tileup || layout->arrange == layout_tiledown)
|
||||||
{
|
{
|
||||||
if(layout->arrange == layout_tile)
|
if(layout->arrange == layout_tile)
|
||||||
mwfact = (double) (ev.xmotion.x - area.x) / area.width;
|
mwfact = (double) (ev.xmotion.x - area.x) / area.width;
|
||||||
else
|
else if(curtags[0]->layout->arrange == layout_tileleft)
|
||||||
mwfact = 1 - (double) (ev.xmotion.x - area.x) / area.width;
|
mwfact = 1 - (double) (ev.xmotion.x - area.x) / area.width;
|
||||||
|
else if(curtags[0]->layout->arrange == layout_tiledown)
|
||||||
|
mwfact = (double) (ev.xmotion.y - area.y) / area.height;
|
||||||
|
else
|
||||||
|
mwfact = 1 - (double) (ev.xmotion.y - area.y) / area.height;
|
||||||
if(mwfact < 0.1) mwfact = 0.1;
|
if(mwfact < 0.1) mwfact = 0.1;
|
||||||
else if(mwfact > 0.9) mwfact = 0.9;
|
else if(mwfact > 0.9) mwfact = 0.9;
|
||||||
if(fabs(curtags[0]->mwfact - mwfact) >= 0.05)
|
if(fabs(curtags[0]->mwfact - mwfact) >= 0.05)
|
||||||
|
|
Loading…
Reference in New Issue