Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back/Forward/(Undo Text/Tabs) Enabled #497

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Prev Previous commit
Next Next commit
- Refined Back/Forward/Undo Text/Tabs config for Linux
  • Loading branch information
rbreaves committed Feb 13, 2021
commit b7f4c6c54d55a8dfdb67152521405346fbde2289
57 changes: 40 additions & 17 deletions linux/browsers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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