add spiral and dwindle layouts (fibonacci)
This commit is contained in:
parent
f92772953c
commit
b9320be372
2
Makefile
2
Makefile
|
@ -41,7 +41,7 @@ defconfig.h: awesomerc
|
|||
@echo generating defconfig.h from awesomerc
|
||||
@echo "#define AWESOME_DEFAULT_CONFIG \\" > defconfig.h
|
||||
@echo -n "\"" >> defconfig.h
|
||||
@sed 's/$$/ \\/;s/"/\\"/g' awesomerc >> defconfig.h
|
||||
@sed 's,\\,\\\\,g;s/$$/ \\/;s/"/\\"/g' awesomerc >> defconfig.h
|
||||
@echo "\"" >> defconfig.h
|
||||
|
||||
awesome: defconfig.h ${OBJ}
|
||||
|
|
|
@ -17,6 +17,8 @@ screen 0
|
|||
layout tile { symbol = "[]=" }
|
||||
layout tileleft { symbol = "=[]" }
|
||||
layout max { symbol = "[ ]" }
|
||||
layout spiral { symbol = "(@)" }
|
||||
layout dwindle { symbol = "[\\]" }
|
||||
layout floating { symbol = "><>" }
|
||||
}
|
||||
}
|
||||
|
|
3
config.c
3
config.c
|
@ -35,6 +35,7 @@
|
|||
#include "layouts/tile.h"
|
||||
#include "layouts/floating.h"
|
||||
#include "layouts/max.h"
|
||||
#include "layouts/fibonacci.h"
|
||||
#include "defconfig.h"
|
||||
|
||||
#define AWESOME_CONFIG_FILE ".awesomerc"
|
||||
|
@ -88,6 +89,8 @@ static const NameFuncLink LayoutsList[] =
|
|||
{"tile", layout_tile},
|
||||
{"tileleft", layout_tileleft},
|
||||
{"max", layout_max},
|
||||
{"spiral", layout_spiral},
|
||||
{"dwindle", layout_dwindle},
|
||||
{"floating", layout_floating},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
@ -5,7 +5,7 @@ RELEASE = "Productivity Breaker"
|
|||
# Customize below to fit your system
|
||||
|
||||
# additional layouts
|
||||
LAYOUTS = layouts/tile.c layouts/floating.c layouts/max.c
|
||||
LAYOUTS = layouts/tile.c layouts/floating.c layouts/max.c layouts/fibonacci.c
|
||||
|
||||
# paths
|
||||
PREFIX = /usr/local
|
||||
|
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* fibonacci.c - fibonacci layout
|
||||
*
|
||||
* Copyright © 2007 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#include "screen.h"
|
||||
#include "tag.h"
|
||||
#include "util.h"
|
||||
#include "layouts/fibonacci.h"
|
||||
|
||||
static void
|
||||
layout_fibonacci(awesome_config *awesomeconf, int screen, int shape)
|
||||
{
|
||||
int n = 0, i = 0, nx, ny, nw, nh;
|
||||
Client *c;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen,
|
||||
&awesomeconf->screens[screen].statusbar,
|
||||
&awesomeconf->screens[screen].padding);
|
||||
|
||||
nx = si[screen].x_org;
|
||||
ny = si[screen].y_org;
|
||||
nw = si[screen].width;
|
||||
nh = si[screen].height;
|
||||
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
n++;
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, &awesomeconf->screens[screen], screen))
|
||||
{
|
||||
c->ismax = False;
|
||||
if((i % 2 && nh / 2 > 2 * c->border)
|
||||
|| (!(i % 2) && nw / 2 > 2 * c->border))
|
||||
{
|
||||
if(i < n - 1)
|
||||
{
|
||||
if(i % 2)
|
||||
nh /= 2;
|
||||
else
|
||||
nw /= 2;
|
||||
if((i % 4) == 2 && !shape)
|
||||
nx += nw;
|
||||
else if((i % 4) == 3 && !shape)
|
||||
ny += nh;
|
||||
}
|
||||
if((i % 4) == 0)
|
||||
{
|
||||
if(shape)
|
||||
ny += nh;
|
||||
else
|
||||
ny -= nh;
|
||||
}
|
||||
else if((i % 4) == 1)
|
||||
nx += nw;
|
||||
else if((i % 4) == 2)
|
||||
ny += nh;
|
||||
else if((i % 4) == 3)
|
||||
{
|
||||
if(shape)
|
||||
nx += nw;
|
||||
else
|
||||
nx -= nw;
|
||||
}
|
||||
if(i == 0)
|
||||
ny = si[screen].y_org;
|
||||
i++;
|
||||
}
|
||||
client_resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, awesomeconf,
|
||||
awesomeconf->screens[screen].resize_hints, False);
|
||||
}
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
void
|
||||
layout_spiral(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
layout_fibonacci(awesomeconf, screen, 0);
|
||||
}
|
||||
|
||||
void
|
||||
layout_dwindle(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
layout_fibonacci(awesomeconf, screen, 1);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
|
@ -0,0 +1,31 @@
|
|||
/*
|
||||
* fibonacci.h - fibonacci layout header
|
||||
*
|
||||
* Copyright © 2007 Julien Danjou <julien@danjou.info>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef AWESOME_FIBONACCI_H
|
||||
#define AWESOME_FIBONACCI_H
|
||||
|
||||
#include "common.h"
|
||||
|
||||
LAYOUT_PROTO(layout_spiral);
|
||||
LAYOUT_PROTO(layout_dwindle);
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
Loading…
Reference in New Issue