1
0
Fork 0
mirror of https://github.com/lcpz/awesome-copycats.git synced 2024-12-23 11:32:32 +00:00
awesome-copycats/switch-theme.sh
2014-04-12 18:02:00 +02:00

42 lines
944 B
Bash
Executable file

#! /usr/bin/make -f
# Awesome Copycats switch theme script
# It also updates to latest commit.
# Dependencies: make, git
DESTDIR=~/.config/awesome
PROJECT=copycat-killer/awesome-copycats
# $(swap_dialog)
define swap_dialog
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 ) ; \
cp $${NEW_THEME} rc.lua ; \
echo "Theme is now $${NEW_THEME}"; \
else echo " !! Aborted. " ; fi
endef
# $(themes)
themes=find rc.lua* -not -name rc.lua
# number of current themes
n_themes=$(themes) | wc -l
.SILENT : all
all: $(DESTDIR)
cd $(DESTDIR) && \
echo -n $(git pull)#"Already up-to-date."; \
git submodule init ; \
git submodule update; \
$(swap_dialog)
$(DESTDIR):
git clone https://github.com/${PROJECT}.git $@