Compare commits

..

No commits in common. "76c67a86b7949f249c4dab35cae93670b1dcdf18" and "3080e4d02b17046c3e7076d1477cdb155c92a59c" have entirely different histories.

5 changed files with 99 additions and 1 deletions

20
common/boop.sh Executable file
View file

@ -0,0 +1,20 @@
#!/bin/sh
#
# Siina's bootleg boop.icu uploader
#
# Requires:
# - xsel: for clipboard manipulation
# - curl: for uploading
remote="https://boop.icu"
sound="$HOME/Projects/local-bin/sounds/success.ogg"
# Make sure necessary applications are installed
if [[ ! -n "$(which xsel)" ]]; then echo "Please install xsel"; exit; fi
if [[ ! -n "$(which curl)" ]]; then echo "Please install curl"; exit; fi
url=$(curl -F"file=@$1" $remote)
echo "$url" | tr -d '\n' | xsel -ib -l /tmp/xsel.log
if [[ -n "$(which ffplay)" ]]; then
ffplay $sound -nodisp -autoexit -loglevel error
fi

58
common/scrot.sh Executable file
View file

@ -0,0 +1,58 @@
#!/bin/sh
#
# Siina's bootleg screenshot capturer for use with global keybinds
#
# Requires:
# - maim: takes the screenshot
# - imagemagick: for custom resolution sizes
# - boop.sh: uploads screenshot to boop.icu
# - Checks for SCREENSHOT_DIR environment variable
#
# Example global keybinds can be found in scrotsh.khotkeys
#
source ~/.profile # Workaround to avoid using /bin/bash
# Edit these to fit setup
sound="$HOME/Projects/local-bin/sounds/shutter.ogg"
filename="$(date +'%Y%m%d_%H%M%S').png"
main_res="1920x1080+0+529"
secondary_res="1080x1920+1920+0"
# Ensure screenshot directory is there so the script will work
if [[ ! -d $SCREENSHOT_DIR ]]; then
mkdir -p $SCREENSHOT_DIR
fi
cd $SCREENSHOT_DIR
# Setup is 1920x1590: main = 1920x1080; secondary = 1080x1920
if [[ ${1} == "--main" ]]; then
resolution=$main_res
elif [[ ${1} == "--secondary" ]]; then
resolution=$secondary_res
fi
# Set maim arguments based on command arguments
args="-m 9 -u"
if [[ ${1} == "--select" ]]; then
args="$args ${1}"
elif [[ ${1} == "--main" || ${1} == "--secondary" ]]; then
args="$args -g $resolution"
fi
# Take the screenshot with maim
maim -B $args $filename > /dev/null 2>&1
# cleanup for main monitor
if [[ ${1} == "--main" ]]; then
magick convert $filename -trim +repage $SCREENSHOT_DIR/$filename
fi
# Play sound if ffplay is available
if [[ -n "$(which ffplay)" ]]; then
ffplay $sound -nodisp -autoexit -loglevel error
fi
# Upload to boop if boop.sh is available
if [[ -n "$(which boop.sh)" ]]; then
boop.sh "$SCREENSHOT_DIR/$filename"
fi

20
common/twitnit.sh Executable file
View 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

View file

@ -25,4 +25,4 @@ if [[ $DATA == *"null"* ]]; then
exit exit
fi fi
printf "${LOCATION}: ${DESC:1:-1}, ${DATA[0]}°C (fl ${DATA[1]}°C)\n" printf "${LOCATION}: ${DESC:1:-1}, ${DATA[0]}°C (feels like ${DATA[1]}°C)\n"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 934 B