From f183c081cbece4ab7309ef05d2229ff89c9b0441 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Wed, 30 Nov 2011 12:31:43 +0000 Subject: screenshot support git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@492 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- publish | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'publish') 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 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 -- cgit v1.2.3