diff options
-rwxr-xr-x | publish | 18 |
1 files changed, 16 insertions, 2 deletions
@@ -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 |