add three-column layout
parent
59a2a171d5
commit
65ac6765ae
8
config.h
8
config.h
|
|
@ -1,6 +1,7 @@
|
||||||
/* See LICENSE file for copyright and license details. */
|
/* See LICENSE file for copyright and license details. */
|
||||||
|
|
||||||
#include <X11/XF86keysym.h>
|
#include <X11/XF86keysym.h>
|
||||||
|
#include "tcl.c"
|
||||||
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const unsigned int borderpx = 0; /* border pixel of windows */
|
static const unsigned int borderpx = 0; /* border pixel of windows */
|
||||||
|
|
@ -26,7 +27,7 @@ static const char *colors[][3] = {
|
||||||
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
[SchemeSel] = { col_gray4, col_cyan, col_cyan },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *keyboardLayouts[] = { "us", "ru" };
|
static const char *keyboardLayouts[] = { "gb", "ru" };
|
||||||
static int currentKeyboardLayout = 0;
|
static int currentKeyboardLayout = 0;
|
||||||
static void switchKeyboardLayout(const Arg *arg) {
|
static void switchKeyboardLayout(const Arg *arg) {
|
||||||
currentKeyboardLayout = (currentKeyboardLayout + arg->i) % LENGTH(keyboardLayouts);
|
currentKeyboardLayout = (currentKeyboardLayout + arg->i) % LENGTH(keyboardLayouts);
|
||||||
|
|
@ -40,7 +41,7 @@ static void switchKeyboardLayout(const Arg *arg) {
|
||||||
|
|
||||||
static const char *const autostart[] = {
|
static const char *const autostart[] = {
|
||||||
"dwmblocks", NULL,
|
"dwmblocks", NULL,
|
||||||
"setxkbmap", "-layout", "us,ru", NULL,
|
"setxkbmap", "-layout", "gb,ru", NULL,
|
||||||
"bg-set-image", NULL,
|
"bg-set-image", NULL,
|
||||||
"nm-applet", NULL,
|
"nm-applet", NULL,
|
||||||
"blueman-applet", NULL,
|
"blueman-applet", NULL,
|
||||||
|
|
@ -82,8 +83,9 @@ static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen win
|
||||||
static const Layout layouts[] = {
|
static const Layout layouts[] = {
|
||||||
/* symbol arrange function */
|
/* symbol arrange function */
|
||||||
{ "[]=", tile }, /* first entry is default */
|
{ "[]=", tile }, /* first entry is default */
|
||||||
{ "><>", NULL }, /* no layout function means floating behavior */
|
{ "|||", tcl }, /* three-column layout */
|
||||||
{ "[M]", monocle },
|
{ "[M]", monocle },
|
||||||
|
{ "><>", NULL }, /* no layout function means floating behavior */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* key definitions */
|
/* key definitions */
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,74 @@
|
||||||
|
void
|
||||||
|
tcl(Monitor * m)
|
||||||
|
{
|
||||||
|
int x, y, h, w, mw, sw, bdw;
|
||||||
|
unsigned int i, n;
|
||||||
|
Client * c;
|
||||||
|
|
||||||
|
for (n = 0, c = nexttiled(m->clients); c;
|
||||||
|
c = nexttiled(c->next), n++);
|
||||||
|
|
||||||
|
if (n == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
c = nexttiled(m->clients);
|
||||||
|
|
||||||
|
mw = m->mfact * m->ww;
|
||||||
|
sw = (m->ww - mw) / 2;
|
||||||
|
bdw = (2 * c->bw);
|
||||||
|
resize(c,
|
||||||
|
n < 3 ? m->wx : m->wx + sw,
|
||||||
|
m->wy,
|
||||||
|
n == 1 ? m->ww - bdw : mw - bdw,
|
||||||
|
m->wh - bdw,
|
||||||
|
False);
|
||||||
|
|
||||||
|
if (--n == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
w = (m->ww - mw) / ((n > 1) + 1);
|
||||||
|
c = nexttiled(c->next);
|
||||||
|
|
||||||
|
if (n > 1)
|
||||||
|
{
|
||||||
|
x = m->wx + ((n > 1) ? mw + sw : mw);
|
||||||
|
y = m->wy;
|
||||||
|
h = m->wh / (n / 2);
|
||||||
|
|
||||||
|
if (h < bh)
|
||||||
|
h = m->wh;
|
||||||
|
|
||||||
|
for (i = 0; c && i < n / 2; c = nexttiled(c->next), i++)
|
||||||
|
{
|
||||||
|
resize(c,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
w - bdw,
|
||||||
|
(i + 1 == n / 2) ? m->wy + m->wh - y - bdw : h - bdw,
|
||||||
|
False);
|
||||||
|
|
||||||
|
if (h != m->wh)
|
||||||
|
y = c->y + HEIGHT(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
x = (n + 1 / 2) == 1 ? mw : m->wx;
|
||||||
|
y = m->wy;
|
||||||
|
h = m->wh / ((n + 1) / 2);
|
||||||
|
|
||||||
|
if (h < bh)
|
||||||
|
h = m->wh;
|
||||||
|
|
||||||
|
for (i = 0; c; c = nexttiled(c->next), i++)
|
||||||
|
{
|
||||||
|
resize(c,
|
||||||
|
x,
|
||||||
|
y,
|
||||||
|
(i + 1 == (n + 1) / 2) ? w - bdw : w - bdw,
|
||||||
|
(i + 1 == (n + 1) / 2) ? m->wy + m->wh - y - bdw : h - bdw,
|
||||||
|
False);
|
||||||
|
|
||||||
|
if (h != m->wh)
|
||||||
|
y = c->y + HEIGHT(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue