The following shellscript works for me in Ubuntu 18.04 LTS. If you have another desktop environment, you should edit the script's wcorr
and hcorr
values in order to match the screen.
I suggest the name l4t
for the shellscript,
#!/bin/bash
wcorr=68 # manual fix for vertical panels
hcorr=26 # manual fix for horizontal panels
tmps=$(LANG=C xrandr|grep -om1 'current.*,')
tmps=${tmps/,}
tmps=${tmps/current }
echo "screen resolution = $tmps pixels"
wscr=${tmps/ x*}
hscr=${tmps/*x }
wter=$(( (wscr-wcorr)/2 ))
hter=$(( (hscr-hcorr)/2 ))
echo "terminal width = $wter pixels"
echo "terminal height = $hter pixels"
terminator --borderless --geometry="${wter}x${hter}+0+0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}+0-0" -x run1.sh &
terminator --borderless --geometry="${wter}x${hter}-0+0" -x run2.sh &
terminator --borderless --geometry="${wter}x${hter}-0-0" -x run2.sh &
I have tested the function with the following scripts run1.sh
and run1.sh
run1.sh
:
#!/bin/bash
cnt=0
while [ $cnt -lt 10 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt+1))
done
echo ""
bash
run1.sh
:
#!/bin/bash
cnt=9
while [ $cnt -ge 0 ]
do
echo -n "$cnt"
sleep 1
cnt=$((cnt-1))
done
echo ""
bash
I put a bash command at the end of these scripts. Otherwise the terminal windows would be closed after the scripts have finished. You may want to do something else.
Make the three shellscripts executable
chmod +x l4t run1.sh run2.sh
and move them to a directory in PATH,
mv l4t run1.sh run2.sh /usr/local/bin/
Now you can run them just with the name like any other command.
l4t