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