q.sh/q-clipboard

27 lines
523 B
Text
Raw Normal View History

2021-10-11 08:44:40 +00:00
#!/bin/bash
if [[ -z "$@" ]]; then
echo "^c .*$"
elif [[ "$1" == "--hint" ]]; then
shift
if [[ -f ~/.clipboard.txt ]]; then
cat ~/.clipboard.txt | tac
fi
elif [[ "$1" == "--complete" ]]; then
shift
if [[ -f ~/.clipboard.txt ]]; then
cat ~/.clipboard.txt | tac
fi
elif [[ "$1" == "--preview" ]]; then
shift
echo "$1" | base64 -d
elif [[ "$1" == "--run" ]]; then
shift
TEXT="$(echo "$1" | base64 -d)"
echo "$TEXT"
echo -n "$TEXT" | (nohup wl-copy -n 2>/dev/null &)
else
echo "Unexpected arguments: $@"
fi