#!/bin/bash -i # # usize: Set urxvt (or terminal which understands the same escape sequences) # size. # Usage: usize [] # Usage: usize x [x] # Usage: usize X # width=${COLUMNS:-80} height=${LINES:-24} tmux_prefix= case $# in 0) echo "Usage: usize $width $height" exit 1 ;; 1) width=$1;; 2) width=$1; height=$2;; esac # Allow, eg, x2 for width or height. 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 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 -en "$tmux_prefix\033[8;$height;$width;t" exit 0