layout: move layout code to Lua
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
bf7bae8082
commit
2037a053a9
|
@ -71,12 +71,6 @@ set(AWE_SRCS
|
||||||
${SOURCE_DIR}/common/xembed.c
|
${SOURCE_DIR}/common/xembed.c
|
||||||
${SOURCE_DIR}/common/xutil.c
|
${SOURCE_DIR}/common/xutil.c
|
||||||
${SOURCE_DIR}/common/xcursor.c
|
${SOURCE_DIR}/common/xcursor.c
|
||||||
${SOURCE_DIR}/layouts/fibonacci.c
|
|
||||||
${SOURCE_DIR}/layouts/floating.c
|
|
||||||
${SOURCE_DIR}/layouts/magnifier.c
|
|
||||||
${SOURCE_DIR}/layouts/fair.c
|
|
||||||
${SOURCE_DIR}/layouts/max.c
|
|
||||||
${SOURCE_DIR}/layouts/tile.c
|
|
||||||
${SOURCE_DIR}/widgets/graph.c
|
${SOURCE_DIR}/widgets/graph.c
|
||||||
${SOURCE_DIR}/widgets/progressbar.c
|
${SOURCE_DIR}/widgets/progressbar.c
|
||||||
${SOURCE_DIR}/widgets/textbox.c
|
${SOURCE_DIR}/widgets/textbox.c
|
||||||
|
@ -117,16 +111,6 @@ target_link_libraries(${PROJECT_AWECLIENT_NAME}
|
||||||
${AWESOMECLIENT_LIBRARIES})
|
${AWESOMECLIENT_LIBRARIES})
|
||||||
|
|
||||||
# {{{ Generated sources
|
# {{{ Generated sources
|
||||||
file(GLOB LAYOUTGEN_DEPS ${SOURCE_DIR}/layouts/*.h)
|
|
||||||
add_custom_command(
|
|
||||||
COMMAND ${SOURCE_DIR}/build-utils/layoutgen.sh
|
|
||||||
ARGS > ${BUILD_DIR}/layoutgen.h
|
|
||||||
OUTPUT ${BUILD_DIR}/layoutgen.h
|
|
||||||
WORKING_DIRECTORY ${SOURCE_DIR}
|
|
||||||
DEPENDS ${LAYOUTGEN_DEPS}
|
|
||||||
COMMENT "Generating layoutgen.h"
|
|
||||||
VERBATIM)
|
|
||||||
|
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
COMMAND ${SOURCE_DIR}/build-utils/widgetgen.sh
|
COMMAND ${SOURCE_DIR}/build-utils/widgetgen.sh
|
||||||
ARGS > ${BUILD_DIR}/widgetgen.h
|
ARGS > ${BUILD_DIR}/widgetgen.h
|
||||||
|
@ -177,7 +161,6 @@ add_custom_command(
|
||||||
|
|
||||||
add_custom_target(generated_sources
|
add_custom_target(generated_sources
|
||||||
DEPENDS ${BUILD_DIR}/widgetgen.h
|
DEPENDS ${BUILD_DIR}/widgetgen.h
|
||||||
${BUILD_DIR}/layoutgen.h
|
|
||||||
${BUILD_DIR}/common/atoms-intern.h
|
${BUILD_DIR}/common/atoms-intern.h
|
||||||
${BUILD_DIR}/common/atoms-extern.h
|
${BUILD_DIR}/common/atoms-extern.h
|
||||||
${BUILD_DIR}/common/tokenize.c
|
${BUILD_DIR}/common/tokenize.c
|
||||||
|
|
|
@ -95,8 +95,6 @@ FILE_PATTERNS = *.c \
|
||||||
common/*.h \
|
common/*.h \
|
||||||
widgets/*.c \
|
widgets/*.c \
|
||||||
widgets/*.h \
|
widgets/*.h \
|
||||||
layouts/*.c \
|
|
||||||
layouts/*.h
|
|
||||||
RECURSIVE = YES
|
RECURSIVE = YES
|
||||||
EXCLUDE =
|
EXCLUDE =
|
||||||
EXCLUDE_SYMLINKS = NO
|
EXCLUDE_SYMLINKS = NO
|
||||||
|
|
|
@ -30,18 +30,16 @@ modkey = "Mod4"
|
||||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||||
layouts =
|
layouts =
|
||||||
{
|
{
|
||||||
"tile",
|
awful.layout.suit.tile,
|
||||||
"tileleft",
|
awful.layout.suit.tile.left,
|
||||||
"tilebottom",
|
awful.layout.suit.tile.bottom,
|
||||||
"tiletop",
|
awful.layout.suit.tile.top,
|
||||||
"fairh",
|
awful.layout.suit.fair,
|
||||||
"fairv",
|
awful.layout.suit.fair.horizontal,
|
||||||
"magnifier",
|
awful.layout.suit.max,
|
||||||
"max",
|
awful.layout.suit.max.fullscreen,
|
||||||
"fullscreen",
|
awful.layout.suit.magnifier,
|
||||||
"spiral",
|
awful.layout.suit.floating
|
||||||
"dwindle",
|
|
||||||
"floating"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- Table of clients that should be set floating. The index may be either
|
-- Table of clients that should be set floating. The index may be either
|
||||||
|
@ -78,7 +76,7 @@ for s = 1, screen.count() do
|
||||||
tags[s] = {}
|
tags[s] = {}
|
||||||
-- Create 9 tags per screen.
|
-- Create 9 tags per screen.
|
||||||
for tagnumber = 1, 9 do
|
for tagnumber = 1, 9 do
|
||||||
tags[s][tagnumber] = tag({ name = tagnumber, layout = layouts[1] })
|
tags[s][tagnumber] = tag(tagnumber)
|
||||||
-- Add tags to screen one by one
|
-- Add tags to screen one by one
|
||||||
tags[s][tagnumber].screen = s
|
tags[s][tagnumber].screen = s
|
||||||
end
|
end
|
||||||
|
@ -320,7 +318,7 @@ end)
|
||||||
-- Hook function to execute when the mouse enters a client.
|
-- Hook function to execute when the mouse enters a client.
|
||||||
awful.hooks.mouse_enter.register(function (c)
|
awful.hooks.mouse_enter.register(function (c)
|
||||||
-- Sloppy focus, but disabled for magnifier layout
|
-- Sloppy focus, but disabled for magnifier layout
|
||||||
if awful.layout.get(c.screen) ~= "magnifier"
|
if awful.layout.get(c.screen) ~= awful.layout.suit.magnifier
|
||||||
and awful.client.focus.filter(c) then
|
and awful.client.focus.filter(c) then
|
||||||
client.focus = c
|
client.focus = c
|
||||||
end
|
end
|
||||||
|
@ -378,8 +376,8 @@ end)
|
||||||
-- Hook function to execute when arranging the screen.
|
-- Hook function to execute when arranging the screen.
|
||||||
-- (tag switch, new client, etc)
|
-- (tag switch, new client, etc)
|
||||||
awful.hooks.arrange.register(function (screen)
|
awful.hooks.arrange.register(function (screen)
|
||||||
local layout = awful.layout.get(screen)
|
local layout = awful.layout.getname(awful.layout.get(screen))
|
||||||
if layout then
|
if layout and beautiful["layout_" ..layout] then
|
||||||
mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
|
mylayoutbox[screen].image = image(beautiful["layout_" .. layout])
|
||||||
else
|
else
|
||||||
mylayoutbox[screen].image = nil
|
mylayoutbox[screen].image = nil
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
top_srcdir="${1-.}"
|
|
||||||
echo "/* This file is autogenerated by" `basename $0` "*/"
|
|
||||||
echo
|
|
||||||
for file in ${top_srcdir}/layouts/*.h
|
|
||||||
do
|
|
||||||
shortname=`echo $file | cut -f2- -d/`
|
|
||||||
echo "#include \"${shortname}\""
|
|
||||||
done
|
|
||||||
echo
|
|
||||||
echo "const name_func_link_t LayoutList[] ="
|
|
||||||
echo "{"
|
|
||||||
for file in ${top_srcdir}/layouts/*.h
|
|
||||||
do
|
|
||||||
echo " /* $file */"
|
|
||||||
grep '^layout_t layout_' $file | cut -d' ' -f2 | cut -d\; -f1 | while read layout
|
|
||||||
do
|
|
||||||
shortname=`echo $layout | cut -d _ -f2-`
|
|
||||||
echo " {\"$shortname\", sizeof(\"$shortname\") - 1, $layout},"
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
echo " {NULL, 0, NULL}"
|
|
||||||
echo "};"
|
|
66
client.c
66
client.c
|
@ -29,7 +29,7 @@
|
||||||
#include "titlebar.h"
|
#include "titlebar.h"
|
||||||
#include "systray.h"
|
#include "systray.h"
|
||||||
#include "property.h"
|
#include "property.h"
|
||||||
#include "layouts/floating.h"
|
#include "wibox.h"
|
||||||
#include "common/markup.h"
|
#include "common/markup.h"
|
||||||
#include "common/atoms.h"
|
#include "common/atoms.h"
|
||||||
|
|
||||||
|
@ -625,10 +625,6 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
{
|
{
|
||||||
int new_screen;
|
int new_screen;
|
||||||
area_t area;
|
area_t area;
|
||||||
layout_t *layout = layout_get_current(c->screen);
|
|
||||||
|
|
||||||
if(c->titlebar && c->titlebar->isvisible && !client_isfloating(c) && layout != layout_floating)
|
|
||||||
geometry = titlebar_geometry_remove(c->titlebar, c->border, geometry);
|
|
||||||
|
|
||||||
if(hints)
|
if(hints)
|
||||||
geometry = client_geometry_hints(c, geometry);
|
geometry = client_geometry_hints(c, geometry);
|
||||||
|
@ -668,12 +664,10 @@ client_resize(client_t *c, area_t geometry, bool hints)
|
||||||
/* save the floating geometry if the window is floating but not
|
/* save the floating geometry if the window is floating but not
|
||||||
* maximized */
|
* maximized */
|
||||||
if(client_isfloating(c)
|
if(client_isfloating(c)
|
||||||
|| layout_get_current(new_screen) == layout_floating
|
&& !(c->isfullscreen || c->ismaxvert || c->ismaxhoriz))
|
||||||
|| layout_get_current(c->screen) == layout_floating)
|
c->geometries.floating = geometry;
|
||||||
if(!c->isfullscreen && !c->ismaxvert && !c->ismaxhoriz)
|
|
||||||
c->geometries.floating = geometry;
|
|
||||||
|
|
||||||
titlebar_update_geometry_floating(c);
|
titlebar_update_geometry(c);
|
||||||
|
|
||||||
/* The idea is to give a client a resize even when banned. */
|
/* The idea is to give a client a resize even when banned. */
|
||||||
/* We just have to move the (x,y) to keep it out of the viewport. */
|
/* We just have to move the (x,y) to keep it out of the viewport. */
|
||||||
|
@ -1171,13 +1165,7 @@ client_setborder(client_t *c, int width)
|
||||||
xcb_configure_window(globalconf.connection, c->win,
|
xcb_configure_window(globalconf.connection, c->win,
|
||||||
XCB_CONFIG_WINDOW_BORDER_WIDTH, &w);
|
XCB_CONFIG_WINDOW_BORDER_WIDTH, &w);
|
||||||
|
|
||||||
if(client_isvisible(c, c->screen))
|
client_need_arrange(c);
|
||||||
{
|
|
||||||
if(client_isfloating(c) || layout_get_current(c->screen) == layout_floating)
|
|
||||||
titlebar_update_geometry_floating(c);
|
|
||||||
else
|
|
||||||
globalconf.screens[c->screen].need_arrange = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
hooks_property(c, "border_width");
|
hooks_property(c, "border_width");
|
||||||
}
|
}
|
||||||
|
@ -1339,30 +1327,30 @@ luaA_client_handlegeom(lua_State *L, bool full)
|
||||||
client_t **c = luaA_checkudata(L, 1, "client");
|
client_t **c = luaA_checkudata(L, 1, "client");
|
||||||
|
|
||||||
if(lua_gettop(L) == 2)
|
if(lua_gettop(L) == 2)
|
||||||
if(client_isfloating(*c)
|
{
|
||||||
|| layout_get_current((*c)->screen) == layout_floating)
|
area_t geometry;
|
||||||
{
|
|
||||||
area_t geometry;
|
|
||||||
|
|
||||||
luaA_checktable(L, 2);
|
luaA_checktable(L, 2);
|
||||||
geometry.x = luaA_getopt_number(L, 2, "x", (*c)->geometry.x);
|
geometry.x = luaA_getopt_number(L, 2, "x", (*c)->geometry.x);
|
||||||
geometry.y = luaA_getopt_number(L, 2, "y", (*c)->geometry.y);
|
geometry.y = luaA_getopt_number(L, 2, "y", (*c)->geometry.y);
|
||||||
if(client_isfixed(*c))
|
if(client_isfixed(*c))
|
||||||
{
|
{
|
||||||
geometry.width = (*c)->geometry.width;
|
geometry.width = (*c)->geometry.width;
|
||||||
geometry.height = (*c)->geometry.height;
|
geometry.height = (*c)->geometry.height;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
geometry.width = luaA_getopt_number(L, 2, "width", (*c)->geometry.width);
|
|
||||||
geometry.height = luaA_getopt_number(L, 2, "height", (*c)->geometry.height);
|
|
||||||
}
|
|
||||||
if(full)
|
|
||||||
geometry = titlebar_geometry_remove((*c)->titlebar,
|
|
||||||
(*c)->border,
|
|
||||||
geometry);
|
|
||||||
client_resize(*c, geometry, (*c)->honorsizehints);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
geometry.width = luaA_getopt_number(L, 2, "width", (*c)->geometry.width);
|
||||||
|
geometry.height = luaA_getopt_number(L, 2, "height", (*c)->geometry.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(full)
|
||||||
|
geometry = titlebar_geometry_remove((*c)->titlebar,
|
||||||
|
(*c)->border,
|
||||||
|
geometry);
|
||||||
|
|
||||||
|
client_resize(*c, geometry, (*c)->honorsizehints);
|
||||||
|
}
|
||||||
|
|
||||||
if(full)
|
if(full)
|
||||||
return luaA_pusharea(L, titlebar_geometry_add((*c)->titlebar,
|
return luaA_pusharea(L, titlebar_geometry_add((*c)->titlebar,
|
||||||
|
|
|
@ -7,8 +7,6 @@ border_color
|
||||||
border_padding
|
border_padding
|
||||||
border_width
|
border_width
|
||||||
bottom
|
bottom
|
||||||
bottomleft
|
|
||||||
bottomright
|
|
||||||
button
|
button
|
||||||
center
|
center
|
||||||
char
|
char
|
||||||
|
@ -16,7 +14,6 @@ class
|
||||||
client
|
client
|
||||||
color
|
color
|
||||||
Control
|
Control
|
||||||
coords
|
|
||||||
conffile
|
conffile
|
||||||
Ctrl
|
Ctrl
|
||||||
cursor
|
cursor
|
||||||
|
@ -39,9 +36,6 @@ icon
|
||||||
icon_name
|
icon_name
|
||||||
image
|
image
|
||||||
instance
|
instance
|
||||||
invert
|
|
||||||
label
|
|
||||||
layout
|
|
||||||
left
|
left
|
||||||
len
|
len
|
||||||
line
|
line
|
||||||
|
@ -59,10 +53,7 @@ Mod4
|
||||||
Mod5
|
Mod5
|
||||||
mouse_enter
|
mouse_enter
|
||||||
mouse_leave
|
mouse_leave
|
||||||
mwfact
|
|
||||||
name
|
name
|
||||||
ncol
|
|
||||||
nmaster
|
|
||||||
on
|
on
|
||||||
ontop
|
ontop
|
||||||
opacity
|
opacity
|
||||||
|
@ -81,7 +72,6 @@ selected
|
||||||
shadow
|
shadow
|
||||||
shadow_offset
|
shadow_offset
|
||||||
Shift
|
Shift
|
||||||
show_icons
|
|
||||||
size_hints
|
size_hints
|
||||||
skip_taskbar
|
skip_taskbar
|
||||||
south
|
south
|
||||||
|
@ -92,8 +82,6 @@ ticks_count
|
||||||
ticks_gap
|
ticks_gap
|
||||||
titlebar
|
titlebar
|
||||||
top
|
top
|
||||||
topleft
|
|
||||||
topright
|
|
||||||
transient_for
|
transient_for
|
||||||
true
|
true
|
||||||
type
|
type
|
||||||
|
|
3
event.c
3
event.c
|
@ -39,7 +39,6 @@
|
||||||
#include "luaa.h"
|
#include "luaa.h"
|
||||||
#include "systray.h"
|
#include "systray.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "layouts/floating.h"
|
|
||||||
#include "common/atoms.h"
|
#include "common/atoms.h"
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
@ -267,7 +266,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)),
|
||||||
if(geometry.x != c->geometry.x || geometry.y != c->geometry.y
|
if(geometry.x != c->geometry.x || geometry.y != c->geometry.y
|
||||||
|| geometry.width != c->geometry.width || geometry.height != c->geometry.height)
|
|| geometry.width != c->geometry.width || geometry.height != c->geometry.height)
|
||||||
{
|
{
|
||||||
if(client_isfloating(c) || layout_get_current(c->screen) == layout_floating)
|
if(client_isfloating(c))
|
||||||
{
|
{
|
||||||
client_resize(c, geometry, false);
|
client_resize(c, geometry, false);
|
||||||
if(client_hasstrut(c))
|
if(client_hasstrut(c))
|
||||||
|
|
35
layout.c
35
layout.c
|
@ -19,7 +19,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "client.h"
|
#include "layout.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "window.h"
|
#include "window.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
@ -33,7 +33,6 @@ static void
|
||||||
arrange(int screen)
|
arrange(int screen)
|
||||||
{
|
{
|
||||||
client_t *c;
|
client_t *c;
|
||||||
layout_t *curlay = layout_get_current(screen);
|
|
||||||
int phys_screen = screen_virttophys(screen);
|
int phys_screen = screen_virttophys(screen);
|
||||||
xcb_query_pointer_cookie_t qp_c;
|
xcb_query_pointer_cookie_t qp_c;
|
||||||
xcb_query_pointer_reply_t *qp_r;
|
xcb_query_pointer_reply_t *qp_r;
|
||||||
|
@ -47,8 +46,12 @@ arrange(int screen)
|
||||||
client_ban(c);
|
client_ban(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(curlay)
|
/* call hook */
|
||||||
curlay(screen);
|
if(globalconf.hooks.arrange != LUA_REFNIL)
|
||||||
|
{
|
||||||
|
lua_pushnumber(globalconf.L, screen + 1);
|
||||||
|
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
qp_c = xcb_query_pointer_unchecked(globalconf.connection,
|
qp_c = xcb_query_pointer_unchecked(globalconf.connection,
|
||||||
xutil_screen_get(globalconf.connection,
|
xutil_screen_get(globalconf.connection,
|
||||||
|
@ -70,13 +73,6 @@ arrange(int screen)
|
||||||
|
|
||||||
/* reset status */
|
/* reset status */
|
||||||
globalconf.screens[screen].need_arrange = false;
|
globalconf.screens[screen].need_arrange = false;
|
||||||
|
|
||||||
/* call hook */
|
|
||||||
if(globalconf.hooks.arrange != LUA_REFNIL)
|
|
||||||
{
|
|
||||||
lua_pushnumber(globalconf.L, screen + 1);
|
|
||||||
luaA_dofunction(globalconf.L, globalconf.hooks.arrange, 1, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Refresh the screen disposition
|
/** Refresh the screen disposition
|
||||||
|
@ -92,21 +88,4 @@ layout_refresh(void)
|
||||||
arrange(screen);
|
arrange(screen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get current layout used on screen.
|
|
||||||
* \param screen Virtual screen number.
|
|
||||||
* \return layout used on that screen
|
|
||||||
*/
|
|
||||||
layout_t *
|
|
||||||
layout_get_current(int screen)
|
|
||||||
{
|
|
||||||
layout_t *l = NULL;
|
|
||||||
tag_t **curtags = tags_get_current(screen);
|
|
||||||
|
|
||||||
if(curtags[0])
|
|
||||||
l = curtags[0]->layout;
|
|
||||||
p_delete(&curtags);
|
|
||||||
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 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
|
||||||
|
|
6
layout.h
6
layout.h
|
@ -22,12 +22,6 @@
|
||||||
#ifndef AWESOME_LAYOUT_H
|
#ifndef AWESOME_LAYOUT_H
|
||||||
#define AWESOME_LAYOUT_H
|
#define AWESOME_LAYOUT_H
|
||||||
|
|
||||||
#include "common/list.h"
|
|
||||||
#include "common/util.h"
|
|
||||||
|
|
||||||
typedef void (layout_t)(int);
|
|
||||||
|
|
||||||
layout_t * layout_get_current(int);
|
|
||||||
void layout_refresh(void);
|
void layout_refresh(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
101
layouts/fair.c
101
layouts/fair.c
|
@ -1,101 +0,0 @@
|
||||||
/*
|
|
||||||
* fair.c - fair layout
|
|
||||||
*
|
|
||||||
* Copyright © 2008 Alex Cornejo <acornejo@gmail.com>
|
|
||||||
*
|
|
||||||
* 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 "client.h"
|
|
||||||
#include "layouts/fair.h"
|
|
||||||
#include "common/util.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
|
||||||
|
|
||||||
static void
|
|
||||||
layout_fair(int screen, const orientation_t orientation)
|
|
||||||
{
|
|
||||||
int strips=1, cells = 1,
|
|
||||||
strip = 0, cell = 0, n = 0,
|
|
||||||
full_strips;
|
|
||||||
client_t *c;
|
|
||||||
area_t geometry, area;
|
|
||||||
|
|
||||||
area = screen_area_get(screen,
|
|
||||||
&globalconf.screens[screen].wiboxes,
|
|
||||||
&globalconf.screens[screen].padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
for(c = globalconf.clients ; c; c = c->next)
|
|
||||||
if(IS_TILED(c, screen))
|
|
||||||
++n;
|
|
||||||
|
|
||||||
if(n > 0)
|
|
||||||
{
|
|
||||||
while(cells * cells < n)
|
|
||||||
++cells;
|
|
||||||
|
|
||||||
strips = (cells * (cells - 1) >= n) ? cells - 1 : cells;
|
|
||||||
full_strips = n - strips * (cells - 1);
|
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
|
||||||
if(IS_TILED(c, screen))
|
|
||||||
{
|
|
||||||
if (((orientation == East) && (n > 2))
|
|
||||||
|| ((orientation == South) && (n <= 2)))
|
|
||||||
{
|
|
||||||
geometry.width = area.width / cells;
|
|
||||||
geometry.height = area.height / strips;
|
|
||||||
geometry.x = area.x + cell * geometry.width;
|
|
||||||
geometry.y = area.y + strip * geometry.height;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
geometry.width = area.width / strips;
|
|
||||||
geometry.height = area.height / cells;
|
|
||||||
geometry.x = area.x + strip * geometry.width;
|
|
||||||
geometry.y = area.y + cell * geometry.height;
|
|
||||||
}
|
|
||||||
geometry.width -= 2 * c->border;
|
|
||||||
geometry.height -= 2 * c->border;
|
|
||||||
|
|
||||||
client_resize(c, geometry, c->honorsizehints);
|
|
||||||
|
|
||||||
if(++cell == cells)
|
|
||||||
{
|
|
||||||
cell = 0;
|
|
||||||
if(++strip == full_strips)
|
|
||||||
cells--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_fairh(int screen)
|
|
||||||
{
|
|
||||||
layout_fair(screen, East);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_fairv(int screen)
|
|
||||||
{
|
|
||||||
layout_fair(screen, South);
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* fair.h - fair layout header
|
|
||||||
*
|
|
||||||
* Copyright © 2008 Alex Cornejo <acornejo@gmail.com>
|
|
||||||
*
|
|
||||||
* 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_FAIR_H
|
|
||||||
#define AWESOME_FAIR_H
|
|
||||||
|
|
||||||
#include "layout.h"
|
|
||||||
|
|
||||||
layout_t layout_fairh;
|
|
||||||
layout_t layout_fairv;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,102 +0,0 @@
|
||||||
/*
|
|
||||||
* fibonacci.c - fibonacci layout
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 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 "client.h"
|
|
||||||
#include "layouts/fibonacci.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
|
||||||
|
|
||||||
static void
|
|
||||||
layout_fibonacci(int screen, int shape)
|
|
||||||
{
|
|
||||||
int n = 0, i = 0;
|
|
||||||
client_t *c;
|
|
||||||
area_t geometry, area;
|
|
||||||
geometry = area = screen_area_get(screen,
|
|
||||||
&globalconf.screens[screen].wiboxes,
|
|
||||||
&globalconf.screens[screen].padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
|
||||||
if(IS_TILED(c, screen))
|
|
||||||
n++;
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
|
||||||
if(IS_TILED(c, screen))
|
|
||||||
{
|
|
||||||
if((i % 2 && geometry.height / 2 > 2 * c->border)
|
|
||||||
|| (!(i % 2) && geometry.width / 2 > 2 * c->border))
|
|
||||||
{
|
|
||||||
if(i < n - 1)
|
|
||||||
{
|
|
||||||
if(i % 2)
|
|
||||||
geometry.height /= 2;
|
|
||||||
else
|
|
||||||
geometry.width /= 2;
|
|
||||||
if((i % 4) == 2 && !shape)
|
|
||||||
geometry.x += geometry.width;
|
|
||||||
else if((i % 4) == 3 && !shape)
|
|
||||||
geometry.y += geometry.height;
|
|
||||||
}
|
|
||||||
if((i % 4) == 0)
|
|
||||||
{
|
|
||||||
if(shape)
|
|
||||||
geometry.y += geometry.height;
|
|
||||||
else
|
|
||||||
geometry.y -= geometry.height;
|
|
||||||
}
|
|
||||||
else if((i % 4) == 1)
|
|
||||||
geometry.x += geometry.width;
|
|
||||||
else if((i % 4) == 2)
|
|
||||||
geometry.y += geometry.height;
|
|
||||||
else if((i % 4) == 3)
|
|
||||||
{
|
|
||||||
if(shape)
|
|
||||||
geometry.x += geometry.width;
|
|
||||||
else
|
|
||||||
geometry.x -= geometry.width;
|
|
||||||
}
|
|
||||||
if(i == 0)
|
|
||||||
geometry.y = area.y;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
geometry.width -= 2 * c->border;
|
|
||||||
geometry.height -= 2 * c->border;
|
|
||||||
client_resize(c, geometry, c->honorsizehints);
|
|
||||||
geometry.width += 2 * c->border;
|
|
||||||
geometry.height += 2 * c->border;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_spiral(int screen)
|
|
||||||
{
|
|
||||||
layout_fibonacci(screen, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_dwindle(int screen)
|
|
||||||
{
|
|
||||||
layout_fibonacci(screen, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* fibonacci.h - fibonacci layout header
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 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 "layout.h"
|
|
||||||
|
|
||||||
layout_t layout_spiral;
|
|
||||||
layout_t layout_dwindle;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,37 +0,0 @@
|
||||||
/*
|
|
||||||
* floating.c - floating layout
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 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 "client.h"
|
|
||||||
#include "tag.h"
|
|
||||||
#include "layouts/floating.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_floating(int screen)
|
|
||||||
{
|
|
||||||
client_t *c;
|
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
|
||||||
if(client_isvisible(c, screen) && !c->isfullscreen)
|
|
||||||
client_resize(c, c->geometries.floating, false);
|
|
||||||
}
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* floating.h - floating layout header
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
|
||||||
* Copyright © 2007 Alexandru E. Ungur <grid@rb.no-ip.biz>
|
|
||||||
*
|
|
||||||
* 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_FLOATING_H
|
|
||||||
#define AWESOME_FLOATING_H
|
|
||||||
|
|
||||||
#include "layout.h"
|
|
||||||
|
|
||||||
layout_t layout_floating;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,106 +0,0 @@
|
||||||
/*
|
|
||||||
* magnifier.c - magnifier layout
|
|
||||||
*
|
|
||||||
* Copyright © 2008 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 <math.h>
|
|
||||||
|
|
||||||
#include "client.h"
|
|
||||||
#include "tag.h"
|
|
||||||
#include "screen.h"
|
|
||||||
#include "layouts/magnifier.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_magnifier(int screen)
|
|
||||||
{
|
|
||||||
int n = 0;
|
|
||||||
client_t *c, *focus;
|
|
||||||
tag_t **curtags = tags_get_current(screen);
|
|
||||||
area_t geometry, area = screen_area_get(screen,
|
|
||||||
&globalconf.screens[screen].wiboxes,
|
|
||||||
&globalconf.screens[screen].padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
focus = globalconf.screens[screen].client_focus;
|
|
||||||
|
|
||||||
/* Find parent of this window, if it has one. */
|
|
||||||
if (!IS_TILED(focus, screen) && focus && focus->transient_for)
|
|
||||||
do {
|
|
||||||
focus = focus->transient_for;
|
|
||||||
} while (focus->transient_for != NULL);
|
|
||||||
|
|
||||||
/* If focused window is not tiled, take the first one which is tiled. */
|
|
||||||
if(!IS_TILED(focus, screen))
|
|
||||||
for(focus = globalconf.clients; focus && !IS_TILED(focus, screen); focus = focus->next);
|
|
||||||
|
|
||||||
/* No windows is tiled, nothing to do. */
|
|
||||||
if(!focus)
|
|
||||||
goto bailout;
|
|
||||||
|
|
||||||
for(c = client_list_prev_cycle(&globalconf.clients, focus);
|
|
||||||
c && c != focus;
|
|
||||||
c = client_list_prev_cycle(&globalconf.clients, c))
|
|
||||||
if(IS_TILED(c, screen) && c != focus)
|
|
||||||
n++;
|
|
||||||
|
|
||||||
if(n)
|
|
||||||
{
|
|
||||||
geometry.width = area.width * sqrt(curtags[0]->mwfact);
|
|
||||||
geometry.height = area.height * sqrt(curtags[0]->mwfact);
|
|
||||||
geometry.x = area.x + (area.width - geometry.width) / 2;
|
|
||||||
geometry.y = area.y + (area.height - geometry.height) / 2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
/* No other clients. */
|
|
||||||
geometry = area;
|
|
||||||
geometry.width -= 2 * focus->border;
|
|
||||||
geometry.height -= 2 * focus->border;
|
|
||||||
}
|
|
||||||
client_resize(focus, geometry, focus->honorsizehints);
|
|
||||||
client_raise(focus);
|
|
||||||
|
|
||||||
/* bailout when there is only one window */
|
|
||||||
if (!n)
|
|
||||||
goto bailout;
|
|
||||||
|
|
||||||
geometry.x = area.x;
|
|
||||||
geometry.y = area.y;
|
|
||||||
geometry.height = area.height / n;
|
|
||||||
geometry.width = area.width;
|
|
||||||
|
|
||||||
for(c = client_list_prev_cycle(&globalconf.clients, focus);
|
|
||||||
c && c != focus;
|
|
||||||
c = client_list_prev_cycle(&globalconf.clients, c))
|
|
||||||
if(IS_TILED(c, screen) && c != focus)
|
|
||||||
{
|
|
||||||
geometry.height -= 2 * c->border;
|
|
||||||
geometry.width -= 2 * c->border;
|
|
||||||
client_resize(c, geometry, c->honorsizehints);
|
|
||||||
geometry.height += 2 * c->border;
|
|
||||||
geometry.width += 2 * c->border;
|
|
||||||
geometry.y += geometry.height;
|
|
||||||
}
|
|
||||||
|
|
||||||
bailout:
|
|
||||||
p_delete(&curtags);
|
|
||||||
}
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* magnifier.h - magnifier layout header
|
|
||||||
*
|
|
||||||
* Copyright © 2008 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_LAYOUTS_MAGNIFIER_H
|
|
||||||
#define AWESOME_LAYOUTS_MAGNIFIER_H
|
|
||||||
|
|
||||||
#include "layout.h"
|
|
||||||
|
|
||||||
layout_t layout_magnifier;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* max.c - max layout
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 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 "tag.h"
|
|
||||||
#include "screen.h"
|
|
||||||
#include "client.h"
|
|
||||||
#include "layouts/max.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
|
||||||
|
|
||||||
static void
|
|
||||||
layout_fmax(int screen, bool fs)
|
|
||||||
{
|
|
||||||
client_t *c;
|
|
||||||
int phys_screen = screen_virttophys(screen);
|
|
||||||
area_t area = screen_area_get(screen,
|
|
||||||
fs ? NULL : &globalconf.screens[screen].wiboxes,
|
|
||||||
fs ? NULL : &globalconf.screens[screen].padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
for(c = globalconf.clients; c; c = c->next)
|
|
||||||
if(IS_TILED(c, screen))
|
|
||||||
{
|
|
||||||
area.width -= 2 * c->border;
|
|
||||||
area.height -= 2 * c->border;
|
|
||||||
client_resize(c, area, false);
|
|
||||||
area.width += 2 * c->border;
|
|
||||||
area.height += 2 * c->border;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(IS_TILED(globalconf.screens[phys_screen].client_focus, screen))
|
|
||||||
client_raise(globalconf.screens[phys_screen].client_focus);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_max(int screen)
|
|
||||||
{
|
|
||||||
return layout_fmax(screen, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_fullscreen(int screen)
|
|
||||||
{
|
|
||||||
return layout_fmax(screen, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,31 +0,0 @@
|
||||||
/*
|
|
||||||
* max.h - max layout header
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 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_MAX_H
|
|
||||||
#define AWESOME_MAX_H
|
|
||||||
|
|
||||||
#include "layout.h"
|
|
||||||
|
|
||||||
layout_t layout_max;
|
|
||||||
layout_t layout_fullscreen;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
214
layouts/tile.c
214
layouts/tile.c
|
@ -1,214 +0,0 @@
|
||||||
/*
|
|
||||||
* tile.c - tile layout
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 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 <stdio.h>
|
|
||||||
|
|
||||||
#include "screen.h"
|
|
||||||
#include "tag.h"
|
|
||||||
#include "client.h"
|
|
||||||
#include "layouts/tile.h"
|
|
||||||
#include "common/util.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
|
||||||
|
|
||||||
static void
|
|
||||||
_tile(int screen, const position_t position)
|
|
||||||
{
|
|
||||||
/* windows area geometry */
|
|
||||||
int wah = 0, waw = 0, wax = 0, way = 0;
|
|
||||||
/* master size */
|
|
||||||
unsigned int mw = 0, mh = 0;
|
|
||||||
int n, i, masterwin = 0, otherwin = 0;
|
|
||||||
int real_ncol = 1, win_by_col = 1, current_col = 0;
|
|
||||||
int small_ncol, adj_win_by_col;
|
|
||||||
area_t area, geometry = { 0, 0, 0, 0 };
|
|
||||||
client_t *c;
|
|
||||||
tag_t **curtags = tags_get_current(screen);
|
|
||||||
|
|
||||||
area = screen_area_get(screen,
|
|
||||||
&globalconf.screens[screen].wiboxes,
|
|
||||||
&globalconf.screens[screen].padding,
|
|
||||||
true);
|
|
||||||
|
|
||||||
for(n = 0, c = globalconf.clients; c; c = c->next)
|
|
||||||
if(IS_TILED(c, screen))
|
|
||||||
n++;
|
|
||||||
|
|
||||||
wah = area.height;
|
|
||||||
waw = area.width;
|
|
||||||
wax = area.x;
|
|
||||||
way = area.y;
|
|
||||||
|
|
||||||
masterwin = MIN(n, curtags[0]->nmaster);
|
|
||||||
|
|
||||||
otherwin = MAX(n - masterwin, 0);
|
|
||||||
|
|
||||||
if(curtags[0]->nmaster)
|
|
||||||
switch(position)
|
|
||||||
{
|
|
||||||
case Right:
|
|
||||||
case Left:
|
|
||||||
mh = masterwin ? wah / masterwin : wah;
|
|
||||||
mw = otherwin ? waw * curtags[0]->mwfact : waw;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
mh = otherwin ? wah * curtags[0]->mwfact : wah;
|
|
||||||
mw = masterwin ? waw / masterwin : waw;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
mh = mw = 0;
|
|
||||||
|
|
||||||
real_ncol = curtags[0]->ncol > 0 ? MIN(otherwin, curtags[0]->ncol) : MIN(otherwin, 1);
|
|
||||||
|
|
||||||
for(i = 0, c = globalconf.clients; c; c = c->next)
|
|
||||||
{
|
|
||||||
if(!IS_TILED(c, screen))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if(i < curtags[0]->nmaster)
|
|
||||||
{
|
|
||||||
switch(position)
|
|
||||||
{
|
|
||||||
case Right:
|
|
||||||
geometry.y = way + i * mh;
|
|
||||||
geometry.x = wax;
|
|
||||||
break;
|
|
||||||
case Left:
|
|
||||||
geometry.y = way + i * mh;
|
|
||||||
geometry.x = wax + (waw - mw);
|
|
||||||
break;
|
|
||||||
case Top:
|
|
||||||
geometry.x = wax + i * mw;
|
|
||||||
geometry.y = way + (wah - mh);
|
|
||||||
break;
|
|
||||||
case Bottom:
|
|
||||||
default:
|
|
||||||
geometry.x = wax + i * mw;
|
|
||||||
geometry.y = way;
|
|
||||||
break;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
geometry.width = mw - 2 * c->border;
|
|
||||||
geometry.height = mh - 2 * c->border;
|
|
||||||
|
|
||||||
client_resize(c, geometry, c->honorsizehints);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
win_by_col = otherwin / real_ncol;
|
|
||||||
small_ncol = (win_by_col + 1) * real_ncol - otherwin;
|
|
||||||
adj_win_by_col = current_col < small_ncol ? 0 : 1;
|
|
||||||
|
|
||||||
if((i - curtags[0]->nmaster) &&
|
|
||||||
(i - curtags[0]->nmaster + small_ncol * adj_win_by_col)
|
|
||||||
% (win_by_col + adj_win_by_col) == 0 &&
|
|
||||||
current_col < real_ncol - 1)
|
|
||||||
current_col++;
|
|
||||||
|
|
||||||
adj_win_by_col = current_col < small_ncol ? 0 : 1;
|
|
||||||
|
|
||||||
if(position == Right || position == Left)
|
|
||||||
{
|
|
||||||
if(otherwin <= real_ncol)
|
|
||||||
geometry.height = wah - 2 * c->border;
|
|
||||||
else
|
|
||||||
geometry.height = (wah / (win_by_col + adj_win_by_col)) -
|
|
||||||
2 * c->border;
|
|
||||||
|
|
||||||
geometry.width = (waw - mw) / real_ncol - 2 * c->border;
|
|
||||||
|
|
||||||
if(otherwin <= real_ncol ||
|
|
||||||
(i - curtags[0]->nmaster + small_ncol * adj_win_by_col)
|
|
||||||
% (win_by_col + adj_win_by_col) == 0)
|
|
||||||
geometry.y = way;
|
|
||||||
else
|
|
||||||
geometry.y = way +
|
|
||||||
((i - curtags[0]->nmaster +
|
|
||||||
small_ncol * adj_win_by_col) %
|
|
||||||
(win_by_col + adj_win_by_col)) *
|
|
||||||
(geometry.height + 2 * c->border);
|
|
||||||
|
|
||||||
geometry.x = wax + current_col * (geometry.width + 2 * c->border);
|
|
||||||
|
|
||||||
if(position == Right)
|
|
||||||
geometry.x += mw;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(otherwin <= real_ncol)
|
|
||||||
geometry.width = waw - 2 * c->border;
|
|
||||||
else
|
|
||||||
geometry.width = (waw / (win_by_col + adj_win_by_col)) -
|
|
||||||
2 * c->border;
|
|
||||||
|
|
||||||
geometry.height = (wah - mh) / real_ncol - 2 * c->border;
|
|
||||||
|
|
||||||
if(otherwin <= real_ncol ||
|
|
||||||
(i - curtags[0]->nmaster + small_ncol * adj_win_by_col)
|
|
||||||
% (win_by_col + adj_win_by_col) == 0)
|
|
||||||
geometry.x = wax;
|
|
||||||
else
|
|
||||||
geometry.x = wax +
|
|
||||||
((i - curtags[0]->nmaster +
|
|
||||||
small_ncol * adj_win_by_col) %
|
|
||||||
(win_by_col + adj_win_by_col)) *
|
|
||||||
(geometry.width + 2 * c->border);
|
|
||||||
|
|
||||||
geometry.y = way + current_col * (geometry.height + 2 * c->border);
|
|
||||||
|
|
||||||
if(position == Bottom)
|
|
||||||
geometry.y += mh;
|
|
||||||
}
|
|
||||||
client_resize(c, geometry, c->honorsizehints);
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
p_delete(&curtags);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_tile(int screen)
|
|
||||||
{
|
|
||||||
_tile(screen, Right);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_tileleft(int screen)
|
|
||||||
{
|
|
||||||
_tile(screen, Left);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_tilebottom(int screen)
|
|
||||||
{
|
|
||||||
_tile(screen, Bottom);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
layout_tiletop(int screen)
|
|
||||||
{
|
|
||||||
_tile(screen, Top);
|
|
||||||
}
|
|
||||||
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,34 +0,0 @@
|
||||||
/*
|
|
||||||
* tile.h - tile layout
|
|
||||||
*
|
|
||||||
* Copyright © 2007-2008 Julien Danjou <julien@danjou.info>
|
|
||||||
* Copyright © 2007 Ross Mohn <rpmohn@waxandwane.org>
|
|
||||||
*
|
|
||||||
* 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_TILE_H
|
|
||||||
#define AWESOME_TILE_H
|
|
||||||
|
|
||||||
#include "layout.h"
|
|
||||||
|
|
||||||
layout_t layout_tile;
|
|
||||||
layout_t layout_tileleft;
|
|
||||||
layout_t layout_tilebottom;
|
|
||||||
layout_t layout_tiletop;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -1,53 +0,0 @@
|
||||||
---------------------------------------------------------------------------
|
|
||||||
-- @author Julien Danjou <julien@danjou.info>
|
|
||||||
-- @copyright 2008 Julien Danjou
|
|
||||||
-- @release @AWESOME_VERSION@
|
|
||||||
---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
-- Grab environment we need
|
|
||||||
local ipairs = ipairs
|
|
||||||
local tag = require("awful.tag")
|
|
||||||
|
|
||||||
--- Layout module for awful
|
|
||||||
module("awful.layout")
|
|
||||||
|
|
||||||
--- Get the current layout name.
|
|
||||||
-- @param screen The screen number.
|
|
||||||
function get(screen)
|
|
||||||
local t = tag.selected(screen)
|
|
||||||
if t then
|
|
||||||
return t.layout
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Change the layout of the current tag.
|
|
||||||
-- @param layouts A table of layouts.
|
|
||||||
-- @param i Relative index.
|
|
||||||
function inc(layouts, i)
|
|
||||||
local t = tag.selected()
|
|
||||||
local number_of_layouts = 0
|
|
||||||
local rev_layouts = {}
|
|
||||||
for i, v in ipairs(layouts) do
|
|
||||||
rev_layouts[v] = i
|
|
||||||
number_of_layouts = number_of_layouts + 1
|
|
||||||
end
|
|
||||||
if t then
|
|
||||||
local cur_layout = get()
|
|
||||||
local new_layout_index = (rev_layouts[cur_layout] + i) % number_of_layouts
|
|
||||||
if new_layout_index == 0 then
|
|
||||||
new_layout_index = number_of_layouts
|
|
||||||
end
|
|
||||||
t.layout = layouts[new_layout_index]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
--- Set the layout of the current tag by name.
|
|
||||||
-- @param layout Layout name.
|
|
||||||
function set(layout)
|
|
||||||
local t = tag.selected()
|
|
||||||
if t then
|
|
||||||
t.layout = layout
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
|
-- @copyright 2008 Julien Danjou
|
||||||
|
-- @release @AWESOME_VERSION@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Grab environment we need
|
||||||
|
local ipairs = ipairs
|
||||||
|
local tag = require("awful.tag")
|
||||||
|
local util = require("awful.util")
|
||||||
|
local suit = require("awful.layout.suit")
|
||||||
|
local capi =
|
||||||
|
{
|
||||||
|
hooks = hooks,
|
||||||
|
screen = screen
|
||||||
|
}
|
||||||
|
local hooks = require("awful.hooks")
|
||||||
|
|
||||||
|
--- Layout module for awful
|
||||||
|
module("awful.layout")
|
||||||
|
|
||||||
|
--- Get the current layout.
|
||||||
|
-- @param screen The screen number.
|
||||||
|
-- @return The layout function.
|
||||||
|
function get(screen)
|
||||||
|
local t = tag.selected(screen)
|
||||||
|
return tag.getproperty(t, "layout") or suit.tile
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Change the layout of the current tag.
|
||||||
|
-- @param layouts A table of layouts.
|
||||||
|
-- @param i Relative index.
|
||||||
|
function inc(layouts, i)
|
||||||
|
local t = tag.selected()
|
||||||
|
if t then
|
||||||
|
local curlayout = get()
|
||||||
|
local curindex
|
||||||
|
local rev_layouts = {}
|
||||||
|
for k, v in ipairs(layouts) do
|
||||||
|
if v == curlayout then
|
||||||
|
curindex = k
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if curindex then
|
||||||
|
local newindex = util.cycle(#layouts, curindex + i)
|
||||||
|
set(layouts[newindex])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set the layout function of the current tag.
|
||||||
|
-- @param layout Layout name.
|
||||||
|
function set(layout)
|
||||||
|
local t = tag.selected()
|
||||||
|
tag.setproperty(t, "layout", layout)
|
||||||
|
capi.hooks.arrange()(t.screen)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Register an arrange hook.
|
||||||
|
local function on_arrange (screen)
|
||||||
|
local t = tag.selected(screen)
|
||||||
|
local l = tag.getproperty(t, "layout") or suit.tile
|
||||||
|
l(screen)
|
||||||
|
end
|
||||||
|
|
||||||
|
local layouts_name =
|
||||||
|
{
|
||||||
|
[suit.tile] = "tile",
|
||||||
|
[suit.tile.left] = "tileleft",
|
||||||
|
[suit.tile.bottom] = "tilebottom",
|
||||||
|
[suit.tile.top] = "tiletop",
|
||||||
|
[suit.fair] = "fairv",
|
||||||
|
[suit.fair.horizontal] = "fairh",
|
||||||
|
[suit.max] = "max",
|
||||||
|
[suit.max.fullscreen] = "fullscreen",
|
||||||
|
[suit.magnifier] = "magnifier",
|
||||||
|
[suit.floating] = "floating"
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Get the current layout name.
|
||||||
|
-- @param layout the layout name.
|
||||||
|
-- @return The layout name.
|
||||||
|
function getname(layout)
|
||||||
|
return layouts_name[layout]
|
||||||
|
end
|
||||||
|
|
||||||
|
hooks.arrange.register(on_arrange)
|
||||||
|
|
||||||
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
|
@ -0,0 +1,80 @@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
|
-- @copyright 2008 Julien Danjou
|
||||||
|
-- @release @AWESOME_VERSION@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Grab environment we need
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
local ipairs = ipairs
|
||||||
|
local math = math
|
||||||
|
local client = require("awful.client")
|
||||||
|
local capi =
|
||||||
|
{
|
||||||
|
screen = screen
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Fair layouts module for awful
|
||||||
|
module("awful.layout.suit.fair")
|
||||||
|
|
||||||
|
local function fair(screen, orientation)
|
||||||
|
local wa = capi.screen[screen].workarea
|
||||||
|
local cls = client.tiled(screen)
|
||||||
|
|
||||||
|
if #cls > 0 then
|
||||||
|
local cells = math.floor(math.sqrt(#cls))
|
||||||
|
local strips = math.ceil(#cls / cells)
|
||||||
|
|
||||||
|
local cell = 0
|
||||||
|
local strip = 0
|
||||||
|
for k, c in ipairs(cls) do
|
||||||
|
local g = {}
|
||||||
|
if orientation == "east" then
|
||||||
|
if #cls < (strips * cells) and strip == strips - 1 then
|
||||||
|
g.width = wa.width / (cells - ((strips * cells) - #cls))
|
||||||
|
else
|
||||||
|
g.width = wa.width / cells
|
||||||
|
end
|
||||||
|
g.height = wa.height / strips
|
||||||
|
|
||||||
|
g.x = wa.x + cell * g.width
|
||||||
|
g.y = wa.y + strip * g.height
|
||||||
|
|
||||||
|
else
|
||||||
|
if #cls < (strips * cells) and strip == strips - 1 then
|
||||||
|
g.height = wa.height / (cells - ((strips * cells) - #cls))
|
||||||
|
else
|
||||||
|
g.height = wa.height / cells
|
||||||
|
end
|
||||||
|
g.width = wa.width / strips
|
||||||
|
|
||||||
|
g.x = wa.x + strip * g.width
|
||||||
|
g.y = wa.y + cell * g.height
|
||||||
|
end
|
||||||
|
|
||||||
|
g.width = g.width - 2 * c.border_width
|
||||||
|
g.height = g.height - 2 * c.border_width
|
||||||
|
|
||||||
|
c:fullgeometry(g)
|
||||||
|
|
||||||
|
cell = cell + 1
|
||||||
|
if cell == cells then
|
||||||
|
cell = 0
|
||||||
|
strip = strip + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--- Horizontal fair layout.
|
||||||
|
-- @param screen The screen to arrange.
|
||||||
|
function horizontal(screen)
|
||||||
|
return fair(screen, "east")
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Vertical fair layout.
|
||||||
|
-- @param screen The screen to arrange.
|
||||||
|
local function fairv(_, screen)
|
||||||
|
return fair(screen, "south")
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(_M, { __call = fairv })
|
|
@ -0,0 +1,17 @@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- @author Gregor Best
|
||||||
|
-- @copyright 2008 Gregor Best
|
||||||
|
-- @release @AWESOME_VERSION@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Grab environment we need
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
|
||||||
|
--- Dummy function for floating layout
|
||||||
|
module("awful.layout.suit.floating")
|
||||||
|
|
||||||
|
local function floating(_, screen)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(_M, { __call = floating })
|
|
@ -0,0 +1,8 @@
|
||||||
|
require("awful.layout.suit.max")
|
||||||
|
require("awful.layout.suit.tile")
|
||||||
|
require("awful.layout.suit.fair")
|
||||||
|
require("awful.layout.suit.floating")
|
||||||
|
require("awful.layout.suit.magnifier")
|
||||||
|
|
||||||
|
--- Suits for awful
|
||||||
|
module("awful.layout.suit")
|
|
@ -0,0 +1,83 @@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
|
-- @copyright 2008 Julien Danjou
|
||||||
|
-- @release @AWESOME_VERSION@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Grab environment we need
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
local ipairs = ipairs
|
||||||
|
local math = math
|
||||||
|
local tag = require("awful.tag")
|
||||||
|
local capi =
|
||||||
|
{
|
||||||
|
client = client,
|
||||||
|
screen = screen
|
||||||
|
}
|
||||||
|
local client = require("awful.client")
|
||||||
|
|
||||||
|
--- Magnifier layout module for awful
|
||||||
|
module("awful.layout.suit.magnifier")
|
||||||
|
|
||||||
|
local function magnifier(_, screen)
|
||||||
|
-- Fullscreen?
|
||||||
|
local area = capi.screen[screen].workarea
|
||||||
|
local cls = client.tiled(screen)
|
||||||
|
local focus = capi.client.focus
|
||||||
|
local t = tag.selected()
|
||||||
|
local mwfact = tag.getmwfact(t)
|
||||||
|
|
||||||
|
if not focus and #cls > 0 then
|
||||||
|
focus = cls[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Abort if no clients are present
|
||||||
|
if not focus then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Find parent of this window, if it has one.
|
||||||
|
while focus.transient_for do
|
||||||
|
focus = focus.transient_for
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If focused window is not tiled, take the first one which is tiled.
|
||||||
|
if client.floating.get(focus) then
|
||||||
|
focus = cls[1]
|
||||||
|
end
|
||||||
|
|
||||||
|
local geometry = {}
|
||||||
|
if #cls - 1 > 0 then
|
||||||
|
geometry.width = area.width * math.sqrt(mwfact)
|
||||||
|
geometry.height = area.height * math.sqrt(mwfact)
|
||||||
|
geometry.x = area.x + (area.width - geometry.width) / 2
|
||||||
|
geometry.y = area.y + (area.height - geometry.height) /2
|
||||||
|
else
|
||||||
|
geometry.x = area.x
|
||||||
|
geometry.y = area.y
|
||||||
|
geometry.width = area.width - 2 * focus.border_width
|
||||||
|
geometry.height = area.height - 2 * focus.border_width
|
||||||
|
end
|
||||||
|
focus:fullgeometry(geometry)
|
||||||
|
focus:raise()
|
||||||
|
|
||||||
|
if #cls - 1 > 0 then
|
||||||
|
geometry.x = area.x
|
||||||
|
geometry.y = area.y
|
||||||
|
geometry.height = area.height / (#cls - 1)
|
||||||
|
geometry.width = area.width
|
||||||
|
|
||||||
|
for k, c in ipairs(cls) do
|
||||||
|
if c ~= focus then
|
||||||
|
geometry.height = geometry.height - 2 * c.border_width
|
||||||
|
geometry.width = geometry.width - 2 * c.border_width
|
||||||
|
c:fullgeometry(geometry)
|
||||||
|
geometry.height = geometry.height + 2 * c.border_width
|
||||||
|
geometry.width = geometry.width + 2 * c.border_width
|
||||||
|
geometry.y = geometry.y + geometry.height
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(_M, { __call = magnifier })
|
|
@ -0,0 +1,51 @@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
|
-- @copyright 2008 Julien Danjou
|
||||||
|
-- @release @AWESOME_VERSION@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Grab environment we need
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
local pairs = pairs
|
||||||
|
local client = require("awful.client")
|
||||||
|
local capi =
|
||||||
|
{
|
||||||
|
screen = screen
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Maximized and fullscreen layouts module for awful
|
||||||
|
module("awful.layout.suit.max")
|
||||||
|
|
||||||
|
local function fmax(screen, fs)
|
||||||
|
-- Fullscreen?
|
||||||
|
local area
|
||||||
|
if fs then
|
||||||
|
area = capi.screen[screen].geometry
|
||||||
|
else
|
||||||
|
area = capi.screen[screen].workarea
|
||||||
|
end
|
||||||
|
|
||||||
|
for k, c in pairs(client.visible(screen)) do
|
||||||
|
if not c.floating then
|
||||||
|
area.width = area.width - 2 * c.border_width
|
||||||
|
area.height = area.height - 2 * c.border_width
|
||||||
|
c:fullgeometry(area)
|
||||||
|
area.width = area.width + 2 * c.border_width
|
||||||
|
area.height = area.height + 2 * c.border_width
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Maximized layout.
|
||||||
|
-- @param screen The screen to arrange.
|
||||||
|
local function max(_, screen)
|
||||||
|
return fmax(screen, false)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Fullscreen layout.
|
||||||
|
-- @param screen The screen to arrange.
|
||||||
|
function fullscreen(screen)
|
||||||
|
return fmax(screen, true)
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(_M, { __call = max })
|
|
@ -0,0 +1,168 @@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
-- @author Julien Danjou <julien@danjou.info>
|
||||||
|
-- @copyright 2008 Julien Danjou
|
||||||
|
-- @release @AWESOME_VERSION@
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
-- Grab environment we need
|
||||||
|
local setmetatable = setmetatable
|
||||||
|
local ipairs = ipairs
|
||||||
|
local math = math
|
||||||
|
local client = require("awful.client")
|
||||||
|
local tag = require("awful.tag")
|
||||||
|
local capi =
|
||||||
|
{
|
||||||
|
screen = screen
|
||||||
|
}
|
||||||
|
|
||||||
|
--- Tiled layouts module for awful
|
||||||
|
module("awful.layout.suit.tile")
|
||||||
|
|
||||||
|
local function tile(_, screen, position)
|
||||||
|
if not position then position = "right" end
|
||||||
|
local t = tag.selected()
|
||||||
|
local nmaster = tag.getnmaster(t)
|
||||||
|
local mwfact = tag.getmwfact(t)
|
||||||
|
local ncol = tag.getncol(t)
|
||||||
|
|
||||||
|
local wa = capi.screen[screen].workarea
|
||||||
|
local cls = client.tiled(screen)
|
||||||
|
|
||||||
|
local masterwin = math.min(#cls, nmaster)
|
||||||
|
local otherwin = math.max(#cls - masterwin, 0);
|
||||||
|
|
||||||
|
local mh, mw
|
||||||
|
if nmaster > 0 then
|
||||||
|
if position == "right" or position == "left" then
|
||||||
|
if masterwin > 0 then
|
||||||
|
mh = wa.height / masterwin
|
||||||
|
else
|
||||||
|
mh = wa.height
|
||||||
|
end
|
||||||
|
if otherwin > 0 then
|
||||||
|
mw = wa.width * mwfact
|
||||||
|
else
|
||||||
|
mw = wa.width
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if otherwin > 0 then
|
||||||
|
mh = wa.height * mwfact
|
||||||
|
else
|
||||||
|
mh = wa.height
|
||||||
|
end
|
||||||
|
if masterwin > 0 then
|
||||||
|
mw = wa.width / masterwin
|
||||||
|
else
|
||||||
|
mw = wa.width
|
||||||
|
end
|
||||||
|
end
|
||||||
|
else
|
||||||
|
mh = 0
|
||||||
|
mw = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
local real_ncol
|
||||||
|
if ncol > 0 then
|
||||||
|
real_ncol = math.min(otherwin, ncol)
|
||||||
|
else
|
||||||
|
real_ncol = math.min(otherwin, 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
for i, c in ipairs(cls) do
|
||||||
|
local geometry = {}
|
||||||
|
|
||||||
|
-- Master windows
|
||||||
|
if i <= nmaster then
|
||||||
|
if position == "right" then
|
||||||
|
geometry.y = wa.y + (i - 1) * mh
|
||||||
|
geometry.x = wa.x
|
||||||
|
elseif position == "left" then
|
||||||
|
geometry.y = wa.y + (i - 1) * mh
|
||||||
|
geometry.x = wa.x + (wa.width - mw)
|
||||||
|
elseif position == "top" then
|
||||||
|
geometry.x = wa.x + (i - 1) * mw
|
||||||
|
geometry.y = wa.y + (wa.height - mh)
|
||||||
|
else
|
||||||
|
geometry.x = wa.x + (i - 1) * mw
|
||||||
|
geometry.y = wa.y
|
||||||
|
end
|
||||||
|
|
||||||
|
geometry.width = mw - 2 * c.border_width
|
||||||
|
geometry.height = mh - 2 * c.border_width
|
||||||
|
|
||||||
|
-- Slave windows
|
||||||
|
else
|
||||||
|
local win_by_col = math.ceil(otherwin / real_ncol)
|
||||||
|
real_ncol = math.ceil(otherwin / win_by_col)
|
||||||
|
local current_col = math.floor((i - 1 - nmaster) / win_by_col)
|
||||||
|
|
||||||
|
if position == "right" or position == "left" then
|
||||||
|
if otherwin <= real_ncol then
|
||||||
|
geometry.height = wa.height - 2 * c.border_width
|
||||||
|
elseif (otherwin % win_by_col) ~= 0 and (current_col == real_ncol - 1) then
|
||||||
|
geometry.height = math.floor(wa.height / (otherwin % win_by_col)) - 2 * c.border_width
|
||||||
|
else
|
||||||
|
geometry.height = math.floor(wa.height / win_by_col) - 2 * c.border_width
|
||||||
|
end
|
||||||
|
|
||||||
|
geometry.width = math.floor((wa.width - mw) / real_ncol) - 2 * c.border_width
|
||||||
|
|
||||||
|
if otherwin <= real_ncol then
|
||||||
|
geometry.y = wa.y
|
||||||
|
else
|
||||||
|
geometry.y = wa.y + ((i - 1 - nmaster) % win_by_col) *
|
||||||
|
(geometry.height + 2 * c.border_width)
|
||||||
|
end
|
||||||
|
geometry.x = wa.x + current_col * (geometry.width + 2 * c.border_width)
|
||||||
|
|
||||||
|
if position == "right" then
|
||||||
|
geometry.x = geometry.x + mw
|
||||||
|
end
|
||||||
|
else
|
||||||
|
if otherwin <= real_ncol then
|
||||||
|
geometry.width = wa.width - 2 * c.border_width
|
||||||
|
elseif (otherwin % win_by_col) ~= 0 and (current_col == real_ncol - 1) then
|
||||||
|
geometry.width = math.floor(wa.width / (otherwin % win_by_col)) - 2 * c.border_width
|
||||||
|
else
|
||||||
|
geometry.width = math.floor(wa.width / win_by_col) - 2 * c.border_width
|
||||||
|
end
|
||||||
|
|
||||||
|
geometry.height = math.floor((wa.height - mh) / real_ncol) - 2 * c.border_width
|
||||||
|
|
||||||
|
if otherwin <= real_ncol then
|
||||||
|
geometry.x = wa.x
|
||||||
|
else
|
||||||
|
geometry.x = wa.x + ((i - 1 - nmaster) % win_by_col) *
|
||||||
|
(geometry.width + 2 * c.border_width)
|
||||||
|
end
|
||||||
|
|
||||||
|
geometry.y = wa.y + current_col * (geometry.height + 2 * c.border_width)
|
||||||
|
|
||||||
|
if position == "bottom" then
|
||||||
|
geometry.y = geometry.y + mh
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
c:fullgeometry(geometry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- The main tile algo, on left.
|
||||||
|
-- @param screen The screen number to tile.
|
||||||
|
function left(screen)
|
||||||
|
return tile(nil, screen, "left")
|
||||||
|
end
|
||||||
|
|
||||||
|
--- The main tile algo, on bottom.
|
||||||
|
-- @param screen The screen number to tile.
|
||||||
|
function bottom(screen)
|
||||||
|
return tile(nil, screen, "bottom")
|
||||||
|
end
|
||||||
|
|
||||||
|
--- The main tile algo, on top.
|
||||||
|
-- @param screen The screen number to tile.
|
||||||
|
function top(screen)
|
||||||
|
return tile(nil, screen, "top")
|
||||||
|
end
|
||||||
|
|
||||||
|
setmetatable(_M, { __call = tile })
|
|
@ -109,16 +109,16 @@ function client.move(c, snap)
|
||||||
for k, v in ipairs(mouse.buttons) do
|
for k, v in ipairs(mouse.buttons) do
|
||||||
if v then
|
if v then
|
||||||
local lay = layout.get(c.screen)
|
local lay = layout.get(c.screen)
|
||||||
if lay == "floating" or c.floating then
|
if lay == layout.suit.floating or c.floating then
|
||||||
local x = mouse.x - dist_x
|
local x = mouse.x - dist_x
|
||||||
local y = mouse.y - dist_y
|
local y = mouse.y - dist_y
|
||||||
c:fullgeometry(client.snap(c, snap, x, y))
|
c:fullgeometry(client.snap(c, snap, x, y))
|
||||||
if layout.get(c.screen) ~= "floating" and not c.floating then
|
if layout.get(c.screen) ~= layout.suit.floating and not c.floating then
|
||||||
hooks.property.register(ug)
|
hooks.property.register(ug)
|
||||||
end
|
end
|
||||||
elseif lay ~= "magnifier" then
|
elseif lay ~= layout.suit.magnifier then
|
||||||
c.screen = capi.mouse.screen
|
c.screen = capi.mouse.screen
|
||||||
if layout.get(c.screen) ~= "floating" then
|
if layout.get(c.screen) ~= layout.suit.floating then
|
||||||
local c_u_m = capi.mouse.client_under_pointer()
|
local c_u_m = capi.mouse.client_under_pointer()
|
||||||
if c_u_m and not c_u_m.floating then
|
if c_u_m and not c_u_m.floating then
|
||||||
if c_u_m ~= c then
|
if c_u_m ~= c then
|
||||||
|
@ -200,7 +200,7 @@ local function client_resize_magnifier(c, corner)
|
||||||
|
|
||||||
-- New master width factor
|
-- New master width factor
|
||||||
local mwfact = dist / maxdist_pow
|
local mwfact = dist / maxdist_pow
|
||||||
tag.setmwfact(math.min(math.max(0.01, mwfact), 0.99), c.screen)
|
tag.setmwfact(math.min(math.max(0.01, mwfact), 0.99), tag.selected(c.screen))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -210,15 +210,15 @@ end
|
||||||
|
|
||||||
local function client_resize_tiled(c, lay)
|
local function client_resize_tiled(c, lay)
|
||||||
local wa = capi.screen[c.screen].workarea
|
local wa = capi.screen[c.screen].workarea
|
||||||
local mwfact = tag.selected(c.screen).mwfact
|
local mwfact = tag.getmwfact()
|
||||||
local cursor
|
local cursor
|
||||||
if lay == "tile" then
|
if lay == layout.suit.tile then
|
||||||
capi.mouse.coords({ x = wa.x + wa.width * mwfact })
|
capi.mouse.coords({ x = wa.x + wa.width * mwfact })
|
||||||
cursor = "sb_h_double_arrow"
|
cursor = "sb_h_double_arrow"
|
||||||
elseif lay == "tileleft" then
|
elseif lay == layout.suit.tile.left then
|
||||||
capi.mouse.coords({ x = wa.x + wa.width * (1 - mwfact) })
|
capi.mouse.coords({ x = wa.x + wa.width * (1 - mwfact) })
|
||||||
cursor = "sb_h_double_arrow"
|
cursor = "sb_h_double_arrow"
|
||||||
elseif lay == "tilebottom" then
|
elseif lay == layout.suit.tile.bottom then
|
||||||
capi.mouse.coords({ y = wa.y + wa.height * mwfact })
|
capi.mouse.coords({ y = wa.y + wa.height * mwfact })
|
||||||
cursor = "sb_v_double_arrow"
|
cursor = "sb_v_double_arrow"
|
||||||
else
|
else
|
||||||
|
@ -233,17 +233,17 @@ local function client_resize_tiled(c, lay)
|
||||||
local fact_y = (mouse.y - wa.y) / wa.height
|
local fact_y = (mouse.y - wa.y) / wa.height
|
||||||
local mwfact
|
local mwfact
|
||||||
|
|
||||||
if lay == "tile" then
|
if lay == layout.suit.tile then
|
||||||
mwfact = fact_x
|
mwfact = fact_x
|
||||||
elseif lay == "tileleft" then
|
elseif lay == layout.suit.tile.left then
|
||||||
mwfact = 1 - fact_x
|
mwfact = 1 - fact_x
|
||||||
elseif lay == "tilebottom" then
|
elseif lay == layout.suit.tile.bottom then
|
||||||
mwfact = fact_y
|
mwfact = fact_y
|
||||||
else
|
else
|
||||||
mwfact = 1 - fact_y
|
mwfact = 1 - fact_y
|
||||||
end
|
end
|
||||||
|
|
||||||
tag.setmwfact(math.min(math.max(mwfact, 0.01), 0.99), c.screen)
|
tag.setmwfact(math.min(math.max(mwfact, 0.01), 0.99), tag.selected(c.screen))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -332,14 +332,14 @@ function client.resize(c, corner)
|
||||||
|
|
||||||
local lay = layout.get(c.screen)
|
local lay = layout.get(c.screen)
|
||||||
|
|
||||||
if lay == "floating" or c.floating then
|
if lay == layout.suit.floating or c.floating then
|
||||||
return client_resize_floating(c, corner)
|
return client_resize_floating(c, corner)
|
||||||
elseif lay == "tile"
|
elseif lay == layout.suit.tile
|
||||||
or lay == "tileleft"
|
or lay == layout.suit.tile.left
|
||||||
or lay == "tilebottom"
|
or lay == layout.suit.tile.top
|
||||||
or lay == "tiletop" then
|
or lay == layout.suit.tile.bottom then
|
||||||
return client_resize_tiled(c, lay)
|
return client_resize_tiled(c, lay)
|
||||||
elseif lay == "magnifier" then
|
elseif lay == layout.suit.magnifier then
|
||||||
return client_resize_magnifier(c, corner)
|
return client_resize_magnifier(c, corner)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -128,7 +128,7 @@ function no_overlap(c)
|
||||||
local geometry = c:geometry()
|
local geometry = c:geometry()
|
||||||
local fullgeometry = c:fullgeometry()
|
local fullgeometry = c:fullgeometry()
|
||||||
for i, cl in pairs(cls) do
|
for i, cl in pairs(cls) do
|
||||||
if cl ~= c and (cl.floating or layout == "floating") then
|
if cl ~= c and (cl.floating or layout == layout.suit.floating) then
|
||||||
areas = area_remove(areas, cl:fullgeometry())
|
areas = area_remove(areas, cl:fullgeometry())
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,15 +5,17 @@
|
||||||
---------------------------------------------------------------------------
|
---------------------------------------------------------------------------
|
||||||
|
|
||||||
-- Grab environment we need
|
-- Grab environment we need
|
||||||
local hooks = require("awful.hooks")
|
|
||||||
local util = require("awful.util")
|
local util = require("awful.util")
|
||||||
local pairs = pairs
|
local pairs = pairs
|
||||||
local ipairs = ipairs
|
local ipairs = ipairs
|
||||||
|
local otable = otable
|
||||||
local capi =
|
local capi =
|
||||||
{
|
{
|
||||||
|
hooks = hooks,
|
||||||
screen = screen,
|
screen = screen,
|
||||||
mouse = mouse
|
mouse = mouse
|
||||||
}
|
}
|
||||||
|
local hooks = require("awful.hooks")
|
||||||
|
|
||||||
--- Tag module for awful
|
--- Tag module for awful
|
||||||
module("awful.tag")
|
module("awful.tag")
|
||||||
|
@ -23,6 +25,7 @@ local data = {}
|
||||||
data.history = {}
|
data.history = {}
|
||||||
data.history.past = {}
|
data.history.past = {}
|
||||||
data.history.current = {}
|
data.history.current = {}
|
||||||
|
data.tags = otable()
|
||||||
|
|
||||||
-- History functions
|
-- History functions
|
||||||
history = {}
|
history = {}
|
||||||
|
@ -98,57 +101,66 @@ end
|
||||||
|
|
||||||
--- Set master width factor.
|
--- Set master width factor.
|
||||||
-- @param mwfact Master width factor.
|
-- @param mwfact Master width factor.
|
||||||
-- @param screen Optional screen number.
|
function setmwfact(mwfact, t)
|
||||||
function setmwfact(mwfact, screen)
|
local t = t or selected()
|
||||||
local t = selected(screen)
|
setproperty(t, "mwfact", mwfact)
|
||||||
if t then
|
capi.hooks.arrange()(t.screen)
|
||||||
t.mwfact = mwfact
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Increase master width factor.
|
--- Increase master width factor.
|
||||||
-- @param add Value to add to master width factor.
|
-- @param add Value to add to master width factor.
|
||||||
function incmwfact(add)
|
function incmwfact(add, t)
|
||||||
local t = selected()
|
setmwfact(getmwfact(t) + add)
|
||||||
if t then
|
end
|
||||||
t.mwfact = t.mwfact + add
|
|
||||||
end
|
--- Get master width factor.
|
||||||
|
-- @param t Optional tag.
|
||||||
|
function getmwfact(t)
|
||||||
|
local t = t or selected()
|
||||||
|
return getproperty(t, "mwfact") or 0.5
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set the number of master windows.
|
--- Set the number of master windows.
|
||||||
-- @param nmaster The number of master windows.
|
-- @param nmaster The number of master windows.
|
||||||
function setnmaster(nmaster)
|
-- @param t Optional tag.
|
||||||
local t = selected()
|
function setnmaster(nmaster, t)
|
||||||
if t then
|
local t = t or selected()
|
||||||
t.nmaster = nmaster
|
setproperty(t, "nmaster", nmaster)
|
||||||
end
|
capi.hooks.arrange()(t.screen)
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get the number of master windows.
|
||||||
|
-- @param t Optional tag.
|
||||||
|
function getnmaster(t)
|
||||||
|
local t = t or selected()
|
||||||
|
return getproperty(t, "nmaster") or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Increase the number of master windows.
|
--- Increase the number of master windows.
|
||||||
-- @param add Value to add to number of master windows.
|
-- @param add Value to add to number of master windows.
|
||||||
function incnmaster(add)
|
function incnmaster(add, t)
|
||||||
local t = selected()
|
setnmaster(getnmaster(t) + add)
|
||||||
if t then
|
|
||||||
t.nmaster = t.nmaster + add
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Set number of column windows.
|
--- Set number of column windows.
|
||||||
-- @param ncol The number of column.
|
-- @param ncol The number of column.
|
||||||
function setncol(ncol)
|
function setncol(ncol, t)
|
||||||
local t = selected()
|
local t = t or selected()
|
||||||
if t then
|
setproperty(t, "ncol", ncol)
|
||||||
t.ncol = ncol
|
capi.hooks.arrange()(t.screen)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--- Get number of column windows.
|
||||||
|
-- @param t Optional tag.
|
||||||
|
function getncol(t)
|
||||||
|
local t = t or selected()
|
||||||
|
return getproperty(t, "ncol") or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Increase number of column windows.
|
--- Increase number of column windows.
|
||||||
-- @param add Value to add to number of column windows.
|
-- @param add Value to add to number of column windows.
|
||||||
function incncol(add)
|
function incncol(add, t)
|
||||||
local t = selected()
|
setncol(getncol(t) + add)
|
||||||
if t then
|
|
||||||
t.ncol = t.ncol + add
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
--- View no tag.
|
--- View no tag.
|
||||||
|
@ -201,7 +213,41 @@ function viewmore(tags, screen)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local function hook_tags(screen, tag, action)
|
||||||
|
if action == "remove" then
|
||||||
|
data.tags[tag] = nil
|
||||||
|
elseif action == "add" then
|
||||||
|
data.tags[tag] = {}
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Get a tag property.
|
||||||
|
-- @param tag The tag.
|
||||||
|
-- @param prop The property name.
|
||||||
|
-- @return The property.
|
||||||
|
function getproperty(tag, prop)
|
||||||
|
if data.tags[tag] then
|
||||||
|
return data.tags[tag][prop]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
--- Set a tag property.
|
||||||
|
-- This properties are internal to awful. Some are used to draw taglist, or to
|
||||||
|
-- handle layout, etc.
|
||||||
|
-- @param tag The tag.
|
||||||
|
-- @param prop The property name.
|
||||||
|
-- @param value The value.
|
||||||
|
-- @return True if the value has been set, false otherwise.
|
||||||
|
function setproperty(tag, prop, value)
|
||||||
|
if data.tags[tag] then
|
||||||
|
data.tags[tag][prop] = value
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
|
||||||
-- Register standards hooks
|
-- Register standards hooks
|
||||||
hooks.arrange.register(history.update)
|
hooks.arrange.register(history.update)
|
||||||
|
hooks.tags.register(hook_tags)
|
||||||
|
|
||||||
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=80
|
||||||
|
|
3
luaa.c
3
luaa.c
|
@ -48,7 +48,6 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
#include "mouse.h"
|
#include "mouse.h"
|
||||||
#include "layouts/tile.h"
|
|
||||||
#include "common/socket.h"
|
#include "common/socket.h"
|
||||||
#include "common/buffer.h"
|
#include "common/buffer.h"
|
||||||
|
|
||||||
|
@ -979,7 +978,7 @@ bailout:
|
||||||
/* Assure there's at least one tag */
|
/* Assure there's at least one tag */
|
||||||
for(screen = 0; screen < globalconf.nscreen; screen++)
|
for(screen = 0; screen < globalconf.nscreen; screen++)
|
||||||
if(!globalconf.screens[screen].tags.len)
|
if(!globalconf.screens[screen].tags.len)
|
||||||
tag_append_to_screen(tag_new("default", sizeof("default") - 1, layout_tile, 0.5, 1, 0),
|
tag_append_to_screen(tag_new("default", sizeof("default") - 1),
|
||||||
&globalconf.screens[screen]);
|
&globalconf.screens[screen]);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
4
mouse.c
4
mouse.c
|
@ -24,10 +24,6 @@
|
||||||
#include "common/tokenize.h"
|
#include "common/tokenize.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "titlebar.h"
|
|
||||||
#include "layouts/floating.h"
|
|
||||||
#include "layouts/tile.h"
|
|
||||||
#include "layouts/magnifier.h"
|
|
||||||
#include "common/xcursor.h"
|
#include "common/xcursor.h"
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
3
screen.c
3
screen.c
|
@ -30,7 +30,6 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
#include "wibox.h"
|
#include "wibox.h"
|
||||||
#include "layouts/tile.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
||||||
|
@ -462,7 +461,7 @@ luaA_screen_tags(lua_State *L)
|
||||||
{
|
{
|
||||||
luaA_warn(L, "screen %d has no tag, taking last resort action and adding default tag\n",
|
luaA_warn(L, "screen %d has no tag, taking last resort action and adding default tag\n",
|
||||||
s->index);
|
s->index);
|
||||||
tag_append_to_screen(tag_new("default", sizeof("default") - 1, layout_tile, 0.5, 1, 0), s);
|
tag_append_to_screen(tag_new("default", sizeof("default") - 1), s);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "luaa.h"
|
#include "luaa.h"
|
||||||
#include "layout.h"
|
|
||||||
#include "swindow.h"
|
#include "swindow.h"
|
||||||
#include "keybinding.h"
|
#include "keybinding.h"
|
||||||
#include "common/xutil.h"
|
#include "common/xutil.h"
|
||||||
|
@ -240,14 +239,6 @@ struct tag
|
||||||
int screen;
|
int screen;
|
||||||
/** true if selected */
|
/** true if selected */
|
||||||
bool selected;
|
bool selected;
|
||||||
/** Current tag layout */
|
|
||||||
layout_t *layout;
|
|
||||||
/** Master width factor */
|
|
||||||
double mwfact;
|
|
||||||
/** Number of master windows */
|
|
||||||
int nmaster;
|
|
||||||
/** Number of columns in tile layout */
|
|
||||||
int ncol;
|
|
||||||
/** clients in this tag */
|
/** clients in this tag */
|
||||||
client_array_t clients;
|
client_array_t clients;
|
||||||
};
|
};
|
||||||
|
|
121
tag.c
121
tag.c
|
@ -25,8 +25,6 @@
|
||||||
#include "ewmh.h"
|
#include "ewmh.h"
|
||||||
#include "widget.h"
|
#include "widget.h"
|
||||||
|
|
||||||
#include "layoutgen.h"
|
|
||||||
|
|
||||||
extern awesome_t globalconf;
|
extern awesome_t globalconf;
|
||||||
|
|
||||||
DO_LUA_NEW(extern, tag_t, tag, "tag", tag_ref)
|
DO_LUA_NEW(extern, tag_t, tag, "tag", tag_ref)
|
||||||
|
@ -48,34 +46,19 @@ tag_view(tag_t *tag, bool view)
|
||||||
/** Create a new tag. Parameters values are checked.
|
/** Create a new tag. Parameters values are checked.
|
||||||
* \param name Tag name.
|
* \param name Tag name.
|
||||||
* \param len Tag name length.
|
* \param len Tag name length.
|
||||||
* \param layout Layout to use.
|
|
||||||
* \param mwfact Master width factor.
|
|
||||||
* \param nmaster Number of master windows.
|
|
||||||
* \param ncol Number of columns for slaves windows.
|
|
||||||
* \return A new tag with all these parameters.
|
* \return A new tag with all these parameters.
|
||||||
*/
|
*/
|
||||||
tag_t *
|
tag_t *
|
||||||
tag_new(const char *name, ssize_t len, layout_t *layout, double mwfact, int nmaster, int ncol)
|
tag_new(const char *name, ssize_t len)
|
||||||
{
|
{
|
||||||
tag_t *tag;
|
tag_t *tag;
|
||||||
|
|
||||||
tag = p_new(tag_t, 1);
|
tag = p_new(tag_t, 1);
|
||||||
a_iso2utf8(&tag->name, name, len);
|
a_iso2utf8(&tag->name, name, len);
|
||||||
tag->layout = layout;
|
|
||||||
|
|
||||||
/* to avoid error */
|
/* to avoid error */
|
||||||
tag->screen = SCREEN_UNDEF;
|
tag->screen = SCREEN_UNDEF;
|
||||||
|
|
||||||
tag->mwfact = mwfact;
|
|
||||||
if(tag->mwfact <= 0 || tag->mwfact >= 1)
|
|
||||||
tag->mwfact = 0.5;
|
|
||||||
|
|
||||||
if((tag->nmaster = nmaster) < 0)
|
|
||||||
tag->nmaster = 1;
|
|
||||||
|
|
||||||
if((tag->ncol = ncol) < 1)
|
|
||||||
tag->ncol = 1;
|
|
||||||
|
|
||||||
return tag;
|
return tag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,39 +245,16 @@ tag_view_only_byindex(int screen, int dindex)
|
||||||
|
|
||||||
/** Create a new tag.
|
/** Create a new tag.
|
||||||
* \param L The Lua VM state.
|
* \param L The Lua VM state.
|
||||||
*
|
|
||||||
* \luastack
|
* \luastack
|
||||||
* \lparam A table with at least a name attribute.
|
* \lparam A name.
|
||||||
* Optional attributes are: mwfact, ncol, nmaster and layout.
|
|
||||||
* \lreturn A new tag object.
|
* \lreturn A new tag object.
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
luaA_tag_new(lua_State *L)
|
luaA_tag_new(lua_State *L)
|
||||||
{
|
{
|
||||||
size_t len, laylen;
|
size_t len;
|
||||||
tag_t *tag;
|
const char *name = luaL_checklstring(L, 2, &len);
|
||||||
int ncol, nmaster;
|
return luaA_tag_userdata_new(L, tag_new(name, len));
|
||||||
const char *name, *lay;
|
|
||||||
double mwfact;
|
|
||||||
layout_t *layout;
|
|
||||||
|
|
||||||
luaA_checktable(L, 2);
|
|
||||||
|
|
||||||
if(!(name = luaA_getopt_lstring(L, 2, "name", NULL, &len)))
|
|
||||||
luaL_error(L, "object tag must have a name");
|
|
||||||
|
|
||||||
mwfact = luaA_getopt_number(L, 2, "mwfact", 0.5);
|
|
||||||
ncol = luaA_getopt_number(L, 2, "ncol", 1);
|
|
||||||
nmaster = luaA_getopt_number(L, 2, "nmaster", 1);
|
|
||||||
lay = luaA_getopt_lstring(L, 2, "layout", "tile", &laylen);
|
|
||||||
|
|
||||||
layout = name_func_lookup(lay, laylen, LayoutList);
|
|
||||||
|
|
||||||
tag = tag_new(name, len,
|
|
||||||
layout,
|
|
||||||
mwfact, nmaster, ncol);
|
|
||||||
|
|
||||||
return luaA_tag_userdata_new(L, tag);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get or set the clients attached to this tag.
|
/** Get or set the clients attached to this tag.
|
||||||
|
@ -345,9 +305,6 @@ luaA_tag_clients(lua_State *L)
|
||||||
* \lfield screen Screen number of the tag.
|
* \lfield screen Screen number of the tag.
|
||||||
* \lfield layout Tag layout.
|
* \lfield layout Tag layout.
|
||||||
* \lfield selected True if the client is selected to be viewed.
|
* \lfield selected True if the client is selected to be viewed.
|
||||||
* \lfield mwfact Master width factor.
|
|
||||||
* \lfield nmaster Number of master windows.
|
|
||||||
* \lfield ncol Number of column for slave windows.
|
|
||||||
*/
|
*/
|
||||||
static int
|
static int
|
||||||
luaA_tag_index(lua_State *L)
|
luaA_tag_index(lua_State *L)
|
||||||
|
@ -371,21 +328,9 @@ luaA_tag_index(lua_State *L)
|
||||||
return 0;
|
return 0;
|
||||||
lua_pushnumber(L, (*tag)->screen + 1);
|
lua_pushnumber(L, (*tag)->screen + 1);
|
||||||
break;
|
break;
|
||||||
case A_TK_LAYOUT:
|
|
||||||
lua_pushstring(L, name_func_rlookup((*tag)->layout, LayoutList));
|
|
||||||
break;
|
|
||||||
case A_TK_SELECTED:
|
case A_TK_SELECTED:
|
||||||
lua_pushboolean(L, (*tag)->selected);
|
lua_pushboolean(L, (*tag)->selected);
|
||||||
break;
|
break;
|
||||||
case A_TK_MWFACT:
|
|
||||||
lua_pushnumber(L, (*tag)->mwfact);
|
|
||||||
break;
|
|
||||||
case A_TK_NMASTER:
|
|
||||||
lua_pushnumber(L, (*tag)->nmaster);
|
|
||||||
break;
|
|
||||||
case A_TK_NCOL:
|
|
||||||
lua_pushnumber(L, (*tag)->ncol);
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -402,17 +347,18 @@ luaA_tag_newindex(lua_State *L)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
tag_t **tag = luaA_checkudata(L, 1, "tag");
|
tag_t **tag = luaA_checkudata(L, 1, "tag");
|
||||||
const char *buf, *attr = luaL_checklstring(L, 2, &len);
|
const char *attr = luaL_checklstring(L, 2, &len);
|
||||||
double d;
|
|
||||||
int i, screen;
|
|
||||||
layout_t *l;
|
|
||||||
|
|
||||||
switch(a_tokenize(attr, len))
|
switch(a_tokenize(attr, len))
|
||||||
{
|
{
|
||||||
|
int screen;
|
||||||
|
|
||||||
case A_TK_NAME:
|
case A_TK_NAME:
|
||||||
buf = luaL_checklstring(L, 3, &len);
|
{
|
||||||
p_delete(&(*tag)->name);
|
const char *buf = luaL_checklstring(L, 3, &len);
|
||||||
a_iso2utf8(&(*tag)->name, buf, len);
|
p_delete(&(*tag)->name);
|
||||||
|
a_iso2utf8(&(*tag)->name, buf, len);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case A_TK_SCREEN:
|
case A_TK_SCREEN:
|
||||||
if(!lua_isnil(L, 3))
|
if(!lua_isnil(L, 3))
|
||||||
|
@ -429,51 +375,10 @@ luaA_tag_newindex(lua_State *L)
|
||||||
if(screen != SCREEN_UNDEF)
|
if(screen != SCREEN_UNDEF)
|
||||||
tag_append_to_screen(*tag, &globalconf.screens[screen]);
|
tag_append_to_screen(*tag, &globalconf.screens[screen]);
|
||||||
break;
|
break;
|
||||||
case A_TK_LAYOUT:
|
|
||||||
buf = luaL_checklstring(L, 3, &len);
|
|
||||||
l = name_func_lookup(buf, len, LayoutList);
|
|
||||||
if(l)
|
|
||||||
(*tag)->layout = l;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
luaA_warn(L, "unknown layout: %s", buf);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case A_TK_SELECTED:
|
case A_TK_SELECTED:
|
||||||
if((*tag)->screen != SCREEN_UNDEF)
|
if((*tag)->screen != SCREEN_UNDEF)
|
||||||
tag_view(*tag, luaA_checkboolean(L, 3));
|
tag_view(*tag, luaA_checkboolean(L, 3));
|
||||||
return 0;
|
return 0;
|
||||||
case A_TK_MWFACT:
|
|
||||||
d = luaL_checknumber(L, 3);
|
|
||||||
if(d > 0 && d < 1)
|
|
||||||
(*tag)->mwfact = d;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
luaA_warn(L, "bad value, must be between 0 and 1");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case A_TK_NMASTER:
|
|
||||||
i = luaL_checknumber(L, 3);
|
|
||||||
if(i >= 0)
|
|
||||||
(*tag)->nmaster = i;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
luaA_warn(L, "bad value, must be greater than 0");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case A_TK_NCOL:
|
|
||||||
i = luaL_checknumber(L, 3);
|
|
||||||
if(i >= 1)
|
|
||||||
(*tag)->ncol = i;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
luaA_warn(L, "bad value, must be greater than 1");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
5
tag.h
5
tag.h
|
@ -26,11 +26,8 @@
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "common/refcount.h"
|
#include "common/refcount.h"
|
||||||
|
|
||||||
/** Check if a client is tiled */
|
|
||||||
#define IS_TILED(client, screen) (client && !client_isfloating(client) && client_isvisible(client, screen))
|
|
||||||
|
|
||||||
/* Contructor, destructor and referencors */
|
/* Contructor, destructor and referencors */
|
||||||
tag_t *tag_new(const char *, ssize_t, layout_t *, double, int, int);
|
tag_t *tag_new(const char *, ssize_t);
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
tag_delete(tag_t **tag)
|
tag_delete(tag_t **tag)
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 967 B |
Binary file not shown.
Before Width: | Height: | Size: 997 B |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB |
|
@ -51,13 +51,11 @@ titlebar_close_button_focus = @AWESOME_THEMES_PATH@/default/titlebar/closer.png
|
||||||
wallpaper_cmd = awsetbg @AWESOME_THEMES_PATH@/default/background.png
|
wallpaper_cmd = awsetbg @AWESOME_THEMES_PATH@/default/background.png
|
||||||
|
|
||||||
# You can use your own layout icons like this:
|
# You can use your own layout icons like this:
|
||||||
layout_dwindle = @AWESOME_THEMES_PATH@/default/layouts/dwindlew.png
|
|
||||||
layout_fairh = @AWESOME_THEMES_PATH@/default/layouts/fairhw.png
|
layout_fairh = @AWESOME_THEMES_PATH@/default/layouts/fairhw.png
|
||||||
layout_fairv = @AWESOME_THEMES_PATH@/default/layouts/fairvw.png
|
layout_fairv = @AWESOME_THEMES_PATH@/default/layouts/fairvw.png
|
||||||
layout_floating = @AWESOME_THEMES_PATH@/default/layouts/floatingw.png
|
layout_floating = @AWESOME_THEMES_PATH@/default/layouts/floatingw.png
|
||||||
layout_magnifier = @AWESOME_THEMES_PATH@/default/layouts/magnifierw.png
|
layout_magnifier = @AWESOME_THEMES_PATH@/default/layouts/magnifierw.png
|
||||||
layout_max = @AWESOME_THEMES_PATH@/default/layouts/maxw.png
|
layout_max = @AWESOME_THEMES_PATH@/default/layouts/maxw.png
|
||||||
layout_spiral = @AWESOME_THEMES_PATH@/default/layouts/spiralw.png
|
|
||||||
layout_tilebottom = @AWESOME_THEMES_PATH@/default/layouts/tilebottomw.png
|
layout_tilebottom = @AWESOME_THEMES_PATH@/default/layouts/tilebottomw.png
|
||||||
layout_tileleft = @AWESOME_THEMES_PATH@/default/layouts/tileleftw.png
|
layout_tileleft = @AWESOME_THEMES_PATH@/default/layouts/tileleftw.png
|
||||||
layout_tile = @AWESOME_THEMES_PATH@/default/layouts/tilew.png
|
layout_tile = @AWESOME_THEMES_PATH@/default/layouts/tilew.png
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 977 B |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
|
@ -21,14 +21,12 @@ border_focus = #729fcf
|
||||||
border_marked = #eeeeec
|
border_marked = #eeeeec
|
||||||
|
|
||||||
# IMAGES
|
# IMAGES
|
||||||
layout_dwindle = @AWESOME_THEMES_PATH@/sky/layouts/dwindle.png
|
|
||||||
layout_fairh = @AWESOME_THEMES_PATH@/sky/layouts/fairh.png
|
layout_fairh = @AWESOME_THEMES_PATH@/sky/layouts/fairh.png
|
||||||
layout_fairv = @AWESOME_THEMES_PATH@/sky/layouts/fairv.png
|
layout_fairv = @AWESOME_THEMES_PATH@/sky/layouts/fairv.png
|
||||||
layout_floating = @AWESOME_THEMES_PATH@/sky/layouts/floating.png
|
layout_floating = @AWESOME_THEMES_PATH@/sky/layouts/floating.png
|
||||||
layout_magnifier = @AWESOME_THEMES_PATH@/sky/layouts/magnifier.png
|
layout_magnifier = @AWESOME_THEMES_PATH@/sky/layouts/magnifier.png
|
||||||
layout_max = @AWESOME_THEMES_PATH@/sky/layouts/max.png
|
layout_max = @AWESOME_THEMES_PATH@/sky/layouts/max.png
|
||||||
layout_fullscreen = @AWESOME_THEMES_PATH@/sky/layouts/fullscreen.png
|
layout_fullscreen = @AWESOME_THEMES_PATH@/sky/layouts/fullscreen.png
|
||||||
layout_spiral = @AWESOME_THEMES_PATH@/sky/layouts/spiral.png
|
|
||||||
layout_tilebottom = @AWESOME_THEMES_PATH@/sky/layouts/tilebottom.png
|
layout_tilebottom = @AWESOME_THEMES_PATH@/sky/layouts/tilebottom.png
|
||||||
layout_tileleft = @AWESOME_THEMES_PATH@/sky/layouts/tileleft.png
|
layout_tileleft = @AWESOME_THEMES_PATH@/sky/layouts/tileleft.png
|
||||||
layout_tile = @AWESOME_THEMES_PATH@/sky/layouts/tile.png
|
layout_tile = @AWESOME_THEMES_PATH@/sky/layouts/tile.png
|
||||||
|
|
|
@ -210,7 +210,7 @@ titlebar_client_attach(client_t *c, wibox_t *t)
|
||||||
t->need_update = true;
|
t->need_update = true;
|
||||||
|
|
||||||
/* This may seem useless, but it's the cleanest way to avoid seeing titlebars for banned clients. */
|
/* This may seem useless, but it's the cleanest way to avoid seeing titlebars for banned clients. */
|
||||||
titlebar_update_geometry_floating(c);
|
titlebar_update_geometry(c);
|
||||||
|
|
||||||
if(t->isvisible)
|
if(t->isvisible)
|
||||||
xcb_map_window(globalconf.connection, t->sw.window);
|
xcb_map_window(globalconf.connection, t->sw.window);
|
||||||
|
@ -342,7 +342,7 @@ luaA_titlebar_newindex(lua_State *L, wibox_t *titlebar, awesome_token_t tok)
|
||||||
titlebar->position = position;
|
titlebar->position = position;
|
||||||
if((c = client_getbytitlebar(titlebar)))
|
if((c = client_getbytitlebar(titlebar)))
|
||||||
{
|
{
|
||||||
titlebar_update_geometry_floating(c);
|
titlebar_update_geometry(c);
|
||||||
/* call geometry hook for client because some like to
|
/* call geometry hook for client because some like to
|
||||||
* set titlebar width in that hook, which make sense */
|
* set titlebar width in that hook, which make sense */
|
||||||
hooks_property(c, "geometry");
|
hooks_property(c, "geometry");
|
||||||
|
|
16
titlebar.h
16
titlebar.h
|
@ -118,19 +118,18 @@ titlebar_geometry_remove(wibox_t *t, int border, area_t geometry)
|
||||||
return geometry;
|
return geometry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update the titlebar geometry for a tiled client.
|
/** Update the titlebar geometry for a client.
|
||||||
* \param c The client.
|
* \param c The client.
|
||||||
* \param geometry The geometry the client will receive.
|
|
||||||
*/
|
*/
|
||||||
static inline void
|
static inline void
|
||||||
titlebar_update_geometry_tiled(client_t *c, area_t geometry)
|
titlebar_update_geometry(client_t *c)
|
||||||
{
|
{
|
||||||
area_t geom;
|
area_t geom;
|
||||||
|
|
||||||
if(!c->titlebar)
|
if(!c->titlebar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
titlebar_geometry_compute(c, geometry, &geom);
|
titlebar_geometry_compute(c, c->geometry, &geom);
|
||||||
/* Can't actually move titlebar right now, but we will resize it. */
|
/* Can't actually move titlebar right now, but we will resize it. */
|
||||||
if(c->isbanned)
|
if(c->isbanned)
|
||||||
{
|
{
|
||||||
|
@ -149,14 +148,5 @@ titlebar_update_geometry_tiled(client_t *c, area_t geometry)
|
||||||
wibox_moveresize(c->titlebar, geom);
|
wibox_moveresize(c->titlebar, geom);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Update the titlebar geometry for a floating client.
|
|
||||||
* \param c The client.
|
|
||||||
*/
|
|
||||||
static inline void
|
|
||||||
titlebar_update_geometry_floating(client_t *c)
|
|
||||||
{
|
|
||||||
return titlebar_update_geometry_tiled(c, c->geometry);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// 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
|
||||||
|
|
2
wibox.c
2
wibox.c
|
@ -919,7 +919,7 @@ luaA_wibox_newindex(lua_State *L)
|
||||||
wibox_position_update(*wibox);
|
wibox_position_update(*wibox);
|
||||||
break;
|
break;
|
||||||
case WIBOX_TYPE_TITLEBAR:
|
case WIBOX_TYPE_TITLEBAR:
|
||||||
titlebar_update_geometry_floating(client_getbytitlebar(*wibox));
|
titlebar_update_geometry(client_getbytitlebar(*wibox));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue