blob: f758fc0330f72b494ce5b73924476e1c3e9a9db3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#!/bin/bash
#
# Puts clipboard content in a file as a markdown citation.
#
# Setup
BASENAME="`basename $0`"
#SPOOL="$HOME/load/spool.md"
SPOOL="$HOME/temp/log/spool.md"
if [ ! -z "$1" ]; then
# Ensure dest file exists
if [ ! -e "$*" ]; then
mkdir -p "`dirname $*`"
touch "$*"
fi
# Get absolute filename
DIR="$(cd `dirname $*` > /dev/null && pwd)"
FILE="$DIR/`basename $*`"
# Set current spool file
#if [ -e "$SPOOL" ] && [ "`wc -l $SPOOL`" != "0" ]; then
if [ -e "$SPOOL" ] && [ -s "$SPOOL" ]; then
echo "Spool $SPOOL not empty. Please clean it first."
exit 1
fi
rm -f $SPOOL && ln -s "$FILE" $SPOOL
echo Set $SPOOL to "$FILE"
else
echo -e "\n [...]\n" >> $SPOOL
xclip -o | sed -e 's/^\([^ ]\)/ \1/' >> $SPOOL
truncated="$(xclip -o | tr '"' "'" | tr '\n' ' ' | cut -c 1-30)..."
echo "naughty.notify({title = \"Pasted into SPOOL:\", text =\"$truncated\", timeout = 2})" | awesome-client
fi
|