Permalink
Browse files

Stop duplicating dzen2 invocations throughout scripts.

Easier to switch args too!
  • Loading branch information...
1 parent 6e29c5c commit c562f5e7d80705a29ad70cac2477dd7c938ea6d1 @JNRowe committed Jun 17, 2011
Showing with 11 additions and 14 deletions.
  1. +2 −4 open_selection
  2. +1 −2 start_tool
  3. +3 −6 tea.sh
  4. +4 −0 tool_settings.sh
  5. +1 −2 url_add
View
@@ -6,10 +6,8 @@ source $(dirname $(readlink -f ${0}))/tool_settings.sh
link=$(xsel)
if [ -z "${link}" ]
then
- dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "No text in selection"
+ dzen_text <<< "No text in selection"
else
- dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "Opening link from selection - ${link}"
+ dzen_text <<< "Opening link from selection - ${link}"
xdg-open "${link}"
fi
View
@@ -8,6 +8,5 @@ source $(dirname $(readlink -f ${0}))/tool_settings.sh
[ -z "$1" ] && exit 1
app=$1
shift
-dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "${NAME:-${app##*/}} starting" &
+dzen_text <<< "${NAME:-${app##*/}} starting" &
exec ${app} $@
View
9 tea.sh
@@ -5,11 +5,9 @@
source $(dirname $(readlink -f ${0}))/tool_settings.sh
brew() {
- dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "Brewing tea - Sit back and relax"
+ dzen_text <<< "Brewing tea - Sit back and relax"
sleep ${1}m
- dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "Tea ready - Go and get it"
+ dzen_text <<< "Tea ready - Go and get it"
}
case "${1}" in
@@ -21,7 +19,6 @@ ginger)
brew 3.5 ;;
*)
for i in {1..3}; do echo -e '\007'; sleep 0.25s; done &
- dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "tea.sh - ^fg(#ff0000)Unknown tea type"
+ dzen_text <<< "tea.sh - ^fg(#ff0000)Unknown tea type"
exit 1
esac
View
@@ -8,3 +8,7 @@ _gen_font_string() {
FONT=$(_gen_font_string)
SMALL_FONT=$(_gen_font_string 14)
TIMEOUT=3
+
+dzen_text() {
+ dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT}
+}
View
@@ -9,5 +9,4 @@ source $(dirname $(readlink -f ${0}))/tool_settings.sh
[ -z "${url}" ] && exit 1
ftype=${${0:t}%_*}s
echo "${url}" >> ~/${ftype}
-dzen2 -fg ${FOREGROUND} -bg ${BACKGROUND} -fn ${FONT} -p ${TIMEOUT} \
- <<< "${url} added to ${ftype}" &
+dzen_text <<< "${url} added to ${ftype}"

0 comments on commit c562f5e

Please sign in to comment.