From d590971203fbc2bf55fc95abe7dc477c90f34011 Mon Sep 17 00:00:00 2001 From: Eirik Overby Date: Fri, 7 Feb 2025 01:42:55 +0100 Subject: [PATCH] Move usage(), actually show instructions if run without options. :P --- move.sh | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/move.sh b/move.sh index 1ae3d86..23efe7c 100644 --- a/move.sh +++ b/move.sh @@ -1,4 +1,32 @@ #!/bin/sh +usage() { + echo "${0} - Position hot-babe on screen." + echo 'Usage:' + echo " ${0} [] [ ] []" + echo ' where' + echo ' is the name of a theme directory in ~/.hot-babe or "default",' + echo ' is given in pixels or percentage of screensize (integer only),' + echo ' is given as left/right and top/bottom, respectively, and' + echo ' is above or below. This option can be given independently of the' + echo ' other positioning arguments; if given it must come last (or instead' + echo ' of the theme name).' + echo + echo 'If is not specified (or "default" is given), the script will try to' + echo 'find a running Hot Babe and determine if a "--dir " argument was given.' + echo + echo 'Note that this script will only make a limited effort at locating the' + echo 'files for the default theme; locate it and copy to your ~/.hot-babe if' + echo 'this fails.' + echo + echo 'Default values are: Zero margins, bottom-right alignment, below other windows.' + echo + exit 1 +} + +if [ $# -eq 0 ] ; then + usage +fi + #### Configuration/Defaults #### # Theme directory name @@ -60,30 +88,6 @@ Xalign=${3:-right} # Default right-edge Yalign=${4:-bottom} # Default bottom-edge -usage() { - echo '${0} - Position hot-babe on screen.' - echo 'Usage:' - echo " ${0} [] [ ] []" - echo ' where' - echo ' is the name of a theme directory in ~/.hot-babe or "default",' - echo ' is given in pixels or percentage of screensize (integer only),' - echo ' is given as left/right and top/bottom, respectively, and' - echo ' is above or below. This option can be given independently of the' - echo ' other positioning arguments; if given it must come last (or instead' - echo ' of the theme name).' - echo - echo 'If is not specified (or "default" is given), the script will try to' - echo 'find a running Hot Babe and determine if a "--dir " argument was given.' - echo - echo 'Note that this script will only make a limited effort at locating the' - echo 'files for the default theme; locate it and copy to your ~/.hot-babe if' - echo 'this fails.' - echo - echo 'Default values are: Zero margins, bottom-right alignment, below other windows.' - echo - exit 1 -} - if [ "${1}" ] ; then # If we have any arguments remaining.. if [ -z "${4}" ] ; then