autogenerate layout list

This commit is contained in:
Julien Danjou 2008-01-16 09:02:25 +01:00
parent 5def70a8f0
commit 8416705a20
3 changed files with 25 additions and 12 deletions

View File

@ -68,6 +68,13 @@ uicbgen.h: $(awesome_SOURCES)
@echo "generating uicbgen.h from headers file" @echo "generating uicbgen.h from headers file"
@$(top_srcdir)/uicbgen.sh > $(top_srcdir)/uicbgen.h @$(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 CLEANFILES += widgetgen.h
BUILT_SOURCES += widgetgen.h BUILT_SOURCES += widgetgen.h
EXTRA_DIST += widgetgen.sh EXTRA_DIST += widgetgen.sh

View File

@ -38,18 +38,7 @@
extern AwesomeConf globalconf; extern AwesomeConf globalconf;
const name_func_link_t LayoutList[] = #include "layoutgen.h"
{
{"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}
};
/** Arrange windows following current selected layout /** Arrange windows following current selected layout
* \param screen the screen to arrange * \param screen the screen to arrange

17
layoutgen.sh Executable file
View File

@ -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 "};"