From 8416705a20ccc6a99dd6e1a79423f8d591536861 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 16 Jan 2008 09:02:25 +0100 Subject: [PATCH] autogenerate layout list --- Makefile.am | 7 +++++++ layout.c | 13 +------------ layoutgen.sh | 17 +++++++++++++++++ 3 files changed, 25 insertions(+), 12 deletions(-) create mode 100755 layoutgen.sh diff --git a/Makefile.am b/Makefile.am index 20ebb38b3..818479284 100644 --- a/Makefile.am +++ b/Makefile.am @@ -68,6 +68,13 @@ uicbgen.h: $(awesome_SOURCES) @echo "generating uicbgen.h from headers file" @$(top_srcdir)/uicbgen.sh > $(top_srcdir)/uicbgen.h +CLEANFILES += layoutgen.h +BUILT_SOURCES += layoutgen.h +EXTRA_DIST += layoutgen.sh +layoutgen.h: $(awesome_SOURCES) + @echo "generating layoutgen.h from layouts headers file" + @$(top_srcdir)/layoutgen.sh > $(top_srcdir)/layoutgen.h + CLEANFILES += widgetgen.h BUILT_SOURCES += widgetgen.h EXTRA_DIST += widgetgen.sh diff --git a/layout.c b/layout.c index 579875214..f45750ff9 100644 --- a/layout.c +++ b/layout.c @@ -38,18 +38,7 @@ extern AwesomeConf globalconf; -const name_func_link_t LayoutList[] = -{ - {"tile", layout_tile}, - {"tileleft", layout_tileleft}, - {"tiledown", layout_tiledown}, - {"tileup", layout_tileup}, - {"max", layout_max}, - {"spiral", layout_spiral}, - {"dwindle", layout_dwindle}, - {"floating", layout_floating}, - {NULL, NULL} -}; +#include "layoutgen.h" /** Arrange windows following current selected layout * \param screen the screen to arrange diff --git a/layoutgen.sh b/layoutgen.sh new file mode 100755 index 000000000..9f4e10e1a --- /dev/null +++ b/layoutgen.sh @@ -0,0 +1,17 @@ +#!/bin/sh +echo "/* This file is autogenerated by" $(basename $0) "*/" +echo +echo "const name_func_link_t LayoutList[] =" +echo "{" +for file in layouts/*.h +do + echo " /* $file */" + grep '^LayoutArrange layout_' $file | cut -d' ' -f2 | cut -d\; -f1 | while read layout + do + shortname=$(echo $layout | cut -d _ -f2-) + echo " {\"$shortname\", $layout}," + done +done + +echo " {NULL, NULL}" +echo "};"