forked from lcpz/awesome-copycats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
switch-theme.sh
executable file
·41 lines (32 loc) · 944 Bytes
/
switch-theme.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#! /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 $@