summaryrefslogtreecommitdiff
path: root/zshrc
diff options
context:
space:
mode:
authorAdrian C. (anrxc) <anrxc@sysphere.org>2010-01-08 01:13:42 +0100
committerAdrian C. (anrxc) <anrxc@sysphere.org>2010-01-08 01:15:04 +0100
commitb5bafb7e72e837b0d7117f9e046ddc765fea89fe (patch)
tree902665ce570464ee2c429a92bab151c2b0537b9a /zshrc
parent0ac02700913069d0b519838b55aa7f3e14bfd8cd (diff)
downloaddotfiles-b5bafb7e72e837b0d7117f9e046ddc765fea89fe.tar.xz
zshrc: added a snapshot timer
Diffstat (limited to 'zshrc')
-rw-r--r--zshrc33
1 files changed, 12 insertions, 21 deletions
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" ;;