diff --git a/common/twitnit.sh b/common/twitnit.sh new file mode 100755 index 0000000..3d73364 --- /dev/null +++ b/common/twitnit.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# Requires xsel +if ! xsel --version &>/dev/null || ! notify-send --version &>/dev/null; then + echo "Make sure this machien has xsel and notify-send" + exit +fi + +# Make sure naked domain is at end +m=("mobile.twitter.com" "m.twitter.com" "twitter.com") +r="nitter.eu" +clip=$(xsel -p -l /tmp/xsel.log) + +for f in ${m[@]}; do + echo "looking for $f" + if echo "$clip" | grep "$f"; then + echo "Found!" + clip=$(echo $clip | sed -e "s/${f}/${r}/g" | tr -d '\n' | xsel -ib) + notify-send -a TwitNit "Changed $f to $r" + fi +done