- Refined Back/Forward/Undo Text/Tabs config for Linux

This commit is contained in:
Ben Reaves
2021-02-12 20:53:06 -06:00
parent c0bc49b150
commit b7f4c6c54d

View File

@@ -5,37 +5,60 @@ action=$1
saveClipboard=$(xclip -selection clipboard -o)
echo "" | xclip -i -selection clipboard
if [ "$action" == "Left" ];then
xdotool getactivewindow key --delay 40 --clearmodifiers End bar Shift+Left ctrl+x
xdotool getactivewindow key --delay 40 --clearmodifiers End Shift+Left ctrl+c
firstClipboard=$(xclip -selection clipboard -o)
if [ "${#firstClipboard}" > 1 ];then
firstClipboard=${firstClipboard: -1}
fi
echo "" | xclip -i -selection clipboard
xdotool getactivewindow key --delay 24 --clearmodifiers Left Shift+Right ctrl+c Right
fi
if [ "$action" == "Right" ];then
xdotool getactivewindow key --delay 40 --clearmodifiers Home bar Shift+Left ctrl+x
fi
if [ "$action" == "Undo" ];then
xdotool getactivewindow key --delay 24 --clearmodifiers bar Shift+Left ctrl+x
sleep 0.1
if [ "$action" == "Right" ] || [ "$action" == "Undo" ];then
xdotool getactivewindow key --delay 40 --clearmodifiers Home Shift+Right ctrl+c
firstClipboard=$(xclip -selection clipboard -o)
if [ "${#firstClipboard}" > 1 ];then
firstClipboard=${firstClipboard:0:1}
fi
echo "" | xclip -i -selection clipboard
xdotool getactivewindow key --delay 24 --clearmodifiers Right Shift+Left ctrl+c Left
fi
newClipboard=$(xclip -selection clipboard -o)
# echo "$newClipboard"
# echo ${#firstClipboard}
# echo "$firstClipboard""-"
# echo "first"
# echo ${#newClipboard}
# echo "$newClipboard""-"
# echo "hello"
if [ "$newClipboard" != "|" ] && [ "$action" == "Left" ];then
xdotool getactivewindow key --clearmodifiers alt+Left
elif [ "$action" == "Left" ];then
if [ "$action" == "Undo" ] && [ "$newClipboard" == "" ] && [ "$firstClipboard" == "" ];then
xdotool getactivewindow key --delay 24 --clearmodifiers bar Shift+Left ctrl+c Left
firstClipboard=$(xclip -selection clipboard -o)
echo "" | xclip -i -selection clipboard
xdotool getactivewindow key --delay 24 --clearmodifiers Shift+Right ctrl+x
newClipboard=$(xclip -selection clipboard -o)
if [ "$newClipboard" != "" ] && [ "$firstClipboard" != "" ];then
xdotool getactivewindow key --delay 24 --clearmodifiers ctrl+z ctrl+z
fi
fi
if [ "$action" == "Left" ] && [ "$newClipboard" != "" ] && [ "$newClipboard" == "$firstClipboard" ];then
xdotool getactivewindow key --clearmodifiers Home
elif [ "$action" == "Left" ];then
xdotool getactivewindow key --clearmodifiers alt+Left
fi
if [ "$newClipboard" != "|" ] && [ "$action" == "Right" ];then
xdotool getactivewindow key --clearmodifiers alt+Right
elif [ "$action" == "Right" ];then
if [ "$action" == "Right" ] && [ "$newClipboard" != "" ] && [ "$newClipboard" == "$firstClipboard" ];then
xdotool getactivewindow key --clearmodifiers End
elif [ "$action" == "Right" ];then
xdotool getactivewindow key --clearmodifiers alt+Right
fi
if [ "$newClipboard" != "|" ] && [ "$action" == "Undo" ];then
xdotool getactivewindow key ctrl+Shift+t
if [ "$action" == "Undo" ] && [ "$newClipboard" != "" ] && [ "$newClipboard" == "$firstClipboard" ];then
xdotool getactivewindow key --delay 24 --clearmodifiers ctrl+z
elif [ "$action" == "Undo" ];then
xdotool getactivewindow key --delay 24 --clearmodifiers ctrl+z ctrl+z ctrl+z
xdotool getactivewindow key ctrl+Shift+t
fi
echo $saveClipboard | xclip -i -selection clipboard