Adding twitter -> nitter script to modify clipboard
This commit is contained in:
parent
997c937320
commit
691e68d90a
1 changed files with 20 additions and 0 deletions
20
common/twitnit.sh
Executable file
20
common/twitnit.sh
Executable file
|
@ -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
|
Loading…
Reference in a new issue