[bin] Re-add i3bar load script

This commit is contained in:
Tobi-wan Kenobi 2016-12-11 13:05:49 +01:00
parent 8bde4845e0
commit c3214a8a3b

26
bin/load-i3-bars.sh Executable file
View file

@ -0,0 +1,26 @@
#!/usr/bin/env bash
if [ ! -f ~/.i3/config.template ]; then
cp ~/.i3/config ~/.i3/config.template
else
cp ~/.i3/config.template ~/.i3/config
fi
screens=$(xrandr -q|grep ' connected'| grep -P '\d+x\d+' |cut -d' ' -f1)
echo "screens: $screens"
while read -r line; do
screen=$(echo $line | cut -d' ' -f1)
others=$(echo $screens|tr ' ' '\n'|grep -v $screen|tr '\n' '-'|sed 's/.$//')
if [ -f ~/.i3/config.$screen-$others ]; then
cat ~/.i3/config.$screen-$others >> ~/.i3/config
else
if [ -f ~/.i3/config.$screen ]; then
cat ~/.i3/config.$screen >> ~/.i3/config
fi
fi
done <<< "$screens"
i3-msg restart