From 691e68d90afdfb9d9a8a13b742a55ff0f2ef63b9 Mon Sep 17 00:00:00 2001 From: Siina Mashek Date: Mon, 25 Apr 2022 04:44:21 +0300 Subject: [PATCH] Adding twitter -> nitter script to modify clipboard --- common/twitnit.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 common/twitnit.sh 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