Skip to content

Commit 99a806a

Browse files
committed
Migrate to import based system for compositional configs
1 parent 50fc8ad commit 99a806a

File tree

26 files changed

+319
-1694
lines changed

26 files changed

+319
-1694
lines changed

i3_gen/components/base/default

-43
This file was deleted.

i3_gen/components/colors/base

-33
This file was deleted.

i3_gen/components/colors/gruvbox

-33
This file was deleted.

i3_gen/components/keybinds/default

-117
This file was deleted.

i3_gen/components/style/plaindark

-73
This file was deleted.

i3_gen/config.example

-5
This file was deleted.
File renamed without changes.

i3_gen/dunst/generate.sh

-5
This file was deleted.

i3_gen/generate.sh

+20-21
Original file line numberDiff line numberDiff line change
@@ -3,33 +3,32 @@
33
# This script generates a new i3 config from the files in the "components"
44
# directory.
55

6-
76
GEN_DIR=$HOME/.config/i3/i3_gen
8-
97
cd $GEN_DIR
108

11-
source $GEN_DIR/.preset
12-
cat $GEN_DIR/.preset
13-
14-
#define local folders
15-
I3_CONFIG="$HOME/.config/i3/config"
16-
I3_CONFIG_SPEC="$GEN_DIR/config"
17-
18-
I3_CONFIG_COMPONENTS="$GEN_DIR/components"
19-
20-
#clear the old i3 config file
21-
rm "$I3_CONFIG"
22-
touch "$I3_CONFIG"
23-
24-
#For all the files listed in I3_CONFIG_SPEC file, append them to the config
25-
cat $I3_CONFIG_SPEC | while read line
9+
# load defaults
10+
SWITCHER_DEFAULTS="./switcher_defaults"
11+
if [ -f $SWITCHER_DEFAULTS ]; then
12+
source $SWITCHER_DEFAULTS
13+
cat $SWITCHER_DEFAULTS
14+
fi
15+
16+
# load preset
17+
PROFILE=$GEN_DIR/.preset
18+
if [ -f $PROFILE ]; then
19+
source $PROFILE
20+
cat $PROFILE
21+
fi
22+
23+
# generate all the configs
24+
for DIR in *.config
2625
do
27-
cat "$I3_CONFIG_COMPONENTS/$line" >> $I3_CONFIG
26+
echo --- Generating $DIR ---
27+
CONFIG_SOURCE=$DIR/*.template
28+
CONFIG_TARGET=../$(basename $CONFIG_SOURCE .template)
29+
./bash_expand.sh $CONFIG_SOURCE $CONFIG_TARGET
2830
done
2931

30-
# Expand the BASH-isms in the file
31-
$GEN_DIR/bash_expand.sh $I3_CONFIG
32-
3332
#reload the newly generated config
3433
i3 restart &> /dev/null
3534

0 commit comments

Comments
 (0)