[bin] Re-add i3bar load script
This commit is contained in:
parent
8bde4845e0
commit
c3214a8a3b
1 changed files with 26 additions and 0 deletions
26
bin/load-i3-bars.sh
Executable file
26
bin/load-i3-bars.sh
Executable 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
|
Loading…
Reference in a new issue