2014-04-12 18:02:00 +02:00
|
|
|
#! /usr/bin/make -f
|
|
|
|
|
2016-08-17 19:01:46 +02:00
|
|
|
# awesome-copycats switch theme (and update) script
|
|
|
|
# dependencies: make, git
|
2015-02-01 12:01:29 +01:00
|
|
|
|
2014-04-12 18:02:00 +02:00
|
|
|
DESTDIR=~/.config/awesome
|
|
|
|
PROJECT=copycat-killer/awesome-copycats
|
|
|
|
|
|
|
|
# $(swap_dialog)
|
|
|
|
define swap_dialog
|
2016-08-17 19:01:46 +02:00
|
|
|
echo ; \
|
|
|
|
echo "see https://github.com/$(PROJECT)" ; \
|
|
|
|
echo ; $(themes) | cat -n ; echo ; \
|
|
|
|
typeset -i num; \
|
|
|
|
read -p "Switch to theme: " num ; \
|
|
|
|
if [ ! -z $${num} -a $${num} -ge 1 -a -le $${n_themes} ] ; then \
|
|
|
|
NEW_THEME=$$($(themes) | head -n$${num} | tail -n1 ) ; \
|
|
|
|
mv --backup=numbered rc.lua rc.lua.previous ; \
|
|
|
|
cp $${NEW_THEME} rc.lua ; \
|
|
|
|
echo "Theme is now $${NEW_THEME}"; \
|
|
|
|
else echo " !! Aborted. " ; fi
|
2014-04-12 18:02:00 +02:00
|
|
|
endef
|
|
|
|
|
|
|
|
# $(themes)
|
|
|
|
themes=find rc.lua* -not -name rc.lua
|
|
|
|
|
|
|
|
# number of current themes
|
|
|
|
n_themes=$(themes) | wc -l
|
|
|
|
|
|
|
|
.SILENT : all
|
|
|
|
|
|
|
|
all: $(DESTDIR)
|
2016-12-11 10:53:04 +01:00
|
|
|
cd $(DESTDIR) && \
|
|
|
|
echo -n $(git pull)#"Already up-to-date."; \
|
|
|
|
git submodule init ; \
|
|
|
|
git submodule update; \
|
|
|
|
$(swap_dialog)
|
2014-04-12 18:02:00 +02:00
|
|
|
|
|
|
|
$(DESTDIR):
|
2016-08-17 19:01:46 +02:00
|
|
|
git clone https://github.com/${PROJECT}.git $@
|