From b5bafb7e72e837b0d7117f9e046ddc765fea89fe Mon Sep 17 00:00:00 2001 From: "Adrian C. (anrxc)" Date: Fri, 8 Jan 2010 01:13:42 +0100 Subject: zshrc: added a snapshot timer --- zshrc | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-) (limited to 'zshrc') diff --git a/zshrc b/zshrc index 2f16e98..7036172 100644 --- a/zshrc +++ b/zshrc @@ -163,30 +163,21 @@ function x () { fi } -function scrot () { - if [[ -z $1 ]]; then - print -P "Usage: scrot [basename] [format]" - print -P "Take a desktop screenshot and generate a thumbnail." - else - if [ $2 ]; then - format=$2 - else - format=png - fi - timestamp=`date +%d%m%y-%H%M` - echo "Taking a screenshot..." - import -window root -quality 100 ~/$1-$timestamp.$format - echo "Generating a thumbnail..." - convert -resize 15% ~/$1-$timestamp.$format ~/$1-$timestamp.th.$format - echo "Saved as ~/$1-$timestamp.$format" - fi +function snap () { + [ $2 ] && tmout=$2 || tmout=5 + [ $3 ] && format=$3 || format=png + timestamp=`date +%d%m%y-%H%M` + echo -n "Snapshot in " + for (( i = $tmout; i >= 1; i-- )) do + echo -n "$i.. "; sleep 1 + done + import -window root -quality 100 ~/$1-$timestamp.$format + convert -resize "15%" ~/$1-$timestamp.$format ~/$1-$timestamp.th.$format + echo "saved as: ~/$1-$timestamp.$format" } function extract () { - if [[ -z "$1" ]]; then - print -P "Usage: extract filename" - print -P "Extract a given file based on the extension." - elif [[ -f "$1" ]]; then + if [[ -f "$1" ]]; then case "$1" in *.tbz2 | *.tar.bz2) tar -xvjf "$1" ;; *.txz | *.tar.xz) tar -xvJf "$1" ;; -- cgit v1.2.3