#open-several-tabs-with-xdotool-slowly-and-easily
#!/bin/bash
#pathtabs.list
if [ ! -f ~/pathtabs.list ]; then
echo ~/foo_00 > pathtabs.list
echo ~/foo_00/foo_00_1 >> pathtabs.list
echo ~/foo_00/foo_00_2 >> pathtabs.list
echo ~/foo_00/foo_00_2/foo_00_2_1 >> pathtabs.list
fi
echo 'pathtabs.list: has a list of paths for the new tabs'
#mkdirs
if [ ! -d ~/foo_00/ ]; then
mkdir foo_00
mkdir foo_00/foo_00_1
mkdir foo_00/foo_00_2
mkdir foo_00/foo_00_2/foo_00_2_1
fi
echo 'mkdirs: testing foo_*'
##commtabs.list
if [ ! -f ~/commtabs.list ]; then
echo nano newfile1.txt > commtabs.list
echo nano newfile2.txt >> commtabs.list
echo nano newfile3.txt >> commtabs.list
echo nano newfile4.txt >> commtabs.list
fi
echo 'commtabs.list: has a list of commands to run on the new tabs'
#pathtabs.list+commtabs.list+options
if [ ! -f ~/pathncommtabs.list ]; then
cat pathtabs.list |sed 's/.*/cd &;/'|sed '1s/^/c+s+t;/'|
paste - commtabs.list|tr -d '\t' |sed '$!s/$/;c+s+t/' > pathncommtabs.list
fi
echo 'pathncommtabs.list: integrates pathtabs.list+commtabs.list+cd+;+(new-tab-tokens)'
#autopctab.sh <anypathncommtabs.list>
if [ ! -f ~/autopctab.sh ]; then
echo '#!/bin/bash' > autopctab.sh
echo 'cat $1| sed '''s/ /#/g'''| sed '''s/(.)/\1 /g'''|sed '''s/#/space/g'''|
sed '''s/~/asciitilde/g'''|sed '''s/_/underscore/g'''|sed '''s/c + s + t/control+shift+t/g'''|
sed '''s///slash/g'''|sed '''s/./period/g'''|sed '''s/;/Return/g'''|
sed '''s/.*/xdotool key --delay 18 & Return/'''' >> autopctab.sh
chmod u+x autopctab.sh
fi
echo 'autopctab.sh: xdotool-format paths+commands+(xdotool-commands)'
#run autopctab.sh <pathncommtabs.list>
#makepctabs.sh
if [ ! -f ~/makepctabs.sh ]; then
echo '#!/bin/bash' > makepctabs.sh
./autopctab.sh pathncommtabs.list >> makepctabs.sh
chmod u+x makepctabs.sh
fi
echo 'makepctabs.sh: run xdotool command lines to OPEN new tabs AND RUN commands with pathncommtabs.list'
#autotab.sh <anytabs.list>
if [ ! -f ~/autotab.sh ]; then
echo '#!/bin/bash' > autotab.sh
echo 'cat $1|sed '''s/./cd &/'''|sed '''s/ /#/g'''|
sed '''s/(.)/\1 /g'''|sed '''s/#/space/g'''|
sed '''s/~/asciitilde/g'''|sed '''s/_/underscore/g'''|
sed '''s///slash/g'''|sed '''s/./period/g'''|
sed '''s/./xdotool key --delay 18 control+shift+t space c d space asciitilde Return & Return c l e a r Return/'''' >> autotab.sh
chmod u+x autotab.sh
fi
echo 'autotab.sh: xdotool-format ONLY paths+(xdotool-commands)'
#run autotab.sh <pathtabs.list>
#maketabs.sh
if [ ! -f ~/maketabs.sh ]; then
echo '#!/bin/bash' > maketabs.sh
./autotab.sh pathtabs.list >> maketabs.sh
chmod u+x maketabs.sh
fi
echo 'maketabs.sh: run xdotool command lines ONLY to open new tabs with pathtabs.list'
#run-maketabs?
#./maketabs.sh
#remove-maketabs.sh?
#remove-autotab.sh?
#rm autotab.sh
#remove-pathtabs.list?
#rm pathtabs.list
#run-makepctabs?
#./makepctabs.sh
#remove-makepctabs.sh?
#rm makepctabs.sh
#remove-autopctab.sh?
#rm autopctab.sh
#remove-pathncommtabs.list?
#rm pathncommtabs.list
#remove-dirs?
#rm -r foo_0?
#echo See also 'https://askubuntu.com/a/380320'
#echo ' https://www.semicomplete.com/projects/xdotool/'
#echo ' https://github.com/jordansissel/xdotool'
.bashrc
and typinggnome-terminal --tab -- 'bash -c "export BASH_POST_RC=\"vim todo.txt\"; exec bash"'
doesn't work, too. – TravelTrader Jan 20 '19 at 09:24eval "$BASH_POST_RC"
(literally!) to the end of your~/.bashrc
and run e.g.:gnome-terminal --tab -e 'bash -c "export BASH_POST_RC=\"vim todo.txt\"; exec bash"' --working-directory="$HOME/Files" --tab -e 'exec bash'
I’m not sure about the last-e 'exec bash'
, try with and without it. – dessert Jan 20 '19 at 11:49gnome-terminal
isn't a possibility for solving my wish? – TravelTrader Jan 20 '19 at 15:20