#!/bin/sh # Grabs a osu! beatmap url from the clipboard, opens a xterm window # and curls the beatmap into oppai, adding the command into the # bash history. # # Requires https://github.com/Francesco149/oppai pattern="https://osu.ppy.sh/b/*" clip=$(xclip -o) if [[ "$clip" =~ $pattern ]] then id=${clip#$pattern} escapedid=$(printf "%q" "$id") # TODO: fix this escaping mess echo ". \"$HOME/.bashrc\"; " \ "history -s " \ "curl \\\"https://osu.ppy.sh/osu/$escapedid\\\" \\| " \ "oppai - " > $HOME/oppainit xterm +hold -e \ "curl \"https://osu.ppy.sh/osu/$id\" | oppai - bash --init-file $HOME/oppainit" fi