aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2018-10-06 20:30:32 -0300
committerSilvio Rhatto <rhatto@riseup.net>2018-10-06 20:30:32 -0300
commitf3e187c7b1f2a0985438275187a19dab8f44dc18 (patch)
treece50d2a39769e336c0734e774c3a384f02354cd7
parent04c9b3044e9dfac52d7f2fa3c828b7ac2c95a2bd (diff)
downloadutils-x11-f3e187c7b1f2a0985438275187a19dab8f44dc18.tar.gz
utils-x11-f3e187c7b1f2a0985438275187a19dab8f44dc18.tar.bz2
Adds spoolpaste
-rwxr-xr-xspoolpaste31
1 files changed, 31 insertions, 0 deletions
diff --git a/spoolpaste b/spoolpaste
new file mode 100755
index 0000000..2a37324
--- /dev/null
+++ b/spoolpaste
@@ -0,0 +1,31 @@
+#!/bin/bash
+#
+# Puts clipboard content in a file as a markdown citation.
+#
+
+# Setup
+BASENAME="`basename $0`"
+SPOOL="$HOME/temp/log/spool.md"
+
+if [ ! -z "$1" ]; then
+ mkdir -p "`dirname $*`"
+ touch "$*"
+
+ # 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 "$*" $SPOOL
+
+ echo Set $SPOOL to "$*"
+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