From 329265f2844b07d99efa7d97b98e3f0a13eaf794 Mon Sep 17 00:00:00 2001 From: Dylan Date: Fri, 8 Jan 2016 16:08:00 +1100 Subject: [PATCH] Added the ability to take a screenshot. Fixed doubled cpu speed on linux --- Readme.md | 5 +++++ fetch | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) diff --git a/Readme.md b/Readme.md index a2114c6e..975432e5 100644 --- a/Readme.md +++ b/Readme.md @@ -122,6 +122,11 @@ Please report any bugs or issues you're having with this as I can't to the top edge of the window --clean Remove all cropped images + Screenshot: + --scrot Take a screenshot + --scrotdir Directory to save the scrot + --scrotfile File name of scrot + Other: --help Print this text and exit ``` diff --git a/fetch b/fetch index d877eed2..4607aa1c 100755 --- a/fetch +++ b/fetch @@ -205,6 +205,27 @@ xoffset=0 # }}} +# Other Options {{{ + + +# Take a screenshot +# --scrot on/off +scrot="off" + +# Scrot dir +# Where to save the screenshots +# --scrotdir /path/to/screenshot/folder +scrotdir="$HOME/Pictures" + +# Scrot filename +# What to name the screenshots +# --scrot +scrotname="fetch-%Y-%m-%d-%H:%M.png" + + +# }}} + + # }}} @@ -436,6 +457,7 @@ getcpu () { # Get cpu name cpu="$(grep -F 'model name' /proc/cpuinfo)" cpu=${cpu/model name*: /} + cpu=${cpu/ @*/} # Get cpu speed speed_type=${speed_type/rent/} @@ -740,6 +762,10 @@ getimage () { img="$imgtempdir/$imgname" } +takescrot () { + scrot -c -d 3 "$scrotdir/$scrotname" +} + # }}} @@ -844,6 +870,11 @@ usage () { cat << EOF to the top edge of the window --clean Remove all cropped images + Screenshot: + --scrot Take a screenshot + --scrotdir Directory to save the scrot + --scrotfile File name of scrot + Other: --help Print this text and exit @@ -912,6 +943,11 @@ while [ "$1" ]; do --gap) gap="$2" ;; --clean) rm -rf "$imgtempdir" || exit ;; + # Screenshot + --scrot|-s) scrot="on" ;; + --scrotdir) scrot="$2" ;; + --scrotfile) scrot="$2" ;; + # Other --help) usage ;; esac @@ -1031,6 +1067,9 @@ printinfo # Move cursor to bottom and redisplay it. printf "%b%s" "\e[${lines}H\e[${prompt_height}A\e[?25h" +# If enabled take a screenshot +[ "$scrot" == "on" ] && takescrot + # }}}