From c3214a8a3b8c784a9bb8a3eca56f99ba1029571f Mon Sep 17 00:00:00 2001 From: Tobi-wan Kenobi Date: Sun, 11 Dec 2016 13:05:49 +0100 Subject: [PATCH] [bin] Re-add i3bar load script --- bin/load-i3-bars.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 bin/load-i3-bars.sh diff --git a/bin/load-i3-bars.sh b/bin/load-i3-bars.sh new file mode 100755 index 0000000..cbe0e95 --- /dev/null +++ b/bin/load-i3-bars.sh @@ -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