X-Git-Url: http://git.iain.cx/?p=profile.git;a=blobdiff_plain;f=opt%2Fbin%2Fusize;h=e965db39fe37bf37bb933e2c931d8a9c8382bb6a;hp=e1751fec5b9ca5dfbb238456f9ab6a47c6087442;hb=08392e37a0280a6943b36d0b857f916cd650a3d5;hpb=10c0d8a71e66257bfffc6ea0ca49d9423fcc1b95 diff --git a/opt/bin/usize b/opt/bin/usize index e1751fe..e965db3 100755 --- a/opt/bin/usize +++ b/opt/bin/usize @@ -4,6 +4,7 @@ # size. # Usage: usize [] # Usage: usize x [x] +# Usage: usize X # width=${COLUMNS:-80} @@ -20,12 +21,16 @@ case $# in esac # Allow, eg, x2 for width or height. -if [ ! "${width#x}" = "${width}" ]; then +if [ ! "${width#X}" = "$width" ]; then + width="${width/X/x}" + height=$width +fi +if [ ! "${width#x}" = "$width" ]; then # Add a column for dividers. width=${width#x} width=$((width-1+(87*width))) fi -if [ ! "${height#x}" = "${height}" ]; then +if [ ! "${height#x}" = "$height" ]; then height=${height#x} height=$((24*height)) # Add a row for tmux. @@ -33,5 +38,5 @@ if [ ! "${height#x}" = "${height}" ]; then fi [ -n "$TMUX" ] && tmux_prefix="\033Ptmux;\033" -echo -e "$tmux_prefix\033[8;$height;$width;t" +echo -en "$tmux_prefix\033[8;$height;$width;t" exit 0