X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=opt%2Fbin%2Fusize;h=e1751fec5b9ca5dfbb238456f9ab6a47c6087442;hb=10c0d8a71e66257bfffc6ea0ca49d9423fcc1b95;hp=39d8110f6176f27fe98ab1b0a8f90d57605a7562;hpb=f130b711466e87b0b5ee527c5487239adb595cc2;p=profile.git diff --git a/opt/bin/usize b/opt/bin/usize index 39d8110..e1751fe 100755 --- a/opt/bin/usize +++ b/opt/bin/usize @@ -3,6 +3,7 @@ # usize: Set urxvt (or terminal which understands the same escape sequences) # size. # Usage: usize [] +# Usage: usize x [x] # width=${COLUMNS:-80} @@ -18,6 +19,19 @@ case $# in 2) width=$1; height=$2;; esac +# Allow, eg, x2 for width or height. +if [ ! "${width#x}" = "${width}" ]; then + # Add a column for dividers. + width=${width#x} + width=$((width-1+(87*width))) +fi +if [ ! "${height#x}" = "${height}" ]; then + height=${height#x} + height=$((24*height)) + # Add a row for tmux. + [ $height -gt 1 ] && height=$((height+2)) +fi + [ -n "$TMUX" ] && tmux_prefix="\033Ptmux;\033" echo -e "$tmux_prefix\033[8;$height;$width;t" exit 0