diff --git a/Makefile.am b/Makefile.am index 20ebb38b..81847928 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 57987521..f45750ff 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 00000000..9f4e10e1 --- /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 "};"