Created
April 10, 2017 11:27
-
-
Save untoreh/24e36b14137556e90dd1613086aa4e0b to your computer and use it in GitHub Desktop.
incremental steps i3wm window move command
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
verse=$1 | |
stu=20 | |
tapf=/tmp/i3-tap | |
stepf=/tmp/i3-step | |
verf=/tmp/i3-verse | |
if [ ! -f $tapf ] ; then | |
echo `date +%s` > $tapf | |
fi | |
if [ ! -f $verf ] ; then | |
echo $verse > $verf | |
lverse=$verse | |
else | |
lverse=`cat $verf` | |
echo $verse > $verf | |
fi | |
last=`cat $tapf` | |
current=`date +%s` | |
if [ ! -f $stepf ] ; then | |
echo $stu > $stepf | |
step=$stu | |
else | |
cstep=`cat $stepf` | |
step=$(( cstep + $stu )) > $stepf | |
fi | |
if [ "$verse" = "$lverse" -a $(( current - last )) -lt 2 ] ; then | |
i3-msg move $verse $step | |
echo $step > $stepf | |
else | |
i3-msg move $verse $stu | |
echo $stu > $stepf | |
fi | |
echo $current > $tapf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment