summaryrefslogtreecommitdiff
path: root/publish
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2011-11-30 12:31:43 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2011-11-30 12:31:43 +0000
commitf183c081cbece4ab7309ef05d2229ff89c9b0441 (patch)
tree112f70a8b21929fecc1115deaa7157ec55e7fa72 /publish
parent850faeb1ef267511cecc75fbb13851430abb1501 (diff)
screenshot support
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@492 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
Diffstat (limited to 'publish')
-rwxr-xr-xpublish18
1 files changed, 16 insertions, 2 deletions
diff --git a/publish b/publish
index f9272dd..029a094 100755
--- a/publish
+++ b/publish
@@ -1,7 +1,7 @@
#!/bin/bash
# Copyright (c) 2009 Florian Reitmeir
-# Copyright (c) 2009 Peter Palfrader
+# Copyright (c) 2009,2011 Peter Palfrader
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
@@ -69,6 +69,7 @@ copy the file <src> to a server an report the URL.
OPTIONS:
-n no-do. Just print what would have been done
-s Show the history
+ -S Make a screenshot of one window and publish.
-x Publish the contents of the xclipboard
-h Show this message
EOF
@@ -97,8 +98,9 @@ history_show() {
NODO=""
inputxclip=0
+do_screenshot=0
-while getopts "hnsx" OPTION
+while getopts "hnsSx" OPTION
do
case $OPTION in
h)
@@ -120,6 +122,9 @@ do
exit 3
fi
;;
+ S)
+ do_screenshot=1
+ ;;
*)
usage >&2
exit 1
@@ -128,6 +133,15 @@ do
done
shift $(($OPTIND - 1))
+if [[ "$do_screenshot" -gt 0 ]]; then
+ img=`tempfile --suffix=.png --prefix=sshot`
+ trap "rm -f '$img'" EXIT
+ import "$img"
+ chmod a+r "$img"
+ set dummy "$img" "$@"
+ shift
+fi
+
if [[ "$#" = 0 ]]; then
stdin=`tempfile`
trap "rm -f '$stdin'" EXIT